I often find it useful to walk the stack when I'm debugging a program and get the symbols for any properly aligned, pointer-sized value I encounter. I've gotten sick of doing this manually and so I tried writing a command that does it for me. The problem is that "info symbol" doesn't seem to like using a convenience variable as its parameter when its parameter was set via pointer dereference. IE:
(gdb) info symbol 0xb6ca4d28
[Useful Symbol Information]
(gdb) set $pointer = $esp
(gdb) while ( *(int*)$pointer != 0xb6ca4d28)
>set $pointer += 4
>end
(gdb) x/x $pointer
0x6ebee064: 0xb6ca4d28
(gdb) set $dereferencePointer = *(int *)$pointer
(gdb) p/x $dereferencePointer
$103 = 0xb6ca4d28
(gdb) info symbol $dereferencePointer
No symbol matches $dereferencePointer.
(gdb) set $dereferencePointer = 0xb6ca4d28
(gdb) p/x $dereferencePointer
$104 = 0xb6ca4d28
(gdb) info symbol $dereferencePointer
[Useful symbol information]
(gdb)
Why is this? Is this a bug? Is there a different way to do this?
Thanks!
Luc
PS: Using vanilla GDB 7.5
Update from list:
This is most likely a bug.
This was a bug present in GDB 7.5