I am new to GDB, so I have some questions:
How can I look at content of the stack?
Example: to see content of register, I type info registers
. For the stack, what should it be?
How can I see the content of $0x4(%esp)
? When I type print /d $0x4(%esp)
, GDB gives an error.
Platform: Linux and GDB
info frame
to show the stack frame info
To read the memory at given addresses you should take a look at x
x/x $esp
for hex x/d $esp
for signed x/u $esp
for unsigned etc. x uses the format syntax, you could also take a look at the current instruction via x/i $eip
etc.