worst case symbol lookup performance

Srikanth srikanth@cup.hp.com
Tue Aug 10 12:20:00 GMT 1999

Stan Shebs wrote:
>    From: jtc@redback.com (J.T. Conklin)
>    Date: 10 Aug 1999 08:41:20 -0700
>    I'm not familiar with the symbol handling portions of GDB, so I'm
>    looking for ideas.  Removing the symbol lookups from write_dollar_-
>    variable() significantly improves performance, but doesn't solve the
>    underlying problem.
> Presumably you get a ~8 times speedup by removing the symbol lookup.
> What does profiling say is the most expensive operation now?

> Srikanth, did you ever look at this issue?
>                                                                 Stan

	No. This has not shown up in our profiles so far. As for
symbol lookup performance, we have successfully prototyped a new
scheme, whereby lookups are a lot faster.
Minimal symbol table : 

	Currently the minimal symbol table is sorted by address only.
In our prototype, we also sort it by the mangled name. So name lookups
are also in logarithmic time. To allow searching the minimal symbol
table by unmangled C++ names, we have come up with a just-in-time
mangling/demangling scheme. According to this, at startup gdb will 
not demangle minimal symbol table entries. Instead when a lookup
happens, we will mangle the signature just enough to get a 
reasonably long prefix of the mangled name, use the prefix to
binary search the table and demangle symbols with the same prefix
and do a full compare. 

Partial symbol table :

	All our partial symbol tables will be empty. We will use
the minimal symbol table to lookup the symbol, use the address
found there to decide which psymtab to expand. This works in 
part because in HP-gdb, the psymtabs contain only the procedure
psymbols. No types, variables etc ... There is one special "globals"
psymtab which contains all variables and types. 


More information about the Gdb mailing list