aboutsummaryrefslogtreecommitdiffstats
path: root/source/Symbol
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-07-01 13:24:58 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-07-01 13:24:58 +0000
commit1b306c26ade71504511d2fa75b03dfaee77f9620 (patch)
tree2c4c77af2ba9632c24ebf216b9a39989d74f5725 /source/Symbol
parentfdea456ad833fbab0d3a296a58250950f11a498c (diff)
downloadsrc-1b306c26ade71504511d2fa75b03dfaee77f9620.tar.gz
src-1b306c26ade71504511d2fa75b03dfaee77f9620.zip
Vendor import of lldb trunk r306956:vendor/lldb/lldb-trunk-r306956
Notes
Notes: svn path=/vendor/lldb/dist/; revision=320543 svn path=/vendor/lldb/lldb-trunk-r306956/; revision=320544; tag=vendor/lldb/lldb-trunk-r306956
Diffstat (limited to 'source/Symbol')
-rw-r--r--source/Symbol/DWARFCallFrameInfo.cpp84
-rw-r--r--source/Symbol/FuncUnwinders.cpp133
-rw-r--r--source/Symbol/ObjectFile.cpp2
-rw-r--r--source/Symbol/Symtab.cpp4
-rw-r--r--source/Symbol/UnwindTable.cpp110
-rw-r--r--source/Symbol/Variable.cpp4
6 files changed, 218 insertions, 119 deletions
diff --git a/source/Symbol/DWARFCallFrameInfo.cpp b/source/Symbol/DWARFCallFrameInfo.cpp
index 015ecd856aa8..9b1f8c694ccf 100644
--- a/source/Symbol/DWARFCallFrameInfo.cpp
+++ b/source/Symbol/DWARFCallFrameInfo.cpp
@@ -14,7 +14,6 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/dwarf.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
@@ -23,6 +22,7 @@
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
@@ -151,17 +151,8 @@ GetGNUEHPointer(const DataExtractor &DE, offset_t *offset_ptr,
}
DWARFCallFrameInfo::DWARFCallFrameInfo(ObjectFile &objfile,
- SectionSP &section_sp,
- lldb::RegisterKind reg_kind,
- bool is_eh_frame)
- : m_objfile(objfile), m_section_sp(section_sp),
- m_reg_kind(reg_kind), // The flavor of registers that the CFI data uses
- // (enum RegisterKind)
- m_flags(), m_cie_map(), m_cfi_data(), m_cfi_data_initialized(false),
- m_fde_index(), m_fde_index_initialized(false),
- m_is_eh_frame(is_eh_frame) {}
-
-DWARFCallFrameInfo::~DWARFCallFrameInfo() {}
+ SectionSP &section_sp, Type type)
+ : m_objfile(objfile), m_section_sp(section_sp), m_type(type) {}
bool DWARFCallFrameInfo::GetUnwindPlan(Address addr, UnwindPlan &unwind_plan) {
FDEEntryMap::Entry fde_entry;
@@ -268,14 +259,20 @@ DWARFCallFrameInfo::ParseCIE(const dw_offset_t cie_offset) {
cie_id = m_cfi_data.GetU32(&offset);
end_offset = cie_offset + length + 4;
}
- if (length > 0 && ((!m_is_eh_frame && cie_id == UINT32_MAX) ||
- (m_is_eh_frame && cie_id == 0ul))) {
+ if (length > 0 && ((m_type == DWARF && cie_id == UINT32_MAX) ||
+ (m_type == EH && cie_id == 0ul))) {
size_t i;
// cie.offset = cie_offset;
// cie.length = length;
// cie.cieID = cieID;
cie_sp->ptr_encoding = DW_EH_PE_absptr; // default
cie_sp->version = m_cfi_data.GetU8(&offset);
+ if (cie_sp->version > CFI_VERSION4) {
+ Host::SystemLog(Host::eSystemLogError,
+ "CIE parse error: CFI version %d is not supported\n",
+ cie_sp->version);
+ return nullptr;
+ }
for (i = 0; i < CFI_AUG_MAX_SIZE; ++i) {
cie_sp->augmentation[i] = m_cfi_data.GetU8(&offset);
@@ -294,11 +291,23 @@ DWARFCallFrameInfo::ParseCIE(const dw_offset_t cie_offset) {
"CIE parse error: CIE augmentation string was too large "
"for the fixed sized buffer of %d bytes.\n",
CFI_AUG_MAX_SIZE);
- return cie_sp;
+ return nullptr;
}
+
+ // m_cfi_data uses address size from target architecture of the process
+ // may ignore these fields?
+ if (m_type == DWARF && cie_sp->version >= CFI_VERSION4) {
+ cie_sp->address_size = m_cfi_data.GetU8(&offset);
+ cie_sp->segment_size = m_cfi_data.GetU8(&offset);
+ }
+
cie_sp->code_align = (uint32_t)m_cfi_data.GetULEB128(&offset);
cie_sp->data_align = (int32_t)m_cfi_data.GetSLEB128(&offset);
- cie_sp->return_addr_reg_num = m_cfi_data.GetU8(&offset);
+
+ cie_sp->return_addr_reg_num =
+ m_type == DWARF && cie_sp->version >= CFI_VERSION3
+ ? static_cast<uint32_t>(m_cfi_data.GetULEB128(&offset))
+ : m_cfi_data.GetU8(&offset);
if (cie_sp->augmentation[0]) {
// Get the length of the eh_frame augmentation data
@@ -461,11 +470,33 @@ void DWARFCallFrameInfo::GetFDEIndex() {
m_fde_index_initialized = true;
return;
}
+
+ // An FDE entry contains CIE_pointer in debug_frame in same place as cie_id
+ // in eh_frame. CIE_pointer is an offset into the .debug_frame section.
+ // So, variable cie_offset should be equal to cie_id for debug_frame.
+ // FDE entries with cie_id == 0 shouldn't be ignored for it.
+ if ((cie_id == 0 && m_type == EH) || cie_id == UINT32_MAX || len == 0) {
+ auto cie_sp = ParseCIE(current_entry);
+ if (!cie_sp) {
+ // Cannot parse, the reason is already logged
+ m_fde_index.Clear();
+ m_fde_index_initialized = true;
+ return;
+ }
+
+ m_cie_map[current_entry] = std::move(cie_sp);
+ offset = next_entry;
+ continue;
+ }
+
+ if (m_type == DWARF)
+ cie_offset = cie_id;
+
if (cie_offset > m_cfi_data.GetByteSize()) {
- Host::SystemLog(
- Host::eSystemLogError,
- "error: Invalid cie offset of 0x%x found in cie/fde at 0x%x\n",
- cie_offset, current_entry);
+ Host::SystemLog(Host::eSystemLogError,
+ "error: Invalid cie offset of 0x%x "
+ "found in cie/fde at 0x%x\n",
+ cie_offset, current_entry);
// Don't trust anything in this eh_frame section if we find blatantly
// invalid data.
m_fde_index.Clear();
@@ -473,12 +504,6 @@ void DWARFCallFrameInfo::GetFDEIndex() {
return;
}
- if (cie_id == 0 || cie_id == UINT32_MAX || len == 0) {
- m_cie_map[current_entry] = ParseCIE(current_entry);
- offset = next_entry;
- continue;
- }
-
const CIE *cie = GetCIE(cie_offset);
if (cie) {
const lldb::addr_t pc_rel_addr = m_section_sp->GetFileAddress();
@@ -531,12 +556,13 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset,
cie_offset = m_cfi_data.GetU32(&offset);
}
- assert(cie_offset != 0 && cie_offset != UINT32_MAX);
+ // FDE entries with zeroth cie_offset may occur for debug_frame.
+ assert(!(m_type == EH && 0 == cie_offset) && cie_offset != UINT32_MAX);
// Translate the CIE_id from the eh_frame format, which
// is relative to the FDE offset, into a __eh_frame section
// offset
- if (m_is_eh_frame) {
+ if (m_type == EH) {
unwind_plan.SetSourceName("eh_frame CFI");
cie_offset = current_entry + (is_64bit ? 12 : 4) - cie_offset;
unwind_plan.SetUnwindPlanValidAtAllInstructions(eLazyBoolNo);
@@ -611,7 +637,7 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset,
*cie_initial_row = cie->initial_row;
UnwindPlan::RowSP row(cie_initial_row);
- unwind_plan.SetRegisterKind(m_reg_kind);
+ unwind_plan.SetRegisterKind(GetRegisterKind());
unwind_plan.SetReturnAddressRegister(cie->return_addr_reg_num);
std::vector<UnwindPlan::RowSP> stack;
diff --git a/source/Symbol/FuncUnwinders.cpp b/source/Symbol/FuncUnwinders.cpp
index 3b94e250dac7..b9f50cd1b12f 100644
--- a/source/Symbol/FuncUnwinders.cpp
+++ b/source/Symbol/FuncUnwinders.cpp
@@ -39,7 +39,9 @@ FuncUnwinders::FuncUnwinders(UnwindTable &unwind_table, AddressRange range)
m_unwind_plan_arch_default_sp(),
m_unwind_plan_arch_default_at_func_entry_sp(),
m_tried_unwind_plan_assembly(false), m_tried_unwind_plan_eh_frame(false),
+ m_tried_unwind_plan_debug_frame(false),
m_tried_unwind_plan_eh_frame_augmented(false),
+ m_tried_unwind_plan_debug_frame_augmented(false),
m_tried_unwind_plan_compact_unwind(false),
m_tried_unwind_plan_arm_unwind(false), m_tried_unwind_fast(false),
m_tried_unwind_arch_default(false),
@@ -56,17 +58,14 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanAtCallSite(Target &target,
int current_offset) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
- UnwindPlanSP unwind_plan_sp = GetEHFrameUnwindPlan(target, current_offset);
- if (unwind_plan_sp)
- return unwind_plan_sp;
-
- unwind_plan_sp = GetCompactUnwindUnwindPlan(target, current_offset);
- if (unwind_plan_sp)
- return unwind_plan_sp;
-
- unwind_plan_sp = GetArmUnwindUnwindPlan(target, current_offset);
- if (unwind_plan_sp)
- return unwind_plan_sp;
+ if (UnwindPlanSP plan_sp = GetEHFrameUnwindPlan(target, current_offset))
+ return plan_sp;
+ if (UnwindPlanSP plan_sp = GetDebugFrameUnwindPlan(target, current_offset))
+ return plan_sp;
+ if (UnwindPlanSP plan_sp = GetCompactUnwindUnwindPlan(target, current_offset))
+ return plan_sp;
+ if (UnwindPlanSP plan_sp = GetArmUnwindUnwindPlan(target, current_offset))
+ return plan_sp;
return nullptr;
}
@@ -121,6 +120,29 @@ UnwindPlanSP FuncUnwinders::GetEHFrameUnwindPlan(Target &target,
return m_unwind_plan_eh_frame_sp;
}
+UnwindPlanSP FuncUnwinders::GetDebugFrameUnwindPlan(Target &target,
+ int current_offset) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ if (m_unwind_plan_debug_frame_sp || m_tried_unwind_plan_debug_frame)
+ return m_unwind_plan_debug_frame_sp;
+
+ m_tried_unwind_plan_debug_frame = true;
+ if (m_range.GetBaseAddress().IsValid()) {
+ Address current_pc(m_range.GetBaseAddress());
+ if (current_offset != -1)
+ current_pc.SetOffset(current_pc.GetOffset() + current_offset);
+ DWARFCallFrameInfo *debug_frame = m_unwind_table.GetDebugFrameInfo();
+ if (debug_frame) {
+ m_unwind_plan_debug_frame_sp.reset(
+ new UnwindPlan(lldb::eRegisterKindGeneric));
+ if (!debug_frame->GetUnwindPlan(current_pc,
+ *m_unwind_plan_debug_frame_sp))
+ m_unwind_plan_debug_frame_sp.reset();
+ }
+ }
+ return m_unwind_plan_debug_frame_sp;
+}
+
UnwindPlanSP FuncUnwinders::GetArmUnwindUnwindPlan(Target &target,
int current_offset) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
@@ -187,6 +209,48 @@ UnwindPlanSP FuncUnwinders::GetEHFrameAugmentedUnwindPlan(Target &target,
return m_unwind_plan_eh_frame_augmented_sp;
}
+UnwindPlanSP
+FuncUnwinders::GetDebugFrameAugmentedUnwindPlan(Target &target, Thread &thread,
+ int current_offset) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
+ if (m_unwind_plan_debug_frame_augmented_sp.get() ||
+ m_tried_unwind_plan_debug_frame_augmented)
+ return m_unwind_plan_debug_frame_augmented_sp;
+
+ // Only supported on x86 architectures where we get debug_frame from the
+ // compiler that describes the prologue instructions perfectly, and sometimes
+ // the epilogue instructions too.
+ if (target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_32_i386 &&
+ target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_64_x86_64 &&
+ target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_64_x86_64h) {
+ m_tried_unwind_plan_debug_frame_augmented = true;
+ return m_unwind_plan_debug_frame_augmented_sp;
+ }
+
+ m_tried_unwind_plan_debug_frame_augmented = true;
+
+ UnwindPlanSP debug_frame_plan =
+ GetDebugFrameUnwindPlan(target, current_offset);
+ if (!debug_frame_plan)
+ return m_unwind_plan_debug_frame_augmented_sp;
+
+ m_unwind_plan_debug_frame_augmented_sp.reset(
+ new UnwindPlan(*debug_frame_plan));
+
+ // Augment the debug_frame instructions with epilogue descriptions if
+ // necessary so the UnwindPlan can be used at any instruction in the function.
+
+ UnwindAssemblySP assembly_profiler_sp(GetUnwindAssemblyProfiler(target));
+ if (assembly_profiler_sp) {
+ if (!assembly_profiler_sp->AugmentUnwindPlanFromCallSite(
+ m_range, thread, *m_unwind_plan_debug_frame_augmented_sp)) {
+ m_unwind_plan_debug_frame_augmented_sp.reset();
+ }
+ } else
+ m_unwind_plan_debug_frame_augmented_sp.reset();
+ return m_unwind_plan_debug_frame_augmented_sp;
+}
+
UnwindPlanSP FuncUnwinders::GetAssemblyUnwindPlan(Target &target,
Thread &thread,
int current_offset) {
@@ -248,6 +312,8 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanAtNonCallSite(Target &target,
Thread &thread,
int current_offset) {
UnwindPlanSP eh_frame_sp = GetEHFrameUnwindPlan(target, current_offset);
+ if (!eh_frame_sp)
+ eh_frame_sp = GetDebugFrameUnwindPlan(target, current_offset);
UnwindPlanSP arch_default_at_entry_sp =
GetUnwindPlanArchitectureDefaultAtFunctionEntry(thread);
UnwindPlanSP arch_default_sp = GetUnwindPlanArchitectureDefault(thread);
@@ -255,28 +321,22 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanAtNonCallSite(Target &target,
GetAssemblyUnwindPlan(target, thread, current_offset);
// This point of this code is to detect when a function is using a
- // non-standard ABI, and the eh_frame
- // correctly describes that alternate ABI. This is addressing a specific
- // situation on x86_64 linux
- // systems where one function in a library pushes a value on the stack and
- // jumps to another function.
- // So using an assembly instruction based unwind will not work when you're in
- // the second function -
- // the stack has been modified in a non-ABI way. But we have eh_frame that
- // correctly describes how to
- // unwind from this location. So we're looking to see if the initial pc
- // register save location from
- // the eh_frame is different from the assembly unwind, the arch default
- // unwind, and the arch default at
- // initial function entry.
+ // non-standard ABI, and the eh_frame correctly describes that alternate ABI.
+ // This is addressing a specific situation on x86_64 linux systems where one
+ // function in a library pushes a value on the stack and jumps to another
+ // function. So using an assembly instruction based unwind will not work when
+ // you're in the second function - the stack has been modified in a non-ABI
+ // way. But we have eh_frame that correctly describes how to unwind from this
+ // location. So we're looking to see if the initial pc register save location
+ // from the eh_frame is different from the assembly unwind, the arch default
+ // unwind, and the arch default at initial function entry.
//
// We may have eh_frame that describes the entire function -- or we may have
- // eh_frame that only describes
- // the unwind after the prologue has executed -- so we need to check both the
- // arch default (once the prologue
- // has executed) and the arch default at initial function entry. And we may
- // be running on a target where
- // we have only some of the assembly/arch default unwind plans available.
+ // eh_frame that only describes the unwind after the prologue has executed --
+ // so we need to check both the arch default (once the prologue has executed)
+ // and the arch default at initial function entry. And we may be running on a
+ // target where we have only some of the assembly/arch default unwind plans
+ // available.
if (CompareUnwindPlansForIdenticalInitialPCLocation(
thread, eh_frame_sp, arch_default_at_entry_sp) == eLazyBoolNo &&
@@ -287,11 +347,12 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanAtNonCallSite(Target &target,
return eh_frame_sp;
}
- UnwindPlanSP eh_frame_augmented_sp =
- GetEHFrameAugmentedUnwindPlan(target, thread, current_offset);
- if (eh_frame_augmented_sp) {
- return eh_frame_augmented_sp;
- }
+ if (UnwindPlanSP plan_sp =
+ GetEHFrameAugmentedUnwindPlan(target, thread, current_offset))
+ return plan_sp;
+ if (UnwindPlanSP plan_sp =
+ GetDebugFrameAugmentedUnwindPlan(target, thread, current_offset))
+ return plan_sp;
return assembly_sp;
}
diff --git a/source/Symbol/ObjectFile.cpp b/source/Symbol/ObjectFile.cpp
index c970de6fef06..fd4180862c15 100644
--- a/source/Symbol/ObjectFile.cpp
+++ b/source/Symbol/ObjectFile.cpp
@@ -13,7 +13,6 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Symbol/ObjectContainer.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Target/Process.h"
@@ -25,6 +24,7 @@
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/lldb-private.h"
using namespace lldb;
diff --git a/source/Symbol/Symtab.cpp b/source/Symbol/Symtab.cpp
index 3eec3e706185..3e2c965509d3 100644
--- a/source/Symbol/Symtab.cpp
+++ b/source/Symbol/Symtab.cpp
@@ -13,15 +13,15 @@
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
#include "Plugins/Language/ObjC/ObjCLanguage.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/Section.h"
#include "lldb/Core/STLUtils.h"
-#include "lldb/Core/Timer.h"
+#include "lldb/Core/Section.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Symtab.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Symbol/UnwindTable.cpp b/source/Symbol/UnwindTable.cpp
index 336f0c3e04a7..405d57754ea5 100644
--- a/source/Symbol/UnwindTable.cpp
+++ b/source/Symbol/UnwindTable.cpp
@@ -44,38 +44,64 @@ void UnwindTable::Initialize() {
if (m_initialized) // check again once we've acquired the lock
return;
+ m_initialized = true;
SectionList *sl = m_object_file.GetSectionList();
- if (sl) {
- SectionSP sect = sl->FindSectionByType(eSectionTypeEHFrame, true);
- if (sect.get()) {
- m_eh_frame_up.reset(new DWARFCallFrameInfo(m_object_file, sect,
- eRegisterKindEHFrame, true));
- }
- sect = sl->FindSectionByType(eSectionTypeCompactUnwind, true);
- if (sect.get()) {
- m_compact_unwind_up.reset(new CompactUnwindInfo(m_object_file, sect));
- }
- sect = sl->FindSectionByType(eSectionTypeARMexidx, true);
- if (sect.get()) {
- SectionSP sect_extab = sl->FindSectionByType(eSectionTypeARMextab, true);
- if (sect_extab.get()) {
- m_arm_unwind_up.reset(
- new ArmUnwindInfo(m_object_file, sect, sect_extab));
- }
- }
+ 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));
}
- m_initialized = true;
+ sect = sl->FindSectionByType(eSectionTypeDWARFDebugFrame, true);
+ if (sect) {
+ m_debug_frame_up.reset(
+ new DWARFCallFrameInfo(m_object_file, sect, DWARFCallFrameInfo::DWARF));
+ }
+
+ sect = sl->FindSectionByType(eSectionTypeCompactUnwind, true);
+ if (sect) {
+ m_compact_unwind_up.reset(new CompactUnwindInfo(m_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));
+ }
+ }
}
UnwindTable::~UnwindTable() {}
+llvm::Optional<AddressRange> UnwindTable::GetAddressRange(const Address &addr,
+ SymbolContext &sc) {
+ AddressRange range;
+
+ // First check the symbol context
+ if (sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, 0,
+ false, range) &&
+ range.GetBaseAddress().IsValid())
+ return range;
+
+ // Does the eh_frame unwind info has a function bounds for this addr?
+ if (m_eh_frame_up && m_eh_frame_up->GetAddressRange(addr, range))
+ return range;
+
+ // Try debug_frame as well
+ if (m_debug_frame_up && m_debug_frame_up->GetAddressRange(addr, range))
+ return range;
+
+ return llvm::None;
+}
+
FuncUnwindersSP
UnwindTable::GetFuncUnwindersContainingAddress(const Address &addr,
SymbolContext &sc) {
- FuncUnwindersSP no_unwind_found;
-
Initialize();
std::lock_guard<std::mutex> guard(m_mutex);
@@ -96,23 +122,14 @@ UnwindTable::GetFuncUnwindersContainingAddress(const Address &addr,
return pos->second;
}
- AddressRange range;
- if (!sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, 0,
- false, range) ||
- !range.GetBaseAddress().IsValid()) {
- // Does the eh_frame unwind info has a function bounds for this addr?
- if (m_eh_frame_up == nullptr ||
- !m_eh_frame_up->GetAddressRange(addr, range)) {
- return no_unwind_found;
- }
- }
+ auto range_or = GetAddressRange(addr, sc);
+ if (!range_or)
+ return nullptr;
- FuncUnwindersSP func_unwinder_sp(new FuncUnwinders(*this, range));
+ FuncUnwindersSP func_unwinder_sp(new FuncUnwinders(*this, *range_or));
m_unwinds.insert(insert_pos,
- std::make_pair(range.GetBaseAddress().GetFileAddress(),
+ std::make_pair(range_or->GetBaseAddress().GetFileAddress(),
func_unwinder_sp));
- // StreamFile s(stdout, false);
- // Dump (s);
return func_unwinder_sp;
}
@@ -121,26 +138,16 @@ UnwindTable::GetFuncUnwindersContainingAddress(const Address &addr,
// UnwindTable. This is intended for use by target modules show-unwind where we
// want to create
// new UnwindPlans, not re-use existing ones.
-
FuncUnwindersSP
UnwindTable::GetUncachedFuncUnwindersContainingAddress(const Address &addr,
SymbolContext &sc) {
- FuncUnwindersSP no_unwind_found;
Initialize();
- AddressRange range;
- if (!sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, 0,
- false, range) ||
- !range.GetBaseAddress().IsValid()) {
- // Does the eh_frame unwind info has a function bounds for this addr?
- if (m_eh_frame_up == nullptr ||
- !m_eh_frame_up->GetAddressRange(addr, range)) {
- return no_unwind_found;
- }
- }
+ auto range_or = GetAddressRange(addr, sc);
+ if (!range_or)
+ return nullptr;
- FuncUnwindersSP func_unwinder_sp(new FuncUnwinders(*this, range));
- return func_unwinder_sp;
+ return std::make_shared<FuncUnwinders>(*this, *range_or);
}
void UnwindTable::Dump(Stream &s) {
@@ -161,6 +168,11 @@ DWARFCallFrameInfo *UnwindTable::GetEHFrameInfo() {
return m_eh_frame_up.get();
}
+DWARFCallFrameInfo *UnwindTable::GetDebugFrameInfo() {
+ Initialize();
+ return m_debug_frame_up.get();
+}
+
CompactUnwindInfo *UnwindTable::GetCompactUnwindInfo() {
Initialize();
return m_compact_unwind_up.get();
diff --git a/source/Symbol/Variable.cpp b/source/Symbol/Variable.cpp
index fd19a0994966..ff32aa731465 100644
--- a/source/Symbol/Variable.cpp
+++ b/source/Symbol/Variable.cpp
@@ -160,7 +160,7 @@ void Variable::Dump(Stream *s, bool show_context) const {
if (m_owner_scope) {
ModuleSP module_sp(m_owner_scope->CalculateSymbolContextModule());
if (module_sp)
- abi = ABI::FindPlugin(module_sp->GetArchitecture()).get();
+ abi = ABI::FindPlugin(ProcessSP(), module_sp->GetArchitecture()).get();
}
m_location.GetDescription(s, lldb::eDescriptionLevelBrief,
loclist_base_addr, abi);
@@ -471,7 +471,7 @@ bool Variable::DumpLocationForAddress(Stream *s, const Address &address) {
if (m_owner_scope) {
ModuleSP module_sp(m_owner_scope->CalculateSymbolContextModule());
if (module_sp)
- abi = ABI::FindPlugin(module_sp->GetArchitecture()).get();
+ abi = ABI::FindPlugin(ProcessSP(), module_sp->GetArchitecture()).get();
}
const addr_t file_addr = address.GetFileAddress();