Issue 200716.1: debug_macro header is missing a length prefix

Author: David Blaikie
Champion: David Blaikie
Date submitted: 2020-07-16
Date revised: 2021-07-09
Date closed:
Type: Enhancement
Status: Open
DWARF Version: 6

Section 6.3.1, pg 166

Most DWARF section contributions now start with a length (with the usual DWARF32/DWARF64 encoding dance) followed by a version.

This feature makes it easy for consumers to skip over portions of the DWARF they do not understand - as long as the length can be read, even if the version is unknown (too new, for instance) the length can be used to skip over the contents.

debug_macro starts with a version instead of a length, which makes this technique not possible.

To change the format would require changing the section name (since there would be no way to know that a length must be read first, instead of a version). If it's not worth changing the section name again - perhaps in the next version of DWARF it could say "version then length" and we promise to never change that - then a consumer can check the version is >= 6, and then read the length unconditionally (even if it's a version it doesn't otherwise recognize) and skip the contents. Not perfect, but might be worth doing if/when the version is reving anyway.


I don't think it's worth adding the length field to the .debug_macro section if that's the only reason we would need to bump the .debug_macro version number up to 6.

I'd like to set this issue aside until closer to the end of the DWARFv6 lifecycle and only adopt it if there's been some other reason that's motivated a version bump in the .debug_macro section.

But I'm open to other opinions... (email discussion would be great to get some of this flushed out before an in-person meeting to speed things along)

2021-07-09: Revised: Add Proposal