* 'info symbol' equivalent in python?
@ 2012-03-18 14:37 Avi Kivity
2012-03-19 4:35 ` Hui Zhu
2012-03-26 15:53 ` Tom Tromey
0 siblings, 2 replies; 8+ messages in thread
From: Avi Kivity @ 2012-03-18 14:37 UTC (permalink / raw)
To: gdb
Is there a gdb python API for 'info symbol'?
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 'info symbol' equivalent in python?
2012-03-18 14:37 'info symbol' equivalent in python? Avi Kivity
@ 2012-03-19 4:35 ` Hui Zhu
2012-03-19 9:17 ` Avi Kivity
2012-03-26 15:53 ` Tom Tromey
1 sibling, 1 reply; 8+ messages in thread
From: Hui Zhu @ 2012-03-19 4:35 UTC (permalink / raw)
To: Avi Kivity; +Cc: gdb
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'?
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 'info symbol' equivalent in python?
2012-03-19 4:35 ` Hui Zhu
@ 2012-03-19 9:17 ` Avi Kivity
2012-03-19 10:43 ` Matt Rice
0 siblings, 1 reply; 8+ messages in thread
From: Avi Kivity @ 2012-03-19 9:17 UTC (permalink / raw)
To: Hui Zhu; +Cc: gdb
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').
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 'info symbol' equivalent in python?
2012-03-19 9:17 ` Avi Kivity
@ 2012-03-19 10:43 ` Matt Rice
2012-03-19 10:48 ` Avi Kivity
0 siblings, 1 reply; 8+ messages in thread
From: Matt Rice @ 2012-03-19 10:43 UTC (permalink / raw)
To: Avi Kivity; +Cc: Hui Zhu, gdb
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)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 'info symbol' equivalent in python?
2012-03-19 10:43 ` Matt Rice
@ 2012-03-19 10:48 ` Avi Kivity
2012-03-27 1:11 ` Hui Zhu
0 siblings, 1 reply; 8+ messages in thread
From: Avi Kivity @ 2012-03-19 10:48 UTC (permalink / raw)
To: Matt Rice; +Cc: Hui Zhu, gdb
On 03/19/2012 12:43 PM, Matt Rice wrote:
> 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)
Similar. I want the names of static/global variables, not functions.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 'info symbol' equivalent in python?
2012-03-18 14:37 'info symbol' equivalent in python? Avi Kivity
2012-03-19 4:35 ` Hui Zhu
@ 2012-03-26 15:53 ` Tom Tromey
1 sibling, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2012-03-26 15:53 UTC (permalink / raw)
To: Avi Kivity; +Cc: gdb
>>>>> "Avi" == Avi Kivity <avi@redhat.com> writes:
Avi> Is there a gdb python API for 'info symbol'?
Not directly.
Please at least file a feature request; but patches are also welcome :)
Tom
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 'info symbol' equivalent in python?
2012-03-19 10:48 ` Avi Kivity
@ 2012-03-27 1:11 ` Hui Zhu
2012-03-27 10:24 ` Avi Kivity
0 siblings, 1 reply; 8+ messages in thread
From: Hui Zhu @ 2012-03-27 1:11 UTC (permalink / raw)
To: Avi Kivity; +Cc: Matt Rice, Hui Zhu, gdb
For current gdb, you can get the output of "info symbol" and parse it.
http://kgtp.googlecode.com/svn/trunk/add-ons/hotcode.py function
get_line_from_sym is a example for it.
Thanks,
Hui
On Mon, Mar 19, 2012 at 18:47, Avi Kivity <avi@redhat.com> wrote:
> On 03/19/2012 12:43 PM, Matt Rice wrote:
>> 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)
>
> Similar. I want the names of static/global variables, not functions.
>
> --
> error compiling committee.c: too many arguments to function
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 'info symbol' equivalent in python?
2012-03-27 1:11 ` Hui Zhu
@ 2012-03-27 10:24 ` Avi Kivity
0 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2012-03-27 10:24 UTC (permalink / raw)
To: Hui Zhu; +Cc: Matt Rice, Hui Zhu, gdb
On 03/27/2012 03:10 AM, Hui Zhu wrote:
> For current gdb, you can get the output of "info symbol" and parse it.
>
> http://kgtp.googlecode.com/svn/trunk/add-ons/hotcode.py function
> get_line_from_sym is a example for it.
>
>
I'll try it, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-03-27 10:24 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-18 14:37 'info symbol' equivalent in python? Avi Kivity
2012-03-19 4:35 ` Hui Zhu
2012-03-19 9:17 ` Avi Kivity
2012-03-19 10:43 ` Matt Rice
2012-03-19 10:48 ` Avi Kivity
2012-03-27 1:11 ` Hui Zhu
2012-03-27 10:24 ` Avi Kivity
2012-03-26 15:53 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).