This patch is intended to significantly improve the support for DWARF v5 range lists (in the .debug_rnglists section) on the consumer side. Basically, it enables any consumer to extract a DWARF v5 encoded rangelist (via DIE::getAddressRanges()).
Still missing for full support are the DW_RLE-* encodings that use an index into the .debug_addr section to designate address ranges (e.g. DW_RLE_startx_endx). These will be supported at a later stage.
This patch does the following:
- Adds a method to the DebugRnglist class to return a DWARFAddressRangesVector based on it.
- Adds methods to the DebugRnglistTable class to a) retrieve a rangelist based on an offset and if needed extract it from the section b) given an index, retrieve an entry into the table's offset table (which represents an offset to a range list). c) add a format property to the table class to designate which dwarf format the table is encoded in (only DWARF32 supported at the moment).
- Adds a range list table to the DWARFUnit class which holds the DebugRnglistTable that belongs to the unit.
- Adding 3 methods to DWARFUnit to a) obtain DWARFAddressRangesVectors given either a range list offset or an index. The former is used with DW_FORM_sec_offset, the latter with DW_FORM_rnglistx, when handling the DW_AT_ranges attribute in DIEs. b) retrieve the range list offset that results from using an index supplied with DW_FORM_rnglistx. This is used only to dump the offset.
- Slightly refactor the dumping code in DWARFContext in the face of dumping both .debug_rnglists and .debug_rnglists.dwo.
- Using getRelocatedAddress() instead of getAddress() when extracting range lists.
- When dumping a rangelist referenced from a DIE, and the DW_AT_ranges attribute uses FORM_rnglistx, add some code to dump the offset that is retrieved via the index.
- Change DWARFDie::getAddressRanges() to use the interface now provided by DWARFUnit to obtain a DWARFAddressRangesVector via DW_AT_ranges.
- Some additions to DWARFFormValue to deal with DW_Form_rnglistx.
- DWARFUnit now parses the range list table header in version 5 and tries to set up the range list table based on the DW_AT_rnglists_base attribute in the CU DIE. It does this in both split and full CUs (though no DW_AT_rnglists_base in split units).
Is Format checked before this function is called? If not, this should probably also be an Optional as it can fail due to bad input. Otherwise I'd add a comment specifying this as a pre-condition.