Getting character information for a value contained in a convenient GDB variable

It is often useful for me to go on the stack when I debug a program and get characters for any correctly aligned pointer size value that I encounter. It hurt me to do this manually, so I tried to write a team that does this for me. The problem is that the "information symbol" does not seem to like to use a convenient variable as its parameter when its parameter was set using pointer dereferencing. 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? This is mistake? Is there any other way to do this?

Thanks!

Luke

PS: Using Vanilla GDB 7.5

Update from the list:

This is most likely a mistake.

+7
source share
1 answer

Error or not, I recommend using the / a format specifier with the p and x commands. It always works for me, and it is faster too.

+1
source

All Articles