[llvm-dev] Emiting linkage names for Types to Debuginfo (C++ RTTI support in GDB/LLDB)

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 5 08:37:23 PST 2018


On Sat, Mar 3, 2018 at 8:20 PM Daniel Berlin via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> On Fri, Mar 2, 2018 at 3:58 PM, Roman Popov via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> Hi all,
>>
>> As you may know modern C++ debuggers (GDB and LLDB) support dynamic type
>> identification for polymorphic objects, by utilizing C++ RTTI.
>> Unfortunately this feature does not work with Clang and GDB >= 7.x .  The
>> last compiler that worked well was G++ 6.x
>>
>> I've asked about this issue both on GDB and LLDB maillists. Unfortunately
>> it's hard or impossible to fix it on debugger side.
>>
>
> Errr, i posited a solution on the gdb mailing list that i haven't seen
> shot down so far, that doesn't require linkage names, it only requires one
> new attribute that is a DW_FORM_ref, and very cheap.
>

FWIW, for C++ at least, neither Clang nor GCC (6.3) produce any DWARF to
describe the vtable itself (they describe the vtable pointer inside the
struct, but not the constant vtable array) - so it'll be a bit more than
one attribute, but the bytes describe the vtable (as a global variable? Do
we give it a name? (if so, we're back to paying that cost)) first, then to
add the reference from that to the type.

& I'm not sure what Apple would do or anyone else that has libraries
without debug info shipped & users have to debug them (this is what broke
-fno-standalone-debug for Apple - their driver API which ships without
debug info of its own, has strong vtables in it).

I can go into more detail there - but there are certainly some annoying
edge cases/questions I have here :/


>
> I also wrote the RTTI code for GDB :)
>
> Currently what debugger has to do is to demangle RTTI name and try to
>> match it to DW_AT_name attribute to find type. As you can see it does not
>> work for any of 3 examples.
>>
>> I've asked about the problem on G++ maillist, and one of the proposed
>> solutions is to emit DW_AT_linkage_name for types.
>>
>> Can this solution be also implemented in LLVM?
>>
>
> Please, no.
>
> This is completely unneeded and wastes a huge amount of space.
>
> As you can see from the replies to my solution on the gdb mailing list, it
> is used by other languages (rust, for example) *anyway*, so we might as
> well use it for C++ too.
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180305/15c750c6/attachment-0001.html>


More information about the llvm-dev mailing list