Pretty-printers auto-loading and static libraries
Pierre-Marie de Rodat
derodat@adacore.com
Mon Jan 19 15:02:00 GMT 2015
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
More information about the Gdb
mailing list