Issue 120719.1: DW_AT_entry_pc encoded as a constant offset from DW_AT_ranges

Author: Mark Wielaard
Champion: Cary Coutant
Date submitted: 2012-07-19
Date revised:
Date closed:
Type: Enhancement
Status: Accepted
DWARF Version: 5
Section 2.18 Entry Address, pg 40

Currently, an DIE with a DW_AT_entry_pc and a DW_AT_ranges will create
multiple relocatable addresses for both the DW_AT_entry_pc and the
DW_AT_ranges. For example:

In .debug_info

  DW_AT_entry_pc (addr) 0x403a9e <func+0x1e>
  DW_AT_ranges (sec_offset) range list [    50]

In .debug_ranges

[50] 0x403a9e <some_func+0x1e>..0x403aa4 <some_func+0x24>
     0x403abb <some_func+0x3b>..0x403abf <some_func+0x3f>

Often, as in this example, the entry_pc is equal to the first range


Since DW_AT_entry_pc is often the same, or an offset from, the
first range list address, it can be encoded as a constant offset
from the DW_AT_low_pc address or the first DW_AT_ranges address.

Wording changes:

2.18 Entry Address

Remove the '.' the end of the sentence "The value of the
DW_AT_entry_pc attribute is a relocated address" and add "if the
value of DW_AT_entry_pc is of class address; or if it is of class
constant, the value is an unsigned integer offset which, when
added to the base address of the function, gives the entry
address. The base address of the function is given by either the
DW_AT_low_pc attribute, or the first range entry in the list of
ranges given by the DW_AT_ranges attribute."

Figure 20. Attribute encodings, begins here.

Change the entry for DW_AT_entry_pc to read:

DW_AT_entry_pc   0x52   address, constant

Revised: 7/21/2013
Accepted: 7/23/2013