[Lldb-commits] [lldb] 0e5248b - [nfc] [lldb] Move LookupAddress to DWARFCompileUnit
Jan Kratochvil via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 19 03:44:45 PDT 2020
Author: Jan Kratochvil
Date: 2020-10-19T12:44:33+02:00
New Revision: 0e5248be8675db09b48680b9208b70f0e0908895
URL: https://github.com/llvm/llvm-project/commit/0e5248be8675db09b48680b9208b70f0e0908895
DIFF: https://github.com/llvm/llvm-project/commit/0e5248be8675db09b48680b9208b70f0e0908895.diff
LOG: [nfc] [lldb] Move LookupAddress to DWARFCompileUnit
LookupAddress makes no sense for DWARFTypeUnit.
Also make GetNonSkeletonUnit to preserve the called type.
Differential Revision: https://reviews.llvm.org/D89646
Added:
Modified:
lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
index f54fe0662aa2..9ca160b474fc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -99,3 +99,18 @@ void DWARFCompileUnit::BuildAddressRangeTable(
}
}
}
+
+DWARFCompileUnit &DWARFCompileUnit::GetNonSkeletonUnit() {
+ return llvm::cast<DWARFCompileUnit>(DWARFUnit::GetNonSkeletonUnit());
+}
+
+DWARFDIE DWARFCompileUnit::LookupAddress(const dw_addr_t address) {
+ if (DIE()) {
+ const DWARFDebugAranges &func_aranges = GetFunctionAranges();
+
+ // Re-check the aranges auto pointer contents in case it was created above
+ if (!func_aranges.IsEmpty())
+ return GetDIE(func_aranges.FindAddress(address));
+ }
+ return DWARFDIE();
+}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
index 3ec161f7dd51..ab3017ba0ffc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
@@ -20,6 +20,10 @@ class DWARFCompileUnit : public DWARFUnit {
static bool classof(const DWARFUnit *unit) { return !unit->IsTypeUnit(); }
+ DWARFCompileUnit &GetNonSkeletonUnit();
+
+ DWARFDIE LookupAddress(const dw_addr_t address);
+
private:
DWARFCompileUnit(SymbolFileDWARF &dwarf, lldb::user_id_t uid,
const DWARFUnitHeader &header,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index b70beb501946..5da23e7c89f1 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -392,17 +392,6 @@ void DWARFUnit::AddUnitDIE(const DWARFDebugInfoEntry &cu_die) {
m_dwo = std::shared_ptr<DWARFUnit>(std::move(dwo_symbol_file), dwo_cu);
}
-DWARFDIE DWARFUnit::LookupAddress(const dw_addr_t address) {
- if (DIE()) {
- const DWARFDebugAranges &func_aranges = GetFunctionAranges();
-
- // Re-check the aranges auto pointer contents in case it was created above
- if (!func_aranges.IsEmpty())
- return GetDIE(func_aranges.FindAddress(address));
- }
- return DWARFDIE();
-}
-
size_t DWARFUnit::GetDebugInfoSize() const {
return GetLengthByteSize() + GetLength() - GetHeaderByteSize();
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index 1d8236c4ed42..abe16182ef62 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -105,7 +105,6 @@ class DWARFUnit : public lldb_private::UserID {
};
ScopedExtractDIEs ExtractDIEsScoped();
- DWARFDIE LookupAddress(const dw_addr_t address);
bool Verify(lldb_private::Stream *s) const;
virtual void Dump(lldb_private::Stream *s) const = 0;
/// Get the data that contains the DIE information for this unit.
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 9454ec51954c..be9832a14dfa 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1811,7 +1811,8 @@ void SymbolFileDWARF::ResolveFunctionAndBlock(lldb::addr_t file_vm_addr,
bool lookup_block,
SymbolContext &sc) {
assert(sc.comp_unit);
- DWARFUnit &cu = GetDWARFCompileUnit(sc.comp_unit)->GetNonSkeletonUnit();
+ DWARFCompileUnit &cu =
+ GetDWARFCompileUnit(sc.comp_unit)->GetNonSkeletonUnit();
DWARFDIE function_die = cu.LookupAddress(file_vm_addr);
DWARFDIE block_die;
if (function_die) {
More information about the lldb-commits
mailing list