Re: How to do "info address" directly from python?
Emiliano Testa <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <CAPpZKExSpWMr0MXJKyujrzWXHVFFi6AqP9iJR97Wpeh8BbOqpw@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 <[email protected]> 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