gpt4 book ai didi

assembly - x/in gdb (Linux) 的输出是什么意思?

转载 作者:行者123 更新时间:2023-12-02 21:33:07 25 4
gpt4 key购买 nike

我正在使用 gdb 调试 C 程序。

(gdb) r prog_name
(gdb) break main
(gdb) x/wx $esp
(gdb) 0xbffff3d0: 0xbffff60d

我知道前 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.

因此,在您的情况下,$esp包含0xbffff3d0,如果您将该值解释为指针并取消引用它,您将得到*( uint32_t *)0xbffff3d00xbffff60d

关于assembly - x/in gdb (Linux) 的输出是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21958577/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com