* New fhpd commands: ptype & plocation
@ 2007-09-26 20:43 Teresa Thomas
2007-09-27 6:49 ` Phil Muldoon
0 siblings, 1 reply; 6+ messages in thread
From: Teresa Thomas @ 2007-09-26 20:43 UTC (permalink / raw)
To: frysk
Two new commands have been added to fhpd:
1) ptype <VariableName/expr> : prints the type of variable/expression
2) plocation <VariableName> : prints the location of variable,
displaying any memory split if present.
Example (attached to hpd-c):
============================
(fhpd) ptype arr_1
[0.0]
long int [32]
(fhpd) plocation static_int
[0.0]
Address 0x8049e34 - 4 byte(s)
(fhpd) plocation int_21
[0.0]
Register eax - 4 byte(s)
============================
For multiple pieces the output of plocation will look like:
Piece 0: < location details >
Piece 1: < location details >
etc
Any suggestions on improving the output format?
Cheers,
Teresa
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: New fhpd commands: ptype & plocation
2007-09-26 20:43 New fhpd commands: ptype & plocation Teresa Thomas
@ 2007-09-27 6:49 ` Phil Muldoon
2007-09-27 14:14 ` Teresa Thomas
2007-09-27 14:47 ` Andrew Cagney
0 siblings, 2 replies; 6+ messages in thread
From: Phil Muldoon @ 2007-09-27 6:49 UTC (permalink / raw)
To: Teresa Thomas; +Cc: frysk
Teresa Thomas wrote:
> Two new commands have been added to fhpd:
> 1) ptype <VariableName/expr> : prints the type of variable/expression
> 2) plocation <VariableName> : prints the location of variable,
> displaying any memory split if present.
>
Nice bit of "just in time" here as I will soon be using this stuff for
watchpoints (ie translating a variable to a location, or locations).
Apart from the output code, and parsing code in fhpd, is the "get the
location" code placed in a utility class somewhere? Can you give a
programming example of given variable foo, how to get a location or
locations in memory of where it resides?
Regards
Phil
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: New fhpd commands: ptype & plocation
2007-09-27 6:49 ` Phil Muldoon
@ 2007-09-27 14:14 ` Teresa Thomas
2007-09-27 14:21 ` Phil Muldoon
2007-09-27 14:47 ` Andrew Cagney
1 sibling, 1 reply; 6+ messages in thread
From: Teresa Thomas @ 2007-09-27 14:14 UTC (permalink / raw)
To: frysk
Phil Muldoon wrote:
> Apart from the output code, and parsing code in fhpd, is the "get the
> location" code placed in a utility class somewhere? Can you give a
> programming example of given variable foo, how to get a location or
> locations in memory of where it resides?
Following is an example taken from /Variable.java/:
// Get the DWARF operations that describe the variable's location
from its DIE
List ops = variableDie.getFormData(frame.getAdjustedAddress());
// Create a LocationExpression from it
LocationExpression locationExpression = new
LocationExpression(frame, variableDie, ops);
// Decode the expression to get the location and create a
PieceLocation from it
PieceLocation pieceLocation = new
PieceLocation(locationExpression.decode(this.getType(frame).getSize()));
pieceLocation will now contain the (list of) location(s). You can print
it by using its toPrint function, manipulate
its bytes, etc. [Refer /Location.java /and /PieceLocation.java/ (or ping
me :-) ) for its other functions]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: New fhpd commands: ptype & plocation
2007-09-27 14:14 ` Teresa Thomas
@ 2007-09-27 14:21 ` Phil Muldoon
0 siblings, 0 replies; 6+ messages in thread
From: Phil Muldoon @ 2007-09-27 14:21 UTC (permalink / raw)
To: Teresa Thomas; +Cc: frysk
Teresa Thomas wrote:
> Following is an example taken from /Variable.java/:
>
> // Get the DWARF operations that describe the variable's location
> from its DIE
> List ops = variableDie.getFormData(frame.getAdjustedAddress());
> // Create a LocationExpression from it
> LocationExpression locationExpression = new
> LocationExpression(frame, variableDie, ops);
> // Decode the expression to get the location and create a
> PieceLocation from it
> PieceLocation pieceLocation = new
> PieceLocation(locationExpression.decode(this.getType(frame).getSize()));
>
> pieceLocation will now contain the (list of) location(s). You can
> print it by using its toPrint function, manipulate
> its bytes, etc. [Refer /Location.java /and /PieceLocation.java/ (or
> ping me :-) ) for its other functions]
Awesome. This is perfect, thanks
Regards
Phil
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: New fhpd commands: ptype & plocation
2007-09-27 6:49 ` Phil Muldoon
2007-09-27 14:14 ` Teresa Thomas
@ 2007-09-27 14:47 ` Andrew Cagney
2007-09-27 14:53 ` Phil Muldoon
1 sibling, 1 reply; 6+ messages in thread
From: Andrew Cagney @ 2007-09-27 14:47 UTC (permalink / raw)
To: Phil Muldoon; +Cc: Teresa Thomas, frysk
Phil Muldoon wrote:
> Apart from the output code, and parsing code in fhpd, is the "get the
> location" code placed in a utility class somewhere? Can you give a
> programming example of given variable foo, how to get a location or
> locations in memory of where it resides?
>
Phil,
I wouldn't become too attached to this command's implementation as it
currently stands; rather just view it as a a glimpse of what is to
come. That command reports the expression's result's location which
isn't sufficient; instead a walk of the expression tree that generates a
list of all referenced locations is going to be needed.
I would define the frysk.proc. object interface that you require and
expect the location tree walk code to generate that that information;
rather than try to have frysk.proc directly access frysk.debuginfo.
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: New fhpd commands: ptype & plocation
2007-09-27 14:47 ` Andrew Cagney
@ 2007-09-27 14:53 ` Phil Muldoon
0 siblings, 0 replies; 6+ messages in thread
From: Phil Muldoon @ 2007-09-27 14:53 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Teresa Thomas, frysk
Andrew Cagney wrote:
> Phil Muldoon wrote:
>> Apart from the output code, and parsing code in fhpd, is the "get the
>> location" code placed in a utility class somewhere? Can you give a
>> programming example of given variable foo, how to get a location or
>> locations in memory of where it resides?
>>
> Phil,
>
> I wouldn't become too attached to this command's implementation as it
> currently stands; rather just view it as a a glimpse of what is to
> come. That command reports the expression's result's location which
> isn't sufficient; instead a walk of the expression tree that generates
> a list of all referenced locations is going to be needed.
>
> I would define the frysk.proc. object interface that you require and
> expect the location tree walk code to generate that that information;
> rather than try to have frysk.proc directly access frysk.debuginfo.
That's fair enough. From the observer point of view, all that is needed
is a memory location and range - at the first pass. Later on as debug
register usage is optimized to not map duplicate/overlapping ranges, it
might be more meta-data.
Still all of the above (Teresa's work) is neat stuff indeed. Happy to
see it in the repo.
Regards
Phil
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-09-27 14:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-26 20:43 New fhpd commands: ptype & plocation Teresa Thomas
2007-09-27 6:49 ` Phil Muldoon
2007-09-27 14:14 ` Teresa Thomas
2007-09-27 14:21 ` Phil Muldoon
2007-09-27 14:47 ` Andrew Cagney
2007-09-27 14:53 ` Phil Muldoon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).