How to do "info address" directly from python?

Tom Tromey tom@tromey.com
Wed Aug 8 14:39:00 GMT 2018


>>>>> "David" == David Griffiths <dgriffiths@undo.io> writes:

David> Hi, I can obtain the address of a non-debug symbol in python by doing:
David> gdb.execute("info address %s" % symbol, to_string=True)

David> and then parsing the result, but is there a way to obtain that information
David> directly using the python api? I've tried things like
David> gdb.lookup_global_symbol, gdb.lookup_type and gdb.parse_and_eval but none
David> of them return anything.

The Python API doesn't expose non-debug symbols yet.
In fact the whole symbol part of the API isn't really complete.
It's an area that could use some work.

David> I'd prefer not to use gdb.execute as it sometimes gets the output of the
David> command mixed up with the output of a preceding gdb.write.

That sounds like a bug worth filing.
Do you know how to reproduce it?

Tom



More information about the Gdb mailing list