summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
Diffstat (limited to 'lldb')
-rw-r--r--lldb/include/lldb/Core/Module.h17
-rw-r--r--lldb/include/lldb/Symbol/ObjectFile.h17
-rw-r--r--lldb/include/lldb/Symbol/UnwindTable.h6
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp3
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp4
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp19
-rw-r--r--lldb/source/Symbol/ObjectFile.cpp8
-rw-r--r--lldb/source/Symbol/UnwindTable.cpp28
8 files changed, 50 insertions, 52 deletions
diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 0f18504a028..f34c2376cda 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -693,6 +693,21 @@ public:
//------------------------------------------------------------------
virtual void SectionFileAddressesChanged();
+ //------------------------------------------------------------------
+ /// Returns a reference to the UnwindTable for this Module
+ ///
+ /// The UnwindTable contains FuncUnwinders objects for any function in this
+ /// Module. If a FuncUnwinders object hasn't been created yet (i.e. the
+ /// function has yet to be unwound in a stack walk), it will be created when
+ /// requested. Specifically, we do not create FuncUnwinders objects for
+ /// functions until they are needed.
+ ///
+ /// @return
+ /// Returns the unwind table for this module. If this object has no
+ /// associated object file, an empty UnwindTable is returned.
+ //------------------------------------------------------------------
+ UnwindTable &GetUnwindTable() { return m_unwind_table; }
+
llvm::VersionTuple GetVersion();
//------------------------------------------------------------------
@@ -1090,6 +1105,8 @@ protected:
lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file
///parser for this module as it may or may
///not be shared with the SymbolFile
+ UnwindTable m_unwind_table{*this}; ///< Table of FuncUnwinders objects created
+ /// for this Module's functions
lldb::SymbolVendorUP
m_symfile_up; ///< A pointer to the symbol vendor for this module.
std::vector<lldb::SymbolVendorUP>
diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h
index d31589b274d..10feae761f4 100644
--- a/lldb/include/lldb/Symbol/ObjectFile.h
+++ b/lldb/include/lldb/Symbol/ObjectFile.h
@@ -478,20 +478,6 @@ public:
virtual bool ParseHeader() = 0;
//------------------------------------------------------------------
- /// Returns a reference to the UnwindTable for this ObjectFile
- ///
- /// The UnwindTable contains FuncUnwinders objects for any function in this
- /// ObjectFile. If a FuncUnwinders object hasn't been created yet (i.e. the
- /// function has yet to be unwound in a stack walk), it will be created when
- /// requested. Specifically, we do not create FuncUnwinders objects for
- /// functions until they are needed.
- ///
- /// @return
- /// Returns the unwind table for this object file.
- //------------------------------------------------------------------
- virtual lldb_private::UnwindTable &GetUnwindTable() { return m_unwind_table; }
-
- //------------------------------------------------------------------
/// Returns if the function bounds for symbols in this symbol file are
/// likely accurate.
///
@@ -774,9 +760,6 @@ protected:
///determined).
DataExtractor
m_data; ///< The data for this object file so things can be parsed lazily.
- lldb_private::UnwindTable m_unwind_table; /// < Table of FuncUnwinders objects
- /// created for this ObjectFile's
- /// functions
lldb::ProcessWP m_process_wp;
const lldb::addr_t m_memory_addr;
std::unique_ptr<lldb_private::SectionList> m_sections_up;
diff --git a/lldb/include/lldb/Symbol/UnwindTable.h b/lldb/include/lldb/Symbol/UnwindTable.h
index 8ca4a4de9ec..c0a37ab4f19 100644
--- a/lldb/include/lldb/Symbol/UnwindTable.h
+++ b/lldb/include/lldb/Symbol/UnwindTable.h
@@ -22,7 +22,9 @@ namespace lldb_private {
class UnwindTable {
public:
- UnwindTable(ObjectFile &objfile);
+ /// Create an Unwind table using the data in the given module.
+ explicit UnwindTable(Module &module);
+
~UnwindTable();
lldb_private::DWARFCallFrameInfo *GetEHFrameInfo();
@@ -62,7 +64,7 @@ private:
typedef collection::iterator iterator;
typedef collection::const_iterator const_iterator;
- ObjectFile &m_object_file;
+ Module &m_module;
collection m_unwinds;
bool m_initialized; // delay some initialization until ObjectFile is set up
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index b2488b75889..67813a392fa 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -3533,8 +3533,7 @@ protected:
start_addr = abi->FixCodeAddress(start_addr);
FuncUnwindersSP func_unwinders_sp(
- sc.module_sp->GetObjectFile()
- ->GetUnwindTable()
+ sc.module_sp->GetUnwindTable()
.GetUncachedFuncUnwindersContainingAddress(start_addr, sc));
if (!func_unwinders_sp)
continue;
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index e6a39dbc54d..45033e87789 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2862,8 +2862,8 @@ Symtab *ObjectFileELF::GetSymtab() {
}
}
- DWARFCallFrameInfo *eh_frame = GetUnwindTable().GetEHFrameInfo();
- if (eh_frame) {
+ if (DWARFCallFrameInfo *eh_frame =
+ GetModule()->GetUnwindTable().GetEHFrameInfo()) {
if (m_symtab_up == nullptr)
m_symtab_up.reset(new Symtab(this));
ParseUnwindSymbols(m_symtab_up.get(), eh_frame);
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
index 10199f742f5..f328361e7bf 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -239,9 +239,8 @@ void RegisterContextLLDB::InitializeZerothFrame() {
if (m_sym_ctx_valid) {
func_unwinders_sp =
- pc_module_sp->GetObjectFile()
- ->GetUnwindTable()
- .GetFuncUnwindersContainingAddress(m_current_pc, m_sym_ctx);
+ pc_module_sp->GetUnwindTable().GetFuncUnwindersContainingAddress(
+ m_current_pc, m_sym_ctx);
}
if (func_unwinders_sp.get() != nullptr)
@@ -672,9 +671,8 @@ UnwindPlanSP RegisterContextLLDB::GetFastUnwindPlanForFrame() {
return unwind_plan_sp;
FuncUnwindersSP func_unwinders_sp(
- pc_module_sp->GetObjectFile()
- ->GetUnwindTable()
- .GetFuncUnwindersContainingAddress(m_current_pc, m_sym_ctx));
+ pc_module_sp->GetUnwindTable().GetFuncUnwindersContainingAddress(
+ m_current_pc, m_sym_ctx));
if (!func_unwinders_sp)
return unwind_plan_sp;
@@ -775,9 +773,8 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() {
FuncUnwindersSP func_unwinders_sp;
if (m_sym_ctx_valid) {
func_unwinders_sp =
- pc_module_sp->GetObjectFile()
- ->GetUnwindTable()
- .GetFuncUnwindersContainingAddress(m_current_pc, m_sym_ctx);
+ pc_module_sp->GetUnwindTable().GetFuncUnwindersContainingAddress(
+ m_current_pc, m_sym_ctx);
}
// No FuncUnwinders available for this pc (stripped function symbols, lldb
@@ -795,7 +792,7 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() {
// Even with -fomit-frame-pointer, we can try eh_frame to get back on
// track.
DWARFCallFrameInfo *eh_frame =
- pc_module_sp->GetObjectFile()->GetUnwindTable().GetEHFrameInfo();
+ pc_module_sp->GetUnwindTable().GetEHFrameInfo();
if (eh_frame) {
unwind_plan_sp = std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric);
if (eh_frame->GetUnwindPlan(m_current_pc, *unwind_plan_sp))
@@ -805,7 +802,7 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() {
}
ArmUnwindInfo *arm_exidx =
- pc_module_sp->GetObjectFile()->GetUnwindTable().GetArmUnwindInfo();
+ pc_module_sp->GetUnwindTable().GetArmUnwindInfo();
if (arm_exidx) {
unwind_plan_sp = std::make_shared<UnwindPlan>(lldb::eRegisterKindGeneric);
if (arm_exidx->GetUnwindPlan(exe_ctx.GetTargetRef(), m_current_pc,
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp
index 5c7c1b7c3ad..211b96f8337 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -263,8 +263,7 @@ ObjectFile::ObjectFile(const lldb::ModuleSP &module_sp,
: ModuleChild(module_sp),
m_file(), // This file could be different from the original module's file
m_type(eTypeInvalid), m_strata(eStrataInvalid),
- m_file_offset(file_offset), m_length(length), m_data(),
- m_unwind_table(*this), m_process_wp(),
+ m_file_offset(file_offset), m_length(length), m_data(), m_process_wp(),
m_memory_addr(LLDB_INVALID_ADDRESS), m_sections_up(), m_symtab_up(),
m_synthetic_symbol_idx(0) {
if (file_spec_ptr)
@@ -286,9 +285,8 @@ ObjectFile::ObjectFile(const lldb::ModuleSP &module_sp,
DataBufferSP &header_data_sp)
: ModuleChild(module_sp), m_file(), m_type(eTypeInvalid),
m_strata(eStrataInvalid), m_file_offset(0), m_length(0), m_data(),
- m_unwind_table(*this), m_process_wp(process_sp),
- m_memory_addr(header_addr), m_sections_up(), m_symtab_up(),
- m_synthetic_symbol_idx(0) {
+ m_process_wp(process_sp), m_memory_addr(header_addr), m_sections_up(),
+ m_symtab_up(), m_synthetic_symbol_idx(0) {
if (header_data_sp)
m_data.SetData(header_data_sp, 0, header_data_sp->GetByteSize());
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
diff --git a/lldb/source/Symbol/UnwindTable.cpp b/lldb/source/Symbol/UnwindTable.cpp
index cacbdb1735b..dde31fb2450 100644
--- a/lldb/source/Symbol/UnwindTable.cpp
+++ b/lldb/source/Symbol/UnwindTable.cpp
@@ -26,8 +26,8 @@
using namespace lldb;
using namespace lldb_private;
-UnwindTable::UnwindTable(ObjectFile &objfile)
- : m_object_file(objfile), m_unwinds(), m_initialized(false), m_mutex(),
+UnwindTable::UnwindTable(Module &module)
+ : m_module(module), m_unwinds(), m_initialized(false), m_mutex(),
m_eh_frame_up(), m_compact_unwind_up(), m_arm_unwind_up() {}
// We can't do some of this initialization when the ObjectFile is running its
@@ -42,33 +42,36 @@ void UnwindTable::Initialize() {
if (m_initialized) // check again once we've acquired the lock
return;
m_initialized = true;
+ ObjectFile *object_file = m_module.GetObjectFile();
+ if (!object_file)
+ return;
- SectionList *sl = m_object_file.GetSectionList();
+ SectionList *sl = object_file->GetSectionList();
if (!sl)
return;
SectionSP sect = sl->FindSectionByType(eSectionTypeEHFrame, true);
if (sect.get()) {
m_eh_frame_up.reset(
- new DWARFCallFrameInfo(m_object_file, sect, DWARFCallFrameInfo::EH));
+ new DWARFCallFrameInfo(*object_file, sect, DWARFCallFrameInfo::EH));
}
sect = sl->FindSectionByType(eSectionTypeDWARFDebugFrame, true);
if (sect) {
m_debug_frame_up.reset(
- new DWARFCallFrameInfo(m_object_file, sect, DWARFCallFrameInfo::DWARF));
+ new DWARFCallFrameInfo(*object_file, sect, DWARFCallFrameInfo::DWARF));
}
sect = sl->FindSectionByType(eSectionTypeCompactUnwind, true);
if (sect) {
- m_compact_unwind_up.reset(new CompactUnwindInfo(m_object_file, sect));
+ m_compact_unwind_up.reset(new CompactUnwindInfo(*object_file, sect));
}
sect = sl->FindSectionByType(eSectionTypeARMexidx, true);
if (sect) {
SectionSP sect_extab = sl->FindSectionByType(eSectionTypeARMextab, true);
if (sect_extab.get()) {
- m_arm_unwind_up.reset(new ArmUnwindInfo(m_object_file, sect, sect_extab));
+ m_arm_unwind_up.reset(new ArmUnwindInfo(*object_file, sect, sect_extab));
}
}
}
@@ -148,8 +151,7 @@ UnwindTable::GetUncachedFuncUnwindersContainingAddress(const Address &addr,
void UnwindTable::Dump(Stream &s) {
std::lock_guard<std::mutex> guard(m_mutex);
- s.Printf("UnwindTable for '%s':\n",
- m_object_file.GetFileSpec().GetPath().c_str());
+ s.Format("UnwindTable for '{0}':\n", m_module.GetFileSpec());
const_iterator begin = m_unwinds.begin();
const_iterator end = m_unwinds.end();
for (const_iterator pos = begin; pos != end; ++pos) {
@@ -179,10 +181,10 @@ ArmUnwindInfo *UnwindTable::GetArmUnwindInfo() {
return m_arm_unwind_up.get();
}
-ArchSpec UnwindTable::GetArchitecture() {
- return m_object_file.GetArchitecture();
-}
+ArchSpec UnwindTable::GetArchitecture() { return m_module.GetArchitecture(); }
bool UnwindTable::GetAllowAssemblyEmulationUnwindPlans() {
- return m_object_file.AllowAssemblyEmulationUnwindPlans();
+ if (ObjectFile *object_file = m_module.GetObjectFile())
+ return object_file->AllowAssemblyEmulationUnwindPlans();
+ return false;
}
OpenPOWER on IntegriCloud