[Lldb-commits] [PATCH] D10744: Fix demangling of names if required by language
Dawn Perchik
dawn+llvm at burble.org
Tue Jul 7 18:41:41 PDT 2015
> I understand demangling just fine, I just don't like the way this patch adds functions that shouldn't need to exist. No one should be removing a mangling and replacing with another by patching up function names after they have been demangled.
I wish there were another way, alas lldb's design forces this.
> I don't know how you can claim we don't know the language in the DWARF since we always know the compile unit language for _any_ DIE in the DWARF.
I didn't mean to claim that. Yes, we know the language in DWARF; it's when the symbol is first demangled (before DWARF is parsed) that we don't know the language.
> We won't know the language for symbols in object file symbol tables, but we always do for DWARF.
Yup. Agreed.
> The other problem is we might have two symbols, one from Pascal and one from C++ that could have the same mangled name for different private non-exported symbols in two different shared libraries like "foo::bar" in C++ and "foo.bar" in pascal.
Those should result in duplicate definitions errors in the linker.
> Are there really no differences in the mangling for two such functions?
Yes. Both 'ns::func' in C++ and 'ns.func' in Pascal mangle to '__ZN2ns4funcEi' in the example above. This makes it possible to call into Pascal from C++ and vice versa.
> Your current patch will just change the mangling for the C++ one over to use the pascal demangling and that will introduce a bug. It will only introduce the bug if the mangled name from pascal has ever been accessed, otherwise it won't change it over. This needs to be fixed in another way.
Yes, it will demangle to C++ by default unless/until the CU is parsed, but there is no getting around that. Hence a patch may be forthcoming which allows a user to specify a default language to use for when the DWARF has not yet been read and/or doesn't exist, and '__ZN2ns4funcEi' will demangle to 'ns.func' in that case. I may also add support for an override language setting which will display the symbol in the requested language.
Ideally lldb would have been designed more like gdb, where the demangling is done on the fly and '__ZN2ns4funcEi' would appear as 'ns.func' in a C++ context and 'ns.func' in a Pascal context, but the current design of lldb won't allow for that without major overhaul.
Repository:
rL LLVM
http://reviews.llvm.org/D10744
More information about the lldb-commits
mailing list