Re: Pretty-printers auto-loading and static libraries
Pierre-Marie de Rodat <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
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