summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-11-26 10:40:30 +0100
committerPavel Labath <pavel@labath.sk>2019-12-04 10:35:57 +0100
commitd34927e7dbcf77a6c0d1ab4e39158bc1f90c18f2 (patch)
treeef5de98a1e970a1411c23c8126cf1d2a31da6136 /llvm/lib/DebugInfo
parentc3d05c1b5209122dbb18e2d7126c14359b6dfa90 (diff)
downloadbcm5719-llvm-d34927e7dbcf77a6c0d1ab4e39158bc1f90c18f2.tar.gz
bcm5719-llvm-d34927e7dbcf77a6c0d1ab4e39158bc1f90c18f2.zip
[DWARFDebugRnglists] Add a callback-based version of the getAbsoluteRanges function
Summary: The dump() function already accepts a callback. This makes getAbsoluteRanges do the same. The existing DWARFUnit overload is implemented on top of the new function. This enables usage of the debug_rnglists parser from within lldb (which has it's own dwarf parser). Reviewers: dblaikie, JDevlieghere, aprantl Subscribers: hiraditya, probinson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70952
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp
index f6785b89e86..9ae4c5b73eb 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp
@@ -114,12 +114,21 @@ Error RangeListEntry::extract(DWARFDataExtractor Data, uint64_t End,
DWARFAddressRangesVector DWARFDebugRnglist::getAbsoluteRanges(
llvm::Optional<object::SectionedAddress> BaseAddr, DWARFUnit &U) const {
+ return getAbsoluteRanges(BaseAddr, [&](uint32_t Index) {
+ return U.getAddrOffsetSectionItem(Index);
+ });
+}
+
+DWARFAddressRangesVector DWARFDebugRnglist::getAbsoluteRanges(
+ Optional<object::SectionedAddress> BaseAddr,
+ function_ref<Optional<object::SectionedAddress>(uint32_t)>
+ LookupPooledAddress) const {
DWARFAddressRangesVector Res;
for (const RangeListEntry &RLE : Entries) {
if (RLE.EntryKind == dwarf::DW_RLE_end_of_list)
break;
if (RLE.EntryKind == dwarf::DW_RLE_base_addressx) {
- BaseAddr = U.getAddrOffsetSectionItem(RLE.Value0);
+ BaseAddr = LookupPooledAddress(RLE.Value0);
if (!BaseAddr)
BaseAddr = {RLE.Value0, -1ULL};
continue;
@@ -152,7 +161,7 @@ DWARFAddressRangesVector DWARFDebugRnglist::getAbsoluteRanges(
E.HighPC = E.LowPC + RLE.Value1;
break;
case dwarf::DW_RLE_startx_length: {
- auto Start = U.getAddrOffsetSectionItem(RLE.Value0);
+ auto Start = LookupPooledAddress(RLE.Value0);
if (!Start)
Start = {0, -1ULL};
E.SectionIndex = Start->SectionIndex;
OpenPOWER on IntegriCloud