如何在 GDB 中获取内存地址的符号名称? [英] How to get the symbol name for a memory address in GDB?

查看:33
本文介绍了如何在 GDB 中获取内存地址的符号名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我知道 0x46767f0 属于 NSString*,有什么办法可以找出它是什么 NSString 来帮助我找到我想要的一些错误?

For instance, I know that 0x46767f0 belongs to an NSString*, is there any way I can find out what NSString it is to help me find some bugs I'm after?

推荐答案

我相信您正在寻找:

info symbol <addresss>

打印存储在地址 addr 中的符号名称.如果在 addr 中没有准确存储符号,GDB 会打印最近的符号和它的偏移量.

Print the name of a symbol which is stored at the address addr. If no symbol is stored exactly at addr, GDB prints the nearest symbol and an offset from it.

示例:

(gdb) info symbol 0x400225
_start + 5 in section .text of /tmp/a.out

(gdb) info symbol 0x2aaaac2811cf
__read_nocancel + 6 in section .text of /usr/lib64/libc.so.6

您可以在此处阅读更多相关信息.

You can read more about it here.

这篇关于如何在 GDB 中获取内存地址的符号名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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