如何使用GDB查看堆栈的内容? [英] How can one see content of stack with GDB?

查看:832
本文介绍了如何使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆