[Dwarf-Discuss] question about variable locations from dwarf debugging information
Frank Ch. Eigler
fche@redhat.com
Thu Jun 18 17:59:36 GMT 2009
Hi -
> I am working on a project which needs to get the variable location
> from executable application. [...]
The first thing to understand is that this location can be a function
of program execution state (mainly PC value, but also register and
memory contents). So the question only makes sense when specifying
the context.
> I am wondering: Is there any other tool which help me get the memory
> address of variables? Like "print variable_name" command in gdb,
> then I could get 0xff73d305. [...]
No doubt there are other tools, but the one closest to my chair
happens to be systemtap. You could build it, then look at the output
of a little buddy diagnostic program "loc2c-test":
% nm a.out | grep main
000000000040ab00 T main
% ./loc2c-test -e a.out 0x000000000040ab00 argc
#define PROBEADDR 0x40ab00ULL
static void print_value(struct pt_regs *regs)
{
intptr_t value;
{
{ int32_t value = fetch_register (5);value = value; }
}
printk (" ---> %ld\n", (unsigned long) value);
return;
}
- FChE
More information about the Dwarf-discuss
mailing list