From: Hui Zhu <teawater@gmail.com>
To: Avi Kivity <avi@redhat.com>
Cc: Matt Rice <ratmice@gmail.com>, Hui Zhu <hui_zhu@mentor.com>,
gdb@sourceware.org
Subject: Re: 'info symbol' equivalent in python?
Date: Tue, 27 Mar 2012 01:11:00 -0000 [thread overview]
Message-ID: <CANFwon2guZrMwh+qFRon8P5K+aOyCmS9ZeAXi1EFEMx+iMtcRQ@mail.gmail.com> (raw)
In-Reply-To: <4F670EC2.2020407@redhat.com>
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
>
next prev parent reply other threads:[~2012-03-27 1:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-18 14:37 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 [this message]
2012-03-27 10:24 ` Avi Kivity
2012-03-26 15:53 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANFwon2guZrMwh+qFRon8P5K+aOyCmS9ZeAXi1EFEMx+iMtcRQ@mail.gmail.com \
--to=teawater@gmail.com \
--cc=avi@redhat.com \
--cc=gdb@sourceware.org \
--cc=hui_zhu@mentor.com \
--cc=ratmice@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox