public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Matt Rice <ratmice@gmail.com>
To: Avi Kivity <avi@redhat.com>
Cc: Hui Zhu <hui_zhu@mentor.com>, gdb@sourceware.org
Subject: Re: 'info symbol' equivalent in python?
Date: Mon, 19 Mar 2012 10:43:00 -0000	[thread overview]
Message-ID: <CACTLOFpC4TVgCfcdu+kem-WvOjPH+S-fYoaRCMk5cryr--zKJA@mail.gmail.com> (raw)
In-Reply-To: <4F66F9A2.2060407@redhat.com>

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)

  reply	other threads:[~2012-03-19 10:43 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 [this message]
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

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=CACTLOFpC4TVgCfcdu+kem-WvOjPH+S-fYoaRCMk5cryr--zKJA@mail.gmail.com \
    --to=ratmice@gmail.com \
    --cc=avi@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=hui_zhu@mentor.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).