Re: gdb 8.x - g++ 7.x compatibility

Roman Popov
2018-03-02T23:06:27Z

Ok, sounds reasonable. In case of debugger we are indeed "linking" RTTI
name with name in debuginfo.

I've checked LLVM docs, they generate Debuginfo from LLVM "Metadata", and
metadata for types already contains mangled names in "identifier" field:
https://llvm.org/docs/LangRef.html#dicompositetype . So it should not be
hard to propagate it to object file.

I will ask on LLVM maillist if they can emit it.

2018-03-01 13:03 GMT-08:00 Jason Merrill <jason@redhat.com>:

> On Thu, Mar 1, 2018 at 3:26 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> > On Thu, Mar 1, 2018 at 12:18 PM, Roman Popov <ripopov@gmail.com> wrote:
> >> Is there any progress on this problem?
> >>
> >> I'm not familiar with G++ , but I have little experience with LLVM. I
> can
> >> try make LLVM emitting mangled names to DW_AT_name, instead of demangled
> >> ones.
> >> This way GDB can match DW_AT_name against RTTI. And for display it can
> >> call abi::__cxa_demangle(name, NULL, NULL, &status), from #include
> >> <cxxabi.h>.
> >>
> >> Will it work?
> >
> >
> > Reading http://wiki.dwarfstd.org/index.php?title=Best_Practices:
> > the DW_AT_name attribute should contain the name of the corresponding
> > program object as it appears in the source code, without any
> > qualifiers such as namespaces, containing classes, or modules (see
> > Section 2.15). A consumer can easily reconstruct the fully-qualified
> > name from the DIE hierarchy. In general, the value of DW_AT_name
> > should be such that a fully-qualified name constructed from the
> > DW_AT_name attributes of the object and its containing objects will
> > uniquely represent that object in a form natural to the source
> > language.
> >
> >
> > So having the mangled symbol in DW_AT_name seems backwards and not the
> > point of it.
>
> If we add the mangled name, which seems reasonable, it should be in
> DW_AT_linkage_name.
>
> Jason
>