0
votes

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?

1

1 Answers

2
votes

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