This patch addresses the comment in D80972.
Before this patch, the initial length field of .debug_aranges section should be declared as:
## 32-bit DWARF debug_aranges: - Length: TotalLength: 0x20 Version: 2 ... ## 64-bit DWARF debug_aranges: - Length: TotalLength: 0xffffffff TotalLength64: 0x20 Version: 2 ...
After this patch:
## 32-bit DWARF debug_aranges: - [[Format: DWARF32]] ## Optional Length: 0x20 Version: 2 ... ## 64-bit DWARF debug_aranges: - Format: DWARF64 Length: 0x20 Version: 2
Current implementation of generating DWARF64 .debug_aranges section is buggy. A follow-up patch will improve it and add test cases for DWARF64.
I wouldn't bother with a length prefix. I'm not sure it's important for testing, because either the parser will read the DWARF64 marker (i.e. 0xffffffff) and treat the next 8 bytes as the rest of the length, or it won't in which case, it will treat those 4 bytes as the actual length, regardless of their value (with possible exceptions for the rest of the reserved range, but those values can be entered as the length in the YAML document anyway).