This is the mail archive of the
frysk@sourceware.org
mailing list for the frysk project.
Re: New fhpd commands: ptype & plocation
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]