GDB Python API:从地址获取符号名称 [英] GDB Python API: Getting symbol name from address

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

问题描述

In GDB shell I can get symbol name from address like this:

(gdb) info symbol 0x405ece
top::test_thread() in section .text of test_procs

How can I do the same using Python GDB API (https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html)? Is it possible at all?

解决方案

Something like this should work (untested):

block = gdb.block_for_pc(0x405ece)
while block and not block.function:
  block = block.superblock

print block.function.print_name

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

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