From: Emiliano Testa <etesta@undo.io>
To: David Griffiths <dgriffiths@undo.io>
Cc: gdb@sourceware.org
Subject: Re: How to do "info address" directly from python?
Date: Fri, 27 Jul 2018 12:41:00 -0000 [thread overview]
Message-ID: <CAPpZKExSpWMr0MXJKyujrzWXHVFFi6AqP9iJR97Wpeh8BbOqpw@mail.gmail.com> (raw)
In-Reply-To: <CA++j6c6+7cGUq=7B2Q7TBhX=p6qjqJYVOp=N=-g8ZW2iz+TmhQ@mail.gmail.com>
I'm not knowledgeable in this context much... googling a bit helped in
finding this:
https://blog.0x972.info/?d=2015/11/02/10/10/23-looking-up-source-code-lines-from-gdbpython-and-openmp-complications
does it look helpful?
Cheers
Emiliano
On 27 July 2018 at 13:16, David Griffiths <dgriffiths@undo.io> wrote:
> Hi, I can obtain the address of a non-debug symbol in python by doing:
>
> gdb.execute("info address %s" % symbol, to_string=True)
>
> and then parsing the result, but is there a way to obtain that information
> directly using the python api? I've tried things like
> gdb.lookup_global_symbol, gdb.lookup_type and gdb.parse_and_eval but none
> of them return anything.
>
> I'd prefer not to use gdb.execute as it sometimes gets the output of the
> command mixed up with the output of a preceding gdb.write.
>
> Cheers,
>
> David
>
--
Emiliano Testa
Undo software engineer
22 Station Road
Cambridge
CB1 2JD
United Kingdom
next prev parent reply other threads:[~2018-07-27 12:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-27 12:16 David Griffiths
2018-07-27 12:41 ` Emiliano Testa [this message]
2018-08-08 14:39 ` 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=CAPpZKExSpWMr0MXJKyujrzWXHVFFi6AqP9iJR97Wpeh8BbOqpw@mail.gmail.com \
--to=etesta@undo.io \
--cc=dgriffiths@undo.io \
--cc=gdb@sourceware.org \
/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