[Lldb-commits] [PATCH] D99653: [nfc] [lldb] 1/2: Fix DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)
Jan Kratochvil via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 31 05:01:49 PDT 2021
jankratochvil created this revision.
jankratochvil added reviewers: labath, grimar, clayborg.
jankratochvil added a project: LLDB.
Herald added a subscriber: JDevlieghere.
jankratochvil requested review of this revision.
Refactor code only for D98289 <https://reviews.llvm.org/D98289>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99653
Files:
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -235,15 +235,7 @@
/// Return a rangelist's offset based on an index. The index designates
/// an entry in the rangelist table's offset array and is supplied by
/// DW_FORM_rnglistx.
- llvm::Optional<uint64_t> GetRnglistOffset(uint32_t Index) const {
- if (!m_rnglist_table)
- return llvm::None;
- if (llvm::Optional<uint64_t> off = m_rnglist_table->getOffsetEntry(
- m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(),
- Index))
- return *off + m_ranges_base;
- return llvm::None;
- }
+ llvm::Optional<uint64_t> GetRnglistOffset(uint32_t Index) const;
llvm::Optional<uint64_t> GetLoclistOffset(uint32_t Index) {
if (!m_loclist_table_header)
@@ -291,6 +283,8 @@
return &m_die_array[0];
}
+ llvm::Optional<llvm::DWARFDebugRnglistTable> GetRnglist();
+
SymbolFileDWARF &m_dwarf;
std::shared_ptr<DWARFUnit> m_dwo;
DWARFUnitHeader m_header;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -495,6 +495,19 @@
ranges_base, toString(table_or_error.takeError()).c_str());
}
+llvm::Optional<llvm::DWARFDebugRnglistTable> DWARFUnit::GetRnglist() {
+ return m_rnglist_table;
+}
+
+llvm::Optional<uint64_t> DWARFUnit::GetRnglistOffset(uint32_t Index) const {
+ if (!GetRnglist())
+ return llvm::None;
+ if (llvm::Optional<uint64_t> off = GetRnglist()->getOffsetEntry(
+ m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(), Index))
+ return *off + m_ranges_base;
+ return llvm::None;
+}
+
void DWARFUnit::SetStrOffsetsBase(dw_offset_t str_offsets_base) {
m_str_offsets_base = str_offsets_base;
}
@@ -936,11 +949,11 @@
return ranges;
}
- if (!m_rnglist_table)
+ if (!GetRnglist())
return llvm::createStringError(errc::invalid_argument,
"missing or invalid range list table");
- auto range_list_or_error = m_rnglist_table->findList(
+ auto range_list_or_error = GetRnglist()->findList(
m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(), offset);
if (!range_list_or_error)
return range_list_or_error.takeError();
@@ -971,7 +984,7 @@
DWARFUnit::FindRnglistFromIndex(uint32_t index) {
if (llvm::Optional<uint64_t> offset = GetRnglistOffset(index))
return FindRnglistFromOffset(*offset);
- if (m_rnglist_table)
+ if (GetRnglist())
return llvm::createStringError(errc::invalid_argument,
"invalid range list table index %d", index);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99653.334411.patch
Type: text/x-patch
Size: 2912 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210331/7be346c2/attachment.bin>
More information about the lldb-commits
mailing list