From: Joel Brobecker <brobecker@adacore.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: partial-symtab symbol sorting (was: "Re: GDB 7.4 branching status? (2011-11-23)")
Date: Tue, 29 Nov 2011 03:07:00 -0000 [thread overview]
Message-ID: <20111129030637.GM24943@adacore.com> (raw)
In-Reply-To: <m31ussq6o2.fsf@fleche.redhat.com>
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. As it turns
out, there was a bug in ada-lang.c:compare_names and that could
have caused the two search orders to diverge. The thing is, when
I looked at it, it's not easy just looking at the partial symtab
what language it is. The language seems to be embedded in the
symbols themselves. And then, we'd still have to specify whether
we'd want to perform a binary search or not anyways. That's because
we permit "wild" matches:
(gdb) break hello
In the case above, we must break on "pck__hello" and "pck__hello__2".
In that case, binary searches based on string comparison cannot work
because we're missing the start of the symbol linkage name.
As an aside: One of the ideas I had in the past was to store the natural
name inverted - for instance "hello.pck" instead of "pck.hello". That
way, searches for hello could be done using binary searches as well.
It might actually allow us to reconcile "wild" vs "non-wild" searches,
and even allow "semi-wild" lookups as in:
(gdb) break subpackage.hello
... would now manage to find matches such as package.subpackage.hello.
This is not the case today. You either fully qualify your symbol name,
or you don't qualify it at all.
But, without even thinking about performance issues at startup, this
approach suffers from the same problem as storing the natural name does:
For certain large applications, we would exceed the maximum amount of
memory a process can hold. This is not necessarily on GNU/Linux, but
the problem is there. I think we'll have better luck we are capable of
merging a bit the massive duplication in the debug info.
--
Joel
next prev parent reply other threads:[~2011-11-29 3:07 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-23 16:39 GDB 7.4 branching status? (2011-11-23) Joel Brobecker
2011-11-23 16:56 ` Tristan Gingold
2011-11-23 18:47 ` Tom Tromey
2011-11-23 23:24 ` Joel Brobecker
2011-11-24 10:56 ` Jerome Guitton
2011-11-24 16:33 ` Joel Brobecker
2011-11-28 16:17 ` Tom Tromey
2011-11-28 21:29 ` Tom Tromey
2011-11-29 2:28 ` Joel Brobecker
2011-11-29 2:49 ` iterate_over_symbols should be a wrapper? (was: "Re: GDB 7.4 branching status? (2011-11-23)") Joel Brobecker
2011-11-29 15:27 ` iterate_over_symbols should be a wrapper? Tom Tromey
2011-11-29 3:07 ` Joel Brobecker [this message]
2011-11-29 8:41 ` partial-symtab symbol sorting (was: "Re: GDB 7.4 branching status? (2011-11-23)") Pierre Muller
2011-11-29 14:51 ` partial-symtab symbol sorting Tom Tromey
[not found] ` <47228.5772244961$1322556128@news.gmane.org>
2011-11-29 14:55 ` Tom Tromey
2011-11-29 3:11 ` multiple-location breakpoint output (was: "Re: GDB 7.4 branching status? (2011-11-23)") Joel Brobecker
2011-11-29 15:06 ` multiple-location breakpoint output Tom Tromey
2011-11-29 3:14 ` decode_digits_line_mode (was: "Re: GDB 7.4 branching status? (2011-11-23)") Joel Brobecker
2011-11-29 14:56 ` decode_digits_line_mode Tom Tromey
2011-11-29 3:19 ` [RFA/commit/testcase] "info line" should not skip prologues (was: "Re: GDB 7.4 branching status? (2011-11-23)") Joel Brobecker
2011-11-29 15:03 ` [RFA/commit/testcase] "info line" should not skip prologues Tom Tromey
2011-11-29 17:00 ` Joel Brobecker
2011-11-29 3:22 ` GDB 7.4 branching status? (2011-11-23) Joel Brobecker
2011-11-29 15:38 ` Tom Tromey
2011-11-29 3:29 ` set multiple-symbol ask/cancel not working (was: "Re: GDB 7.4 branching status? (2011-11-23)") Joel Brobecker
2011-11-29 16:14 ` set multiple-symbol ask/cancel not working Tom Tromey
2011-11-29 16:57 ` Tom Tromey
2011-11-29 17:06 ` Joel Brobecker
2011-11-30 16:41 ` Tom Tromey
2011-11-29 3:33 ` one-too-many location in breakpoint (was: "Re: GDB 7.4 branching status? (2011-11-23)") Joel Brobecker
2011-11-29 16:15 ` one-too-many location in breakpoint Tom Tromey
2011-11-29 16:59 ` Tom Tromey
2011-11-30 5:59 ` Joel Brobecker
2011-11-30 16:41 ` Tom Tromey
2011-12-05 12:04 ` Pedro Alves
2011-12-05 12:17 ` Pedro Alves
2011-12-08 18:56 ` Maciej W. Rozycki
2011-12-09 8:47 ` Joel Brobecker
2011-11-24 0:58 ` GDB 7.4 branching status? (2011-11-23) Yao Qi
2011-11-24 17:17 ` Maciej W. Rozycki
2011-11-24 17:27 ` Joel Brobecker
2011-12-03 1:19 ` Maciej W. Rozycki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111129030637.GM24943@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sources.redhat.com \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox