Re: DWARF5 and .gdb_index/.debug_names

David Blaikie via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAENS6Eub6m-ykHhtM=-_uH=ekiwA4M_9gbqiEPvu=W3PTg26xw@mail.gmail.com>
On Mon, Aug 31, 2020 at 1:29 AM Jan Kratochvil via Gdb <[email protected]>
wrote:

> On Sun, 30 Aug 2020 19:18:51 +0200, Mark Wielaard wrote:
> > During the BoF Pedro mentioned that the GDB DWARF5 .debug_names support
> > is incomplete/wrong. I was wondering whether there was a good
> > description of the issue and/or a bug report for it. When using the
> > contrib/gdb-add-index.sh it does add a .gdb_index for objects
> > containing DWARF5 and the results seem correct, gdb also seems to be
> > able to use it. When adding -dwarf-5 it seems to output a .debug_names
> > section which can be read by binutils readelf (elfutils doesn't yet
> > support .debug_names). I couldn't immediately see in what way it was
> > wrong/incomplete.
>
> .debug_names from GDB needs to produce also DW_IDX_die_offset to make it
> consumable by debuggers with reasonable performance.
>
> Then I see clang++ -gdwarf-5 -gpubnames produces C++ names mangled while
> GDB
> produces them unmangled. I haven't found anything in DWARF-5 standard
> suggesting either.


DWARFv5, Page 137 lists the things that must be in the debug_names table,
including:

"If a subprogram or inlined subroutine is included, and has a
DW_AT_linkage_name attribute, there will be an additional index entry for
the linkage name."

It's really important that all the producers ensure the names present are
the same/at least what is in the spec, otherwise we can easily erode trust
in the name table and consumers may end up having to ignore it to ensure
correctness.


> Given mangled->unmangled mapping is possible but
> unmangled->mangled is not (such as variants of ctors/dtors) I find the
> clang
> way should be followed.
>
>
> Jan
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.