[PATCH] D45307: [DWARF v5][NFC] Refactor the implementation of DebugRnglists

Wolfgang Pieb via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 4 18:09:12 PDT 2018


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

The current implementation of DebugRnglists (essentially the handling of the DWARF v5 .debug_rnglists and .debug_rnglists.dwo sections) is geared towards dumping the section. To handle references from DIEs via the DW_AT_ranges attribute we need more flexibility, which is what this refactor is trying to do.

The following changes are in this patch:

1. Parsing of rnglist tables is separated into parsing of headers/offsets and parsing (extracting) of individual rangelists. The previously monolithic extract() routine is broken into 3 parts: a) extraction of an individual rnglist entry, b) extraction of a rnglist (made up of multiple entries) and c) extraction of the entire table.

The idea is that the table headers and offsets are parsed when we first encounter the DW_AT_rnglist_base attribute in the CU DIE (or when we parse the CU DIE in split units). As we see DW_AT_ranges attributes in DIEs, we parse the rnglists referenced by them and enter them into a map (with section offsets as keys), where they can be looked up. The code for this will follow. This is just prep.

2. We calculate the maximum encoding string length for dumping before we dump the table and not during parsing of the range lists. Only the dumper cares about this.

Not in this patch is an interface to extract a range list from a section offset and a way to convert a range list into a DWARFAddressRangesVector, which is what DWARFDie::getAddressRanges returns. These will be part of the next patch, which will implement the full functionality with tests.


https://reviews.llvm.org/D45307

Files:
  include/llvm/DebugInfo/DWARF/DWARFDebugRnglists.h
  lib/DebugInfo/DWARF/DWARFContext.cpp
  lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45307.141095.patch
Type: text/x-patch
Size: 15936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180405/30ce77a2/attachment.bin>


More information about the llvm-commits mailing list