Re: [RFA 3/3] Move logic out of symbol_find_demangled_name

Pedro Alves
2016-06-17T12:25:59Z

On 06/17/2016 09:27 AM, Tom Tromey wrote:
> Pedro> Actually, AFAICS, the new code does the same thing, because the
> Pedro> C++ version and the Rust version are exactly the same.
>
> Yeah, I forgot about that when replying.
>
> Pedro> IIUC, from Rust 1.9 onward, Rust uses C++ mangling, so basically
> Pedro> there's no way to tell a C++ symbol from a Rust symbol from the
> Pedro> mangled name alone. Correct?
>
> Yes. Java is in this situation as well. However I think it only
> matters for minimal symbols as symbols coming from DWARF typically have
> a language.

OK. I still think we should have a comment clarifying this.
The new comment mentions that we'll attempt demangling in the
order the constants are defined, but doesn't explain the
dependencies that led to the particular order you chose.

I think we could tweak the comment at the top of enum language
to something around this:

Note that there's ambiguity between the mangling schemes of some of
these languages, so some symbols could be successfully demangled by
several languages. For that reason, the constants here are sorted
in the order we'll attempt demangling them. For example: Java and
Rust use C++ mangling, so must come after C++; Ada must come last
(see ada_sniff_from_mangled_name).

>
> I think it would be better if Rust changed its mangling, but AFAIK
> nobody has seriously proposed this there yet.

Thanks,
Pedro Alves