This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [2/2] RFA: implement 'set print symbol'


>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

Eli> Maybe I misunderstand what "set print symbol-filename" does, but at
Eli> least the manual seems to imply that it affects "print /a":

Eli>   If you have a pointer and you are not sure where it points, try
Eli>   @samp{set print symbol-filename on}.  Then you can determine the name
Eli>   and source file location of the variable where it points, using
Eli>   @samp{p/a @var{pointer}}.  This interprets the address in symbolic
Eli>   form.

Eli> And your change makes it so the symbol is printed even without the /a
Eli> part, AFAIU.  So what am I missing?

Suppose you have:

char x;

By default if you print it you get:

(gdb) print &x
$1 = 0xaaaaaa

With /a:

(gdb) p/a &x
$2 = 0xaaaaaa <x>

My patch makes the output look like this all the time.

'set print symbol-filename on' only works for function symbols:

(gdb) p /a &x
$3 = 0xaaaaaa <x>

(gdb) p &main
$4 = (int (*)()) 0x400474 <main at q.c:4>

It just adds the "at q.c:4" bit.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]