This is the mail archive of the
mailing list for the GDB project.
Re: [RFC] allow unqualified function names in linespecs
- From: Tom Tromey <tromey at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 20 Dec 2011 08:18:29 -0700
- Subject: Re: [RFC] allow unqualified function names in linespecs
- References: <firstname.lastname@example.org>
>>>>> "Joel" == Joel Brobecker <email@example.com> writes:
Joel> But there are situation where it's either convenient or necessary to
Joel> avoid the fully-qualified name, and use the "simple" name instead.
Joel> For instance:
Joel> (gdb) break foo
What situations do you mean? A situation for the user, where it is
convenient? Or some kind of "context" situation where if the name
cannot be found locally, gdb searches?
The latter I would like us to avoid. My view is that linespecs are
different from expressions, and one way in particular that they are
different is that they should mean the same thing no matter the context
in which you evaluate them.
Joel> We get lucky, enjoying the side-effects of a call
Joel> cp_canonicalize_string_no_typedefs, which indirectly causes us to
Joel> perform an Ada lookup which itself causes the matching partial
Joel> psymtabs to be expanded to full symtabs.
Ugh. This continues to be a real mess, I'm sorry about that.
Joel> What this patch does is something that I feel should be hidden
Joel> inside ada-lang. Namely, decide which matching routine to use based
Joel> on the name we are using to search for matches. I think that the
Joel> real question is to trying to find the proper interface for this.
Ok, I see, it is based on the spelling of the linespec. I guess I am ok
I don't think it is the very best thing for us to have Ada be so very
different from the rest of GDB in so many ways -- special debuginfo
encoded in symbol names, special rules for linespecs, special rules for
iterating symbol tables. I am sure it is better for Ada users, but the
problem is that if we want to make changes to core things in GDB,
eventually it requires you to step in and do a piece of the work. E.g.,
we just punted on .gdb_index support for Ada.
I know it isn't super on the other side, either, with C++ setting the
norm, regardless of the applicability to other languages. There are
probably just as many C++ hacks around :-(
[ ideas ]
Joel> . Redesign a bit the interface. For instance, let the language
Joel> itself iterate over all partial symbols? The default implementation
Joel> would do what we already do. The Ada implementation would do
Joel> something else, not sure what yet. And we could get rid of
Joel> the la_symbol_name_compare method.
I suppose either this or having a way for the language to compute the
I am not so sure about an Ada-specific psymtab walker. I think I'd have
to see the patch or a fuller proposal.