This is the mail archive of the
mailing list for the GDB project.
Re: RFA: implement ambiguous linespec proposal
>>>>> "Jan" == Jan Kratochvil <email@example.com> writes:
Jan> Compiler says:
Jan> .C:13:6: error: call of overloaded âm()â is ambiguous
Jan> .C:13:6: note: candidates are:
Jan> .C:6:7: note: int N2::m()
Jan> .C:2:7: note: int N1::m()
Jan> and I think GDB should also say the same output as error.
I agree for expressions. I think linespecs are different.
For example, with ADL, a plain name like "function" may be looked up in
the namespaces of the arguments. I don't see how linespec will ever
handle this sanely.
GDB is already inconsistent here, BTW. For example, "break k::m" will
search superclasses of "k", but "break m" will not search superclasses
of the class of *this.
I have been thinking about this, though, and I think there is another
approach that could work.
Jan> One can store the available namespaces as strings with the
Jan> breakpoint (instead of storing pointer to the block - where the
Jan> block may disappear).
Yeah. I would like to store as little context as possible, though. Or,
rather, I would like all the context to appear in the linespec's
The way we could make this work is that we could have decode_line_full
return sets of SALs, where each set is distinguished by its canonical
name. So, in this case, we would return two sets, one "N1::m" and one
Then, this would create two separate breakpoints -- one per set.
This is more complicated than just rejecting this case, but it would let
us preserve namespace searches.
I think it would also make some Ada cases work more sanely, though I
don't know enough to say with certainty. I'm thinking here about how
ada_lookup_symbol_list returns a list but then the linespec code only
uses the first one (via some call through ada_lookup_encoded_symbol, I
don't remember the details).
My problem with this is that it adds more complexity to the user
interface: some linespecs will create a single breakpoint with multiple
locations, some will create multiple breakpoints once again, depending
on the context.
So, I am still against it, but I will take a stab at it if you think it