Possible Duplicate:
Using gdb to check register’s values
I know that to read from the memory location below:
mov %esi, (%eax)
when in GDB I can use
(gdb) display *(int *)$eax
If a want to read from memory location 0x8(%eax), which command can I use in GDB? I tried to use some variants of the display command above, but I was not successful.
You can use
displayif you want to see the expression after any new step. This is useful if you want to watch this expression. if you simply want to show the state of an exepression just useprint.For example:
if you want to take a look for example at an
intstored at location0x8(%eax)you can useSometimes it seems you need to omit the $ in front of the registers to make gdb work correctly.
Here a simple dump of a debugging session on a 32 Bit x86 executable: