DWARF5 support for dwz

Mark Wielaard mark@klomp.org
Mon Sep 14 10:23:51 GMT 2020


Hi,

At the virtual GNU tools cauldron we had a little session about making
DWARF5 the default for GCC. GCC, binutils and gdb seem ready now, so
next up is DWZ. https://gcc.gnu.org/wiki/LPC2020NotesDWARF

Since nobody volunteered to add DWARF5 support I started
on some simple patches. The following 4 patches handle the easy parts.
Recognize some new DWARF5 .debug sections. Handle DWARF5 headers for
compile and partial units. Handle new DWARF5 attributes. And handle
some new DWARF5 operations as their GNU extension.

Next up is the harder part, parsing the new FORMs. DW_FORM_data16
should be easy. DW_FORM_line_strp is easy in principle, but might need
some thought to see how/if DIEs that reference the new .debug_line_str
can be moved (.debug_line_str itself cannot be moved to the supplemental
file so the string itself, and possibly .debug_line, should be rewritten
to point to the shared supplemental .debug_str section). The hard part
is DW_FORM_implicit_const which has its value in the abbrev, so just
having form plus .debug_info ptr isn't enough to read it. I think I have
a solution to that issue, but have to check how it interacts with the
hashing and writing out the new from.

There are a couple of forms that GCC only emits when generating split-DWARF
that I don't intend to implement righ now, DW_FORM_strx, DW_FORM_addrx,
DW_FORM_loclistx and DW_FORM_rnglistx.

Also there are standardized forms for GNU_ref_alt and GNU_strp_alt
(DW_FORM_ref_sup4, DW_FORM_ref_sup8 and DW_FORM_strp_sup) which I don't
want to use for now since they would require updates to consumers
(just like switching from .gnu_debugaltlink to .debug_sup). So I hold
those to the end (maybe we will introduce a new --dwarf5 flag for that?)

After the new FORMs patches are needed to read the new .debug_loclists
and .debug_rnglists sections. Then parse the .debug_line version 5 variant
(which gcc currently doesn't emit yet, but I have patches to make it
do so through binutils gas).

Finally we need to write out all the new data formats and possibly
optimize for the new forms.

Cheers,

Mark



More information about the Dwz mailing list