cpu registers - How to print -0x4(%rbp) in gdb? -


Disassembly contains such code:

  movl $ 0x6, -0x4 (% rbp) )   

I try to print the value like this but fails:

  (gdb) p 0x4 (% esp) expression in one Syntax error,% esp) '. (GDB) number 0x4 + $ esp for logic arithmetic operations, no number or bullion.   

How to print it correctly?

It looks like you, working with 64 bit code, in which case you just need Is like:

  (gdb) p $ rbp-0x4 $ 1 = (zero *) 0x7fff5fbff71c   

If you want to see that in fact at is at this address, then you must enter the zero * address, e.g.

  (Gdb) p / x * (int *) ($ rbp-0x4) $ 2 = 0x7fff   

Or in a nutshell, Instead of x , use p , such as

  (gdb) x / w $ rbp-0x4 0x7fff5fbff71c: 0x00007fff    

Comments