[PATCH] D45549: [DWARF v5] improved support for .debug_rnglists/consumer

Wolfgang Pieb via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 11 17:57:58 PDT 2018


wolfgangp created this revision.
wolfgangp added reviewers: dblaikie, JDevlieghere, aprantl, jhenderson, probinson.
Herald added a subscriber: rengolin.

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:

1. Adds a method to the DebugRnglist class to return a DWARFAddressRangesVector based on it.
2. 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).
  1. Adds a range list table to the DWARFUnit class which holds the DebugRnglistTable that belongs to the unit.
  2. 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.

5. Slightly refactor the dumping code in DWARFContext in the face of dumping both .debug_rnglists and .debug_rnglists.dwo.

6. Using getRelocatedAddress() instead of getAddress() when extracting range lists.

7. 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.

8. Change DWARFDie::getAddressRanges() to use the interface now provided by DWARFUnit to obtain a DWARFAddressRangesVector via DW_AT_ranges.

9. Some additions to DWARFFormValue to deal with DW_Form_rnglistx.

10. 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).




https://reviews.llvm.org/D45549

Files:
  include/llvm/DebugInfo/DWARF/DWARFDebugRnglists.h
  include/llvm/DebugInfo/DWARF/DWARFObject.h
  include/llvm/DebugInfo/DWARF/DWARFUnit.h
  lib/DebugInfo/DWARF/DWARFContext.cpp
  lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp
  lib/DebugInfo/DWARF/DWARFDie.cpp
  lib/DebugInfo/DWARF/DWARFFormValue.cpp
  lib/DebugInfo/DWARF/DWARFUnit.cpp
  test/DebugInfo/X86/dwarfdump-rnglists.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45549.142094.patch
Type: text/x-patch
Size: 28991 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180412/c406cef0/attachment-0001.bin>


More information about the llvm-commits mailing list