[Dwarf-Discuss] DWP mixed (DWARFv4/pre-standard + DWARFv5) content

Pavel Labath labath@google.com
Tue Feb 25 19:41:21 GMT 2020

Yeah, this sounds tricky, but it is actually good timing, because I
was just about to start working on DWP v5 in lldb. I was hoping that
would be an easy ride, but it looks like things will get complicated.

On Tue, 25 Feb 2020 at 18:53, David Blaikie <dblaikie at gmail.com> wrote:
> (please add anyone who has a vested interest in Split DWARF in general and dwp in particular)
> tl;dr:
> How should DWARFv4 and DWARFv5 coexist in a DWP file:
> 1) Not at all (invalid/unsupported)
> 2) Single index table where the section indexes are subjective (look at the version of the referenced CU/TU to decide what a column number means (eg: 8 is DW_SECT_MACRO in v4, DW_SECT_RNGLISTS in v5)
> 3) Emit multiple indexes (cu_index and tu_index each would contain two indexes) - a v4 (well, index version 2) and a v5 (index version 5) index.

What about option 4)? :P Have the numbers be interpreted relative to
the debug_cu_index version number?
The idea would be that a DWARF v4 (dwp tool seems to use version
number 2 for some reason) debug_cu_index would keep using the existing
pre-standard scheme, and it would not be able to refer to v5 units. In
a v5 debug_cu_index (*), we would use the official DWARF v5 scheme,
*but* we would, as an extension, support referring to the pre-standard
sections via custom DW_SECT constants (with some high numbers to avoid
conflicting with future standard versions).

(*) The v5 cu_index would be used whenever we have at least one v5
dwarf unit. Ignoring the section number mismatches, I think this is a
reasonable approach, and it is the one I would make if I was in the
shoes of the DWARF v6 committee and needed to make the debug_cu_index
cover mixed-version units

Speaking of DWARF v6, I think the debug_cu/tu_index sections are in
need of some redesign anyway. For example, it's not clear to me how
these sections would work in presence of DWARF64 -- all section
offsets are hardcoded to 4 bytes, and we don't even have the
initial_length mechanism to select bigger sizes.


More information about the Dwarf-discuss mailing list