Issue 220724.1: Remove .debug_aranges and require unit-level ranges/high/low

Author: David Blaikie
Champion: David Blaikie
Date submitted: 2022-07-24
Date revised: 2023-04-18
Date closed: 2024-10-28
Type: Enhancement
Status: Accepted
DWARF version: 6

Comparing original with 2023-04-18. [ View this version ] [ Return to the latest version ]

Section 6.1.2, pg 147

Given a discussion on dwarf-discuss (mailing lists down at the moment, so I 
can't include a link) and Clang's experience with `debug_aranges` being disabled 
by default for the better part of a decade at this point, I'd propose removing 
them from the DWARF standard in favor of adding a guarantee that CU DIEs must 
(rather than may) include a comprehensive address range (`DW_AT_high/low_pc`) or 
list of ranges (`DW_AT_ranges`). This reduces redundancy in DWARF — reducing 
debug info size and implementation complexity (having to support reading data 
from multiple/varied locations — aranges or CU DIE ranges).

Proposed solution
-----------------

Remove section 6.1.2 and 7.12 and all other references to .debug_aranges.
Remove section 6.1.2 and 7.21 and all other references to .debug_aranges.

The index lists the following references to .debug_aranges: 147, 184, 186,
187, 197, 235, 274, 275, 278, 279, 366, 371, 393, 394, 399–401, 416 - these
seem to generally be easy to remove/an editorial matter of removing a 
reference from a list of examples/descriptions. (I can enumerate them all  
explicitly if desired.)

Edit 3.1.1, p61 from:

> A full or partial compilation unit entry may have the following attributes:
> 
> 1\. Either a DW_AT_low_pc and DW_AT_high_pc pair of attributes or a 
> 1\. Either a `DW_AT_low_pc` and `DW_AT_high_pc` pair of attributes or a 
> DW_AT_ranges attribute whose values encode the contiguous or non-contiguous 
> `DW_AT_ranges` attribute whose values encode the contiguous or non-contiguous 
> address ranges, respectively, of the machine instructions generated for the 
> compilation unit (see Section 2.17 on page 51).
> 
> A DW_AT_low_pc attribute may also be specified in ... 
> A `DW_AT_low_pc` attribute may also be specified in ... 

to:

> A full or partial compilation unit entry must have either a DW_AT_low_pc and 
> A full or partial compilation unit entry must have either a `DW_AT_low_pc` and 
> DW_AT_high_pc pair of attributes or a DW_AT_ranges attribute whose values 
> `DW_AT_high_pc` pair of attributes or a `DW_AT_ranges` attribute whose values 
> encode the contiguous or non-contiguous address ranges, respectively, of the 
> machine instructions generated from the compilation unit (see Section 2.17 
> on page 61).
> 
> A full or partial compilation unit entry may have the following attributes:
> 
> 1\. A DW_AT_low_pc attribute may be specified in ...
> 1\. A `DW_AT_low_pc` attribute may be specified in ...

On p67, bullet 2 should be moved above the immediately preceding non-bullet text,
before line 13 (thereby making it required), and revised as follows:

> 2\. Either a `DW_AT_low_pc` and `DW_AT_high_pc` pair of attributes or a `DW_AT_ranges` attribute whose values
> encode the contiguous or non-contiguous address ranges, respectively, of the machine instructions and
> static data generated for the compilation unit (see Section 2.17 and page 61).

---

Revised: 2023-04-18