如何使用GDB查看堆栈的内容? [英] How can one see content of stack with GDB?
问题描述
我是GDB的新手,所以我有一些问题:
I am new to GDB, so I have some questions:
-
如何查看堆栈的内容? 示例:要查看寄存器的内容,请键入
info registers
.对于堆栈,应该是什么?
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?
如何查看$0x4(%esp)
的内容?当我键入print /d $0x4(%esp)
时,GDB给出了一个错误.
How can I see the content of $0x4(%esp)
? When I type print /d $0x4(%esp)
, GDB gives an error.
平台:Linux和GDB
Platform: Linux and GDB
推荐答案
info frame
显示堆栈框架信息
要读取给定地址的内存,请查看x
To read the memory at given addresses you should take a look at x
x/x $esp
表示十六进制x/d $esp
表示带符号x/u $esp
表示无符号等.x使用格式语法,您也可以通过x/i $eip
等查看当前指令.
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.
这篇关于如何使用GDB查看堆栈的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!