This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Pretty-printers auto-loading and static libraries
- From: Pierre-Marie de Rodat <derodat at adacore dot com>
- To: GDB <gdb at sourceware dot org>
- Date: Mon, 19 Jan 2015 16:02:49 +0100
- Subject: Re: Pretty-printers auto-loading and static libraries
- Authentication-results: sourceware.org; auth=none
- References: <54B53450 dot 5090007 at adacore dot com>
On 01/13/2015 04:05 PM, Pierre-Marie de Rodat wrote:
I guess my pretty-printers should be temptatively loaded when the
new_objfile event is triggered: if the corresponding Objfile defines an
"adainit" symbol they should be registered in it. Unfortunately I failed
so far to implement this behavior: Objfile do not expose the
corresponding symbol table and Symtab_and_line instances don't even
enable one to perform symbol lookups.
I dived into the Python API documentation with a fresh mind:
- gdb.lookup_global_symbol returns Symbol instances;
- Symbol instances have a symtab attribute;
- Symtab instances have an objfile attribute.
So it is actually possible to register pretty-printers depending on the
presence of a symbol! I tried it with my setups and it works properly. :-)
Still to be determined: I don't know if performing a global symbol
lookup at each objfile load is acceptable from a performance point of view.
--
Pierre-Marie de Rodat