This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 'info symbol' equivalent in python?


On 3/19/12, Avi Kivity <avi@redhat.com> wrote:
> On 03/19/2012 06:34 AM, Hui Zhu wrote:
>> http://sourceware.org/gdb/current/onlinedocs/gdb/Symbols-In-Python.html#Symbols-In-Python
>>
>>
>> On 03/18/12 22:37, Avi Kivity wrote:
>>> Is there a gdb python API for 'info symbol'?
>>>
>>
>
> These give lookup the symbol given a name.  I want to lookup a symbol
> given an address (like 'info symbol').

sounds like you're looking for the block_for_pc and gdb.Block's
function attribute,

(gdb) py print repr(gdb.block_for_pc(0x0000000000400598).function)
<gdb.Symbol object at 0x7fb5ef615df0>
(gdb) py print gdb.block_for_pc(0x0000000000400598).function
main
(gdb)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]