我正在使用 gdb 调试 C 程序。
(gdb) r prog_name
(gdb) break main
(gdb) x/wx $esp
(gdb) 0xbffff3d0: 0xbffff60d
Run Code Online (Sandbox Code Playgroud)
我知道前 3 个命令的含义。
我不明白的是最后一个的含义(第三个命令后 gdb 的输出)。具体来说,我不明白:$esp 是一个寄存器,因此我希望在寄存器中找到一个单一值,并且据我所知,寄存器没有地址。那么,假设0xbffff60d是寄存器esp包含的值,那么 ** 0xbffff3d0**是什么?
提前致谢
直接来自gdb:
(gdb) help x
Examine memory: x/FMT ADDRESS.
ADDRESS is an expression for the memory address to examine.
FMT is a repeat count followed by a format letter and a size letter.
Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal),
t(binary), f(float), a(address), i(instruction), c(char) and s(string),
T(OSType), A(floating point values in hex).
Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes).
The specified number of objects of the specified size are printed
according to the format.
Run Code Online (Sandbox Code Playgroud)
因此,在您的情况下,$espcontains 0xbffff3d0,如果您将该值解释为指针并取消引用它,您将得到*(uint32_t *)0xbffff3d0is 0xbffff60d。
| 归档时间: |
|
| 查看次数: |
7513 次 |
| 最近记录: |