Use compilation unit as base address when no base address exists for range.
Summary: From Dwarf4 standard http://dwarfstd.org/doc/DWARF4.pdf#page=53 ```name=2.17.3 Non-Contiguous Address Ranges The applicable base address of a range list entry is determined by the closest preceding base address selection entry (see below) in the same range list. If there is no such selection entry, then the applicable base address defaults to the base address of the compilation unit (see Section 3.1.1). In the case of a compilation unit where all of the machine code is contained in a single contiguous section, no base address selection entry is needed. ``` http://dwarfstd.org/doc/DWARF4.pdf#page=58 ```name=3.1.1 Normal and Partial Compilation Unit Entries Compilation unit entries may have the following attributes: 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 address ranges, respectively, of the machine instructions generated for the compilation unit (see Section 2.17). A DW_AT_low_pc attribute may also be specified in combination with DW_AT_ranges to specify the default base address for use in location lists (see Section 2.6.2) and range lists (see Section 2.17.3). ``` http://dwarfstd.org/doc/DWARF4.pdf#page=61 ```name=3.1.1 Normal and Partial Compilation Unit Entries The base address of a compilation unit is defined as the value of the DW_AT_low_pc attribute, if present; otherwise, it is undefined. If the base address is undefined, then any DWARF entry or structure defined in terms of the base address of that compilation unit is not valid. ``` http://dwarfstd.org/doc/DWARF4.pdf#page=52 ```name=2.17 Code Addresses and Ranges - 2.17.1 Single Address When there is a single address associated with an entity, such as a label or alternate entry point of a subprogram, the entry has a DW_AT_low_pc attribute whose value is the relocated address for the entity. While the DW_AT_entry_pc attribute might also seem appropriate for this purpose, historically the DW_AT_low_pc attribute was used before the DW_AT_entry_pc was introduced (in DWARF Version 3). There is insufficient reason to change this. ``` Reviewed By: luciang Differential Revision: D23422082 fbshipit-source-id: 4de79fa81e6c323095bb7c79faf87369998138c6
Showing
Please register or sign in to comment