Hello DWARF fans,
I've just posted a set of four refactoring patches for DebugInfo/DWARF,
which move in the direction of handling DWARF v4 or v5 type units and
compile units more coherently.
In DWARF v4, type units and compile units are strictly segregated into
the .debug_types and .debug_info sections, respectively. This division
was pretty ingrained into how DebugInfo/DWARF handled the units.
In DWARF v5, type units and compile units are all in the .debug_info
section, and the .debug_types section is obsolete. So, we need to have
a container than can handle both kinds of units in a straightforward way.
The refactoring replaces a pair of collections templated on the unit type
with a single collection whose elements are base-class pointers; thus it
can contain elements that are a mix of unit kinds. Everything that really
mattered was either already virtual or was straightforward to convert to
generic handling. I think I needed only one type-based conditional, on
top of what already existed. The code doesn't *quite* support DWARF v5
type units in the .debug_info section, but the new starting point should
make that straightforward.
In a mixed v4/v5 executable, we can pretend the .debug_types sections
are all really .debug_info sections, and tack them onto the end of the
vector of units that already handles a mix of compile and type units.
This is also how the LLDB DWARF parser handles this case, so it's at
least consistent in principle (even if the actual code differs).
The existing distinction between "normal" and split (DWO) units remains;
that has to do with what information exists in which object files, and
is not fundamentally changing in DWARF v5.
Patch 1: De-templatize DWARFUnitSection
⚙ D49741 [DebugInfo/DWARF] [1/4] De-segregate type units and compile units. NFC
Patch 2: The TU collection doesn't need to be a deque
⚙ D49742 [DebugInfo/DWARF] [2/4] De-segregate type units and compile units. NFC
Patch 3: Rename DWARFUnitSection to DWARFUnitVector
⚙ D49743 [DebugInfo/DWARF] [3/4] De-segregate type units and compile units. NFC
Patch 4: Unify handling of type and compile units
⚙ D49744 [DebugInfo/DWARF] [4/4] De-segregate type units and compile units. NFC