[PATCH] D70952: [DWARFDebugRnglists] Add a callback-based version of the getAbsoluteRanges function
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 3 04:23:10 PST 2019
labath created this revision.
labath added reviewers: dblaikie, JDevlieghere, aprantl.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
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).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D70952
Files:
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRnglists.h
llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp
Index: llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp
@@ -114,12 +114,21 @@
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 @@
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;
Index: llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRnglists.h
===================================================================
--- llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRnglists.h
+++ llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRnglists.h
@@ -45,6 +45,12 @@
/// A class representing a single rangelist.
class DWARFDebugRnglist : public DWARFListType<RangeListEntry> {
public:
+ /// Build a DWARFAddressRangesVector from a rangelist.
+ DWARFAddressRangesVector
+ getAbsoluteRanges(Optional<object::SectionedAddress> BaseAddr,
+ function_ref<Optional<object::SectionedAddress>(uint32_t)>
+ LookupPooledAddress) const;
+
/// Build a DWARFAddressRangesVector from a rangelist.
DWARFAddressRangesVector
getAbsoluteRanges(llvm::Optional<object::SectionedAddress> BaseAddr,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70952.231867.patch
Type: text/x-patch
Size: 2275 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191203/e39b11f0/attachment.bin>
More information about the llvm-commits
mailing list