Re: RFA: implement ambiguous linespec proposal

Tom Tromey
2011-11-09T17:12:20Z

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> We have a similar issue: When the user inserts a breakpoint, and there
Joel> are multiple possible choices, we have two scnearios:
Joel> 1. He selects `all' -> In that case, we actually create one breakpoint
Joel> with multiple locations;
Joel> 2. He selects a subset -> In that situation, we create one breakpoint
Joel> per location.
Joel> I think this can be pretty confusing.

This happens with the new code too, though it depends on the
'multiple-symbols' setting. For 'all', there is no menu, just a
breakpoint with all the locations.

The code is based around the idea that a linespec has a canonical form.
Re-setting is done based by re-parsing the original linespec (though
there are exceptions to this rule -- linespec is pretty complicated);
but filtering is done based on the canonical form.

The exception to the re-parsing rule is for linespecs where the original
text is context-relative. For example, "break 57" -- it would not make
sense to try to re-parse "57", instead linespec returns a form of
"file.c:57".

So, I misspoke a little upthread. The problem with the searching
namespace using declarations for C++ is that the linespec is
context-relative, but there is no unique non-relative form we can
rewrite. That is, in the example, the rewritten form for re-parsing
would have to be both "N1::m" and "N2::m".

Joel> [1]: We tried contributing it, but it was too hacky to really be part
Joel> of the FSF sources. The main complaint at the time was the fact
Joel> that it introduced a canonical form that was specific to Ada. I was
Joel> planning on looking at generalizing it to all languages, but never
Joel> got around to doing it.

Do you have a URL? This would be a good time to resurrect it.
I would like to take a look... I don't know Ada, though, so I'm going to
guess that I probably won't be able to fix it up.

In terms of the proposed patch, the key question is whether rewriting is
needed for Ada, and if so, whether it can be done uniquely. Or, if
using the simple name is always enough... in this case the solution is
very easy.

Tom