Search code examples
assemblyx86gdb32-bitatt

Failed to find changed memory content in gdb


I am debugging a x86 32bit binary program. And when I try to execute the instructions below, I just cannot find any memory update in the memory corresponding to buf when use gdb to debug. ( The buf is allocated in .bss section).

... 
movl $0x4E713,buf(,%eax,0x4)
add $0x1,%eax
...

When I execute the above code in gdb, I did these:

x/10x &buf

And to my surprise, even after the execution of the above code, the content of buf is still something like this (suppose the value of eax is zero):

0xf7fb6ef0 <buf>:       0x00000000      0x00000000      0x00000000      0x00000000
0xf7fb6f00 <buffer>:    0x00000000      0x00000000      0x00000000      0x00000000
0xf7fb6f10 <buffer>:    0x00000000      0x00000000

Doesn't the address 0xf7fb6ef0 contain value 0x4e713 ?

Am I clear ? Could anyone give me some help?


Solution

  • Presumably the buf you see refers to another symbol of the same name, or gdb picks up a wrong address somehow. Disassemble the instruction in gdb, and verify the actual address.

    You might also try info variables ^buf$