2010-09-10 15:49:16 +08:00
|
|
|
//===-- FuncUnwinders.cpp ----------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2011-04-26 02:36:36 +08:00
|
|
|
#include "lldb/Core/AddressRange.h"
|
|
|
|
#include "lldb/Core/Address.h"
|
2010-09-10 15:49:16 +08:00
|
|
|
#include "lldb/Symbol/FuncUnwinders.h"
|
2015-09-30 21:50:14 +08:00
|
|
|
#include "lldb/Symbol/ArmUnwindInfo.h"
|
2011-04-26 02:36:36 +08:00
|
|
|
#include "lldb/Symbol/DWARFCallFrameInfo.h"
|
2014-12-08 11:09:00 +08:00
|
|
|
#include "lldb/Symbol/CompactUnwindInfo.h"
|
2010-09-10 15:49:16 +08:00
|
|
|
#include "lldb/Symbol/ObjectFile.h"
|
|
|
|
#include "lldb/Symbol/UnwindPlan.h"
|
|
|
|
#include "lldb/Symbol/UnwindTable.h"
|
2011-05-12 02:39:18 +08:00
|
|
|
#include "lldb/Target/ABI.h"
|
2012-02-21 08:09:25 +08:00
|
|
|
#include "lldb/Target/ExecutionContext.h"
|
2011-05-12 02:39:18 +08:00
|
|
|
#include "lldb/Target/Process.h"
|
2010-09-10 15:49:16 +08:00
|
|
|
#include "lldb/Target/Thread.h"
|
|
|
|
#include "lldb/Target/Target.h"
|
2011-04-26 05:14:26 +08:00
|
|
|
#include "lldb/Target/UnwindAssembly.h"
|
2010-09-10 15:49:16 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2014-12-21 18:44:54 +08:00
|
|
|
//------------------------------------------------
|
|
|
|
/// constructor
|
|
|
|
//------------------------------------------------
|
2010-09-10 15:49:16 +08:00
|
|
|
|
2014-11-04 13:28:40 +08:00
|
|
|
FuncUnwinders::FuncUnwinders (UnwindTable& unwind_table, AddressRange range) :
|
|
|
|
m_unwind_table (unwind_table),
|
|
|
|
m_range (range),
|
2014-08-26 04:29:09 +08:00
|
|
|
m_mutex (Mutex::eMutexTypeRecursive),
|
2014-12-21 18:44:54 +08:00
|
|
|
m_unwind_plan_assembly_sp (),
|
|
|
|
m_unwind_plan_eh_frame_sp (),
|
|
|
|
m_unwind_plan_eh_frame_augmented_sp (),
|
|
|
|
m_unwind_plan_compact_unwind (),
|
2015-09-30 21:50:14 +08:00
|
|
|
m_unwind_plan_arm_unwind_sp (),
|
2011-02-15 08:19:15 +08:00
|
|
|
m_unwind_plan_fast_sp (),
|
|
|
|
m_unwind_plan_arch_default_sp (),
|
2014-12-21 18:44:54 +08:00
|
|
|
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_eh_frame_augmented (false),
|
|
|
|
m_tried_unwind_plan_compact_unwind (false),
|
2015-09-30 21:50:14 +08:00
|
|
|
m_tried_unwind_plan_arm_unwind (false),
|
2011-01-09 05:19:00 +08:00
|
|
|
m_tried_unwind_fast (false),
|
|
|
|
m_tried_unwind_arch_default (false),
|
2011-09-15 08:44:34 +08:00
|
|
|
m_tried_unwind_arch_default_at_func_entry (false),
|
2014-11-04 13:28:40 +08:00
|
|
|
m_first_non_prologue_insn ()
|
2011-01-08 08:05:12 +08:00
|
|
|
{
|
|
|
|
}
|
2010-09-10 15:49:16 +08:00
|
|
|
|
2014-12-21 18:44:54 +08:00
|
|
|
//------------------------------------------------
|
|
|
|
/// destructor
|
|
|
|
//------------------------------------------------
|
|
|
|
|
2014-11-04 13:28:40 +08:00
|
|
|
FuncUnwinders::~FuncUnwinders ()
|
2010-09-10 15:49:16 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-02-15 08:19:15 +08:00
|
|
|
UnwindPlanSP
|
2014-12-08 11:09:00 +08:00
|
|
|
FuncUnwinders::GetUnwindPlanAtCallSite (Target &target, int current_offset)
|
2010-09-10 15:49:16 +08:00
|
|
|
{
|
2011-01-09 05:19:00 +08:00
|
|
|
Mutex::Locker locker (m_mutex);
|
2014-12-21 18:44:54 +08:00
|
|
|
|
|
|
|
UnwindPlanSP unwind_plan_sp = GetEHFrameUnwindPlan (target, current_offset);
|
2015-09-30 21:50:14 +08:00
|
|
|
if (unwind_plan_sp)
|
|
|
|
return unwind_plan_sp;
|
|
|
|
|
|
|
|
unwind_plan_sp = GetCompactUnwindUnwindPlan (target, current_offset);
|
|
|
|
if (unwind_plan_sp)
|
|
|
|
return unwind_plan_sp;
|
2014-12-08 11:09:00 +08:00
|
|
|
|
2015-09-30 21:50:14 +08:00
|
|
|
unwind_plan_sp = GetArmUnwindUnwindPlan (target, current_offset);
|
|
|
|
if (unwind_plan_sp)
|
|
|
|
return unwind_plan_sp;
|
|
|
|
|
|
|
|
return nullptr;
|
2014-12-21 18:44:54 +08:00
|
|
|
}
|
2011-01-08 08:05:12 +08:00
|
|
|
|
2014-12-21 18:44:54 +08:00
|
|
|
UnwindPlanSP
|
|
|
|
FuncUnwinders::GetCompactUnwindUnwindPlan (Target &target, int current_offset)
|
|
|
|
{
|
|
|
|
if (m_unwind_plan_compact_unwind.size() > 0)
|
|
|
|
return m_unwind_plan_compact_unwind[0]; // FIXME support multiple compact unwind plans for one func
|
|
|
|
if (m_tried_unwind_plan_compact_unwind)
|
|
|
|
return UnwindPlanSP();
|
2011-01-08 08:05:12 +08:00
|
|
|
|
2014-12-21 18:44:54 +08:00
|
|
|
Mutex::Locker lock (m_mutex);
|
|
|
|
m_tried_unwind_plan_compact_unwind = true;
|
|
|
|
if (m_range.GetBaseAddress().IsValid())
|
|
|
|
{
|
|
|
|
Address current_pc (m_range.GetBaseAddress ());
|
|
|
|
if (current_offset != -1)
|
|
|
|
current_pc.SetOffset (current_pc.GetOffset() + current_offset);
|
|
|
|
CompactUnwindInfo *compact_unwind = m_unwind_table.GetCompactUnwindInfo();
|
|
|
|
if (compact_unwind)
|
|
|
|
{
|
|
|
|
UnwindPlanSP unwind_plan_sp (new UnwindPlan (lldb::eRegisterKindGeneric));
|
|
|
|
if (compact_unwind->GetUnwindPlan (target, current_pc, *unwind_plan_sp))
|
2014-12-08 11:09:00 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
m_unwind_plan_compact_unwind.push_back (unwind_plan_sp);
|
|
|
|
return m_unwind_plan_compact_unwind[0]; // FIXME support multiple compact unwind plans for one func
|
2014-12-08 11:09:00 +08:00
|
|
|
}
|
2010-09-10 15:49:16 +08:00
|
|
|
}
|
|
|
|
}
|
2014-12-21 18:44:54 +08:00
|
|
|
return UnwindPlanSP();
|
2010-09-10 15:49:16 +08:00
|
|
|
}
|
|
|
|
|
2011-02-15 08:19:15 +08:00
|
|
|
UnwindPlanSP
|
2014-12-21 18:44:54 +08:00
|
|
|
FuncUnwinders::GetEHFrameUnwindPlan (Target &target, int current_offset)
|
2010-09-10 15:49:16 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
if (m_unwind_plan_eh_frame_sp.get() || m_tried_unwind_plan_eh_frame)
|
|
|
|
return m_unwind_plan_eh_frame_sp;
|
|
|
|
|
|
|
|
Mutex::Locker lock (m_mutex);
|
|
|
|
m_tried_unwind_plan_eh_frame = true;
|
|
|
|
if (m_range.GetBaseAddress().IsValid())
|
2010-10-25 19:12:07 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
Address current_pc (m_range.GetBaseAddress ());
|
|
|
|
if (current_offset != -1)
|
|
|
|
current_pc.SetOffset (current_pc.GetOffset() + current_offset);
|
|
|
|
DWARFCallFrameInfo *eh_frame = m_unwind_table.GetEHFrameInfo();
|
|
|
|
if (eh_frame)
|
2013-09-24 10:42:54 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
m_unwind_plan_eh_frame_sp.reset (new UnwindPlan (lldb::eRegisterKindGeneric));
|
|
|
|
if (!eh_frame->GetUnwindPlan (current_pc, *m_unwind_plan_eh_frame_sp))
|
|
|
|
m_unwind_plan_eh_frame_sp.reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return m_unwind_plan_eh_frame_sp;
|
|
|
|
}
|
|
|
|
|
2015-09-30 21:50:14 +08:00
|
|
|
UnwindPlanSP
|
|
|
|
FuncUnwinders::GetArmUnwindUnwindPlan (Target &target, int current_offset)
|
|
|
|
{
|
|
|
|
if (m_unwind_plan_arm_unwind_sp.get() || m_tried_unwind_plan_arm_unwind)
|
|
|
|
return m_unwind_plan_arm_unwind_sp;
|
|
|
|
|
|
|
|
Mutex::Locker lock (m_mutex);
|
|
|
|
m_tried_unwind_plan_arm_unwind = true;
|
|
|
|
if (m_range.GetBaseAddress().IsValid())
|
|
|
|
{
|
|
|
|
Address current_pc (m_range.GetBaseAddress ());
|
|
|
|
if (current_offset != -1)
|
|
|
|
current_pc.SetOffset (current_pc.GetOffset() + current_offset);
|
|
|
|
ArmUnwindInfo *arm_unwind_info = m_unwind_table.GetArmUnwindInfo();
|
|
|
|
if (arm_unwind_info)
|
|
|
|
{
|
|
|
|
m_unwind_plan_arm_unwind_sp.reset (new UnwindPlan (lldb::eRegisterKindGeneric));
|
|
|
|
if (!arm_unwind_info->GetUnwindPlan (target, current_pc, *m_unwind_plan_arm_unwind_sp))
|
|
|
|
m_unwind_plan_arm_unwind_sp.reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return m_unwind_plan_arm_unwind_sp;
|
|
|
|
}
|
|
|
|
|
2014-12-21 18:44:54 +08:00
|
|
|
UnwindPlanSP
|
|
|
|
FuncUnwinders::GetEHFrameAugmentedUnwindPlan (Target &target, Thread &thread, int current_offset)
|
|
|
|
{
|
|
|
|
if (m_unwind_plan_eh_frame_augmented_sp.get() || m_tried_unwind_plan_eh_frame_augmented)
|
|
|
|
return m_unwind_plan_eh_frame_augmented_sp;
|
|
|
|
|
|
|
|
// Only supported on x86 architectures where we get eh_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_eh_frame_augmented = true;
|
|
|
|
return m_unwind_plan_eh_frame_augmented_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
Mutex::Locker lock (m_mutex);
|
|
|
|
m_tried_unwind_plan_eh_frame_augmented = true;
|
|
|
|
|
2015-05-06 23:54:48 +08:00
|
|
|
UnwindPlanSP eh_frame_plan = GetEHFrameUnwindPlan (target, current_offset);
|
|
|
|
if (!eh_frame_plan)
|
|
|
|
return m_unwind_plan_eh_frame_augmented_sp;
|
|
|
|
|
|
|
|
m_unwind_plan_eh_frame_augmented_sp.reset(new UnwindPlan(*eh_frame_plan));
|
|
|
|
|
|
|
|
// Augment the eh_frame instructions with epilogue descriptions if necessary so the
|
|
|
|
// UnwindPlan can be used at any instruction in the function.
|
|
|
|
|
2015-06-24 19:27:32 +08:00
|
|
|
UnwindAssemblySP assembly_profiler_sp (GetUnwindAssemblyProfiler(target));
|
2015-05-06 23:54:48 +08:00
|
|
|
if (assembly_profiler_sp)
|
2014-12-21 18:44:54 +08:00
|
|
|
{
|
2015-05-06 23:54:48 +08:00
|
|
|
if (!assembly_profiler_sp->AugmentUnwindPlanFromCallSite (m_range, thread, *m_unwind_plan_eh_frame_augmented_sp))
|
2014-12-21 18:44:54 +08:00
|
|
|
{
|
2015-05-06 23:54:48 +08:00
|
|
|
m_unwind_plan_eh_frame_augmented_sp.reset();
|
2014-12-21 18:44:54 +08:00
|
|
|
}
|
|
|
|
}
|
2015-05-06 23:54:48 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
m_unwind_plan_eh_frame_augmented_sp.reset();
|
|
|
|
}
|
2014-12-21 18:44:54 +08:00
|
|
|
return m_unwind_plan_eh_frame_augmented_sp;
|
|
|
|
}
|
2014-08-26 04:29:09 +08:00
|
|
|
|
2014-12-21 18:44:54 +08:00
|
|
|
|
|
|
|
UnwindPlanSP
|
|
|
|
FuncUnwinders::GetAssemblyUnwindPlan (Target &target, Thread &thread, int current_offset)
|
|
|
|
{
|
2016-05-04 11:09:40 +08:00
|
|
|
if (m_unwind_plan_assembly_sp.get()
|
|
|
|
|| m_tried_unwind_plan_assembly
|
|
|
|
|| m_unwind_table.GetAllowAssemblyEmulationUnwindPlans () == false)
|
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
return m_unwind_plan_assembly_sp;
|
2016-05-04 11:09:40 +08:00
|
|
|
}
|
2014-12-21 18:44:54 +08:00
|
|
|
|
|
|
|
Mutex::Locker lock (m_mutex);
|
|
|
|
m_tried_unwind_plan_assembly = true;
|
|
|
|
|
2015-06-24 19:27:32 +08:00
|
|
|
UnwindAssemblySP assembly_profiler_sp (GetUnwindAssemblyProfiler(target));
|
2014-12-21 18:44:54 +08:00
|
|
|
if (assembly_profiler_sp)
|
|
|
|
{
|
|
|
|
m_unwind_plan_assembly_sp.reset (new UnwindPlan (lldb::eRegisterKindGeneric));
|
|
|
|
if (!assembly_profiler_sp->GetNonCallSiteUnwindPlanFromAssembly (m_range, thread, *m_unwind_plan_assembly_sp))
|
|
|
|
{
|
|
|
|
m_unwind_plan_assembly_sp.reset();
|
2013-09-24 10:42:54 +08:00
|
|
|
}
|
2010-10-25 19:12:07 +08:00
|
|
|
}
|
2014-12-21 18:44:54 +08:00
|
|
|
return m_unwind_plan_assembly_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UnwindPlanSP
|
|
|
|
FuncUnwinders::GetUnwindPlanAtNonCallSite (Target& target, Thread& thread, int current_offset)
|
|
|
|
{
|
|
|
|
UnwindPlanSP non_call_site_unwindplan_sp = GetEHFrameAugmentedUnwindPlan (target, thread, current_offset);
|
|
|
|
if (non_call_site_unwindplan_sp.get() == nullptr)
|
|
|
|
{
|
|
|
|
non_call_site_unwindplan_sp = GetAssemblyUnwindPlan (target, thread, current_offset);
|
|
|
|
}
|
|
|
|
return non_call_site_unwindplan_sp;
|
2010-09-10 15:49:16 +08:00
|
|
|
}
|
|
|
|
|
2011-02-15 08:19:15 +08:00
|
|
|
UnwindPlanSP
|
2015-06-24 19:27:32 +08:00
|
|
|
FuncUnwinders::GetUnwindPlanFastUnwind (Target& target, Thread& thread)
|
2010-09-10 15:49:16 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
if (m_unwind_plan_fast_sp.get() || m_tried_unwind_fast)
|
|
|
|
return m_unwind_plan_fast_sp;
|
|
|
|
|
2011-01-09 05:19:00 +08:00
|
|
|
Mutex::Locker locker (m_mutex);
|
2014-12-21 18:44:54 +08:00
|
|
|
m_tried_unwind_fast = true;
|
|
|
|
|
2015-06-24 19:27:32 +08:00
|
|
|
UnwindAssemblySP assembly_profiler_sp (GetUnwindAssemblyProfiler(target));
|
2014-12-21 18:44:54 +08:00
|
|
|
if (assembly_profiler_sp)
|
2010-10-25 19:12:07 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
m_unwind_plan_fast_sp.reset (new UnwindPlan (lldb::eRegisterKindGeneric));
|
|
|
|
if (!assembly_profiler_sp->GetFastUnwindPlan (m_range, thread, *m_unwind_plan_fast_sp))
|
2013-09-24 10:42:54 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
m_unwind_plan_fast_sp.reset();
|
2013-09-24 10:42:54 +08:00
|
|
|
}
|
2010-10-25 19:12:07 +08:00
|
|
|
}
|
2011-02-15 08:19:15 +08:00
|
|
|
return m_unwind_plan_fast_sp;
|
2010-09-10 15:49:16 +08:00
|
|
|
}
|
|
|
|
|
2011-02-15 08:19:15 +08:00
|
|
|
UnwindPlanSP
|
2010-09-10 15:49:16 +08:00
|
|
|
FuncUnwinders::GetUnwindPlanArchitectureDefault (Thread& thread)
|
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
if (m_unwind_plan_arch_default_sp.get() || m_tried_unwind_arch_default)
|
|
|
|
return m_unwind_plan_arch_default_sp;
|
|
|
|
|
2011-01-09 05:19:00 +08:00
|
|
|
Mutex::Locker locker (m_mutex);
|
2014-12-21 18:44:54 +08:00
|
|
|
m_tried_unwind_arch_default = true;
|
|
|
|
|
|
|
|
Address current_pc;
|
|
|
|
ProcessSP process_sp (thread.CalculateProcess());
|
|
|
|
if (process_sp)
|
2010-09-10 15:49:16 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
ABI *abi = process_sp->GetABI().get();
|
|
|
|
if (abi)
|
2010-09-10 15:49:16 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
m_unwind_plan_arch_default_sp.reset (new UnwindPlan (lldb::eRegisterKindGeneric));
|
|
|
|
if (!abi->CreateDefaultUnwindPlan(*m_unwind_plan_arch_default_sp))
|
2011-05-12 02:39:18 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
m_unwind_plan_arch_default_sp.reset();
|
2011-05-12 02:39:18 +08:00
|
|
|
}
|
2010-09-10 15:49:16 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-15 08:19:15 +08:00
|
|
|
return m_unwind_plan_arch_default_sp;
|
2010-09-10 15:49:16 +08:00
|
|
|
}
|
|
|
|
|
2011-09-15 08:44:34 +08:00
|
|
|
UnwindPlanSP
|
|
|
|
FuncUnwinders::GetUnwindPlanArchitectureDefaultAtFunctionEntry (Thread& thread)
|
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
if (m_unwind_plan_arch_default_at_func_entry_sp.get() || m_tried_unwind_arch_default_at_func_entry)
|
|
|
|
return m_unwind_plan_arch_default_at_func_entry_sp;
|
|
|
|
|
2011-09-15 08:44:34 +08:00
|
|
|
Mutex::Locker locker (m_mutex);
|
2014-12-21 18:44:54 +08:00
|
|
|
m_tried_unwind_arch_default_at_func_entry = true;
|
|
|
|
|
|
|
|
Address current_pc;
|
|
|
|
ProcessSP process_sp (thread.CalculateProcess());
|
|
|
|
if (process_sp)
|
2011-09-15 08:44:34 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
ABI *abi = process_sp->GetABI().get();
|
|
|
|
if (abi)
|
2011-09-15 08:44:34 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
m_unwind_plan_arch_default_at_func_entry_sp.reset (new UnwindPlan (lldb::eRegisterKindGeneric));
|
|
|
|
if (!abi->CreateFunctionEntryUnwindPlan(*m_unwind_plan_arch_default_at_func_entry_sp))
|
2011-09-15 08:44:34 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
m_unwind_plan_arch_default_at_func_entry_sp.reset();
|
2011-09-15 08:44:34 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-24 10:42:54 +08:00
|
|
|
return m_unwind_plan_arch_default_at_func_entry_sp;
|
2011-09-15 08:44:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-10 15:49:16 +08:00
|
|
|
Address&
|
|
|
|
FuncUnwinders::GetFirstNonPrologueInsn (Target& target)
|
|
|
|
{
|
|
|
|
if (m_first_non_prologue_insn.IsValid())
|
|
|
|
return m_first_non_prologue_insn;
|
2014-12-21 18:44:54 +08:00
|
|
|
|
|
|
|
Mutex::Locker locker (m_mutex);
|
2012-02-21 08:09:25 +08:00
|
|
|
ExecutionContext exe_ctx (target.shared_from_this(), false);
|
2015-06-24 19:27:32 +08:00
|
|
|
UnwindAssemblySP assembly_profiler_sp (GetUnwindAssemblyProfiler(target));
|
2014-05-23 09:48:10 +08:00
|
|
|
if (assembly_profiler_sp)
|
|
|
|
assembly_profiler_sp->FirstNonPrologueInsn (m_range, exe_ctx, m_first_non_prologue_insn);
|
2010-09-10 15:49:16 +08:00
|
|
|
return m_first_non_prologue_insn;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Address&
|
|
|
|
FuncUnwinders::GetFunctionStartAddress () const
|
|
|
|
{
|
|
|
|
return m_range.GetBaseAddress();
|
|
|
|
}
|
|
|
|
|
2014-05-23 09:48:10 +08:00
|
|
|
lldb::UnwindAssemblySP
|
2015-06-24 19:27:32 +08:00
|
|
|
FuncUnwinders::GetUnwindAssemblyProfiler (Target& target)
|
2014-05-23 09:48:10 +08:00
|
|
|
{
|
|
|
|
UnwindAssemblySP assembly_profiler_sp;
|
|
|
|
ArchSpec arch;
|
|
|
|
if (m_unwind_table.GetArchitecture (arch))
|
|
|
|
{
|
2015-06-24 19:27:32 +08:00
|
|
|
arch.MergeFrom (target.GetArchitecture ());
|
2014-05-23 09:48:10 +08:00
|
|
|
assembly_profiler_sp = UnwindAssembly::FindPlugin (arch);
|
|
|
|
}
|
|
|
|
return assembly_profiler_sp;
|
|
|
|
}
|
2014-11-18 10:27:42 +08:00
|
|
|
|
|
|
|
Address
|
2014-12-08 11:09:00 +08:00
|
|
|
FuncUnwinders::GetLSDAAddress (Target &target)
|
2014-11-18 10:27:42 +08:00
|
|
|
{
|
|
|
|
Address lsda_addr;
|
2014-11-18 13:57:42 +08:00
|
|
|
|
2014-12-21 18:44:54 +08:00
|
|
|
UnwindPlanSP unwind_plan_sp = GetEHFrameUnwindPlan (target, -1);
|
|
|
|
if (unwind_plan_sp.get() == nullptr)
|
2014-11-18 10:27:42 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
unwind_plan_sp = GetCompactUnwindUnwindPlan (target, -1);
|
|
|
|
}
|
|
|
|
if (unwind_plan_sp.get() && unwind_plan_sp->GetLSDAAddress().IsValid())
|
|
|
|
{
|
|
|
|
lsda_addr = unwind_plan_sp->GetLSDAAddress();
|
2014-11-18 10:27:42 +08:00
|
|
|
}
|
|
|
|
return lsda_addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Address
|
2014-12-08 11:09:00 +08:00
|
|
|
FuncUnwinders::GetPersonalityRoutinePtrAddress (Target &target)
|
2014-11-18 10:27:42 +08:00
|
|
|
{
|
|
|
|
Address personality_addr;
|
2014-11-18 13:57:42 +08:00
|
|
|
|
2014-12-21 18:44:54 +08:00
|
|
|
UnwindPlanSP unwind_plan_sp = GetEHFrameUnwindPlan (target, -1);
|
|
|
|
if (unwind_plan_sp.get() == nullptr)
|
|
|
|
{
|
|
|
|
unwind_plan_sp = GetCompactUnwindUnwindPlan (target, -1);
|
|
|
|
}
|
|
|
|
if (unwind_plan_sp.get() && unwind_plan_sp->GetPersonalityFunctionPtr().IsValid())
|
2014-11-18 10:27:42 +08:00
|
|
|
{
|
2014-12-21 18:44:54 +08:00
|
|
|
personality_addr = unwind_plan_sp->GetPersonalityFunctionPtr();
|
2014-11-18 10:27:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return personality_addr;
|
|
|
|
}
|