This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Proposed changes in symbol-handling for Ada

On Tue, Jan 20, 2004 at 05:16:13AM -0500, Paul Hilfinger wrote:
> David,
> I'd appreciate your comments on the following approach to handling the
> ... um ... difference of opinion between the Ada world and everyone else
> regarding symbols.  We've briefly discussed it before; now I'd like to get
> specific.
> We decided years ago NOT to store demangled names, considering it an
> unnecessary waste of space (some ACT customers have very large symbol tables)
> and start-up time.  Instead we MANGLE names that are searched for and then
> look those up.  In our own sources, we've added a level of indirection to
> minimize the effect on the rest of GDB.  It's worked out well, and we've 
> experienced very few maintenance problems with this approach (aside, 
> of course, from a SMALL amount of fuss to adapt your major re-organization
> of the symbol stuff (:->)).  
> Basically, we found it sufficient to introduce some additional macros in 
> symtab.h: 
> +/* Macro that returns the name to be used when sorting and searching symbols. 
> +   In  C++, Chill, and Java, we search for the demangled form of a name,
> +   and so sort symbols accordingly.  In Ada, however, we search by mangled
> +   name. */
> +#define SYMBOL_SEARCH_NAME(symbol)					 \
> +   (SYMBOL_LANGUAGE (symbol) == language_ada 				 \
> +    ? SYMBOL_LINKAGE_NAME (symbol)					 \
> +    : SYMBOL_NATURAL_NAME (symbol))

Hi Paul,

I'd like to get your opinions on another change I've been considering,
first.  It may turn out to be completely unsuitable for Ada, better to
know now than later :)

Rather than demangling at startup, we ask each mangled name for a base
identifier.  This can be done reasonably efficiently - I hope - I
haven't performed measurements yet.  Then, when we search for a symbol,
we wildcard for the basename.  We demangle everything with that
basename.  If you do a search that doesn't know the basename you
have to un-lazy all symbols, of course, but I don't think that's much
of a change.

This would provide, from my undersanding, a small simplification versus
the Ada approach and a solid speedup for the non-Ada approach.

Does Ada have:
 - the concept of a "basename" for each mangled name
     For C++, this would be foo::bar::baz() -> baz, and the basename is
     always stored within the mangled name so can be represented as an
     offset and length.  For Java, I think this is true except for
     escape sequences.  I believe there are fixed rules about what
     characters get escaped, so we can do that to symbols we search for
     before looking for the basename.
 - Reasonably unique (i.e. user-choosable) basenames.  If every package
   (or whatever they are in ada) has a method with the same basename,
   then this scheme obviously won't work.
 - Any other problems?

Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]