RE: partial-symtab symbol sorting (was: "Re: GDB 7.4 branching status? (2011-11-23)")

Pierre Muller
2011-11-29T08:41:59Z

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Joel Brobecker
> Envoyé : mardi 29 novembre 2011 04:07
> À : Tom Tromey
> Cc : gdb-patches@sources.redhat.com
> Objet : partial-symtab symbol sorting (was: "Re: GDB 7.4 branching status?
> (2011-11-23)")
>
> This is an issue that is only tangential to this patch, and should
> not be considered part of the series.
>
> I just realized that partial symbols are sorted using strcmp_iw_ordered.
> This works great for C++, for instance, but only works OK for Ada.
> I think that this is related to the fact that we might be using
> the linkage name, rather than the natural name (we compute the natural
> name only on-demand, due to memory pressure in large apps). As a result,
> the strcmp_iw_ordered routine can return non-zero for two names that
> ada-lang.c:compare_names would consider equal.
>
> For instance: `pck__hello' and `pck__hello__2'.
>
> So when doing a symbol lookup for pck__hello, for instance, we pass
> our own comparison routine, which is "compatible" with
> strcmp_iw_ordered to the psymtab map_matching_symbols routine.
> This allows us to perform a binary search rather than linear one.
>
> I am wondering if we shouldn't be sorting the partial symbols
> using a language-specific sorting routine instead.

Did you think about what would happen to executables containing
objects compiled in different languages, each having a different sorting
routine?

I don't understand how this would work in such a case?

Pierre Muller
GDB pascal language support maintainer