aboutsummaryrefslogtreecommitdiffstats
path: root/source/Symbol/UnwindTable.cpp
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2014-11-25 21:00:58 +0000
committerEd Maste <emaste@FreeBSD.org>2014-11-25 21:00:58 +0000
commit0cac4ca3916ac24ab6139d03cbfd18db9e715bfe (patch)
treec94307da318be46e5aeea1a325c1e91749506e4f /source/Symbol/UnwindTable.cpp
parent03b99097822ca3ac69252d9afae716a584ed56c4 (diff)
downloadsrc-0cac4ca3916ac24ab6139d03cbfd18db9e715bfe.tar.gz
src-0cac4ca3916ac24ab6139d03cbfd18db9e715bfe.zip
Import LLDB as of upstream SVN r216948 (git 50f7fe44)vendor/lldb/lldb-r216948
This corresponds with the branchpoint for the 3.5 release. A number of files not required for the FreeBSD build have been removed. Sponsored by: DARPA, AFRL
Notes
Notes: svn path=/vendor/lldb/dist/; revision=275072 svn path=/vendor/lldb/lldb-r216948/; revision=275074; tag=vendor/lldb/lldb-r216948
Diffstat (limited to 'source/Symbol/UnwindTable.cpp')
-rw-r--r--source/Symbol/UnwindTable.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/source/Symbol/UnwindTable.cpp b/source/Symbol/UnwindTable.cpp
index 33eb4d6c092b..df9f5b932565 100644
--- a/source/Symbol/UnwindTable.cpp
+++ b/source/Symbol/UnwindTable.cpp
@@ -17,7 +17,6 @@
#include "lldb/Symbol/FuncUnwinders.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
-#include "lldb/Target/UnwindAssembly.h"
// There is one UnwindTable object per ObjectFile.
// It contains a list of Unwind objects -- one per function, populated lazily -- for the ObjectFile.
@@ -30,8 +29,8 @@ UnwindTable::UnwindTable (ObjectFile& objfile) :
m_object_file (objfile),
m_unwinds (),
m_initialized (false),
- m_assembly_profiler (NULL),
- m_eh_frame (NULL)
+ m_mutex (),
+ m_eh_frame (nullptr)
{
}
@@ -44,6 +43,11 @@ UnwindTable::Initialize ()
if (m_initialized)
return;
+ Mutex::Locker locker(m_mutex);
+
+ if (m_initialized) // check again once we've acquired the lock
+ return;
+
SectionList* sl = m_object_file.GetSectionList ();
if (sl)
{
@@ -54,12 +58,7 @@ UnwindTable::Initialize ()
}
}
- ArchSpec arch;
- if (m_object_file.GetArchitecture (arch))
- {
- m_assembly_profiler = UnwindAssembly::FindPlugin (arch);
- m_initialized = true;
- }
+ m_initialized = true;
}
UnwindTable::~UnwindTable ()
@@ -75,6 +74,8 @@ UnwindTable::GetFuncUnwindersContainingAddress (const Address& addr, SymbolConte
Initialize();
+ Mutex::Locker locker(m_mutex);
+
// There is an UnwindTable per object file, so we can safely use file handles
addr_t file_addr = addr.GetFileAddress();
iterator end = m_unwinds.end ();
@@ -94,13 +95,13 @@ UnwindTable::GetFuncUnwindersContainingAddress (const Address& addr, SymbolConte
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 == NULL || !m_eh_frame->GetAddressRange (addr, range))
+ if (m_eh_frame == nullptr || !m_eh_frame->GetAddressRange (addr, range))
{
return no_unwind_found;
}
}
- FuncUnwindersSP func_unwinder_sp(new FuncUnwinders(*this, m_assembly_profiler, range));
+ FuncUnwindersSP func_unwinder_sp(new FuncUnwinders(*this, range));
m_unwinds.insert (insert_pos, std::make_pair(range.GetBaseAddress().GetFileAddress(), func_unwinder_sp));
// StreamFile s(stdout, false);
// Dump (s);
@@ -121,13 +122,13 @@ UnwindTable::GetUncachedFuncUnwindersContainingAddress (const Address& addr, Sym
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 == NULL || !m_eh_frame->GetAddressRange (addr, range))
+ if (m_eh_frame == nullptr || !m_eh_frame->GetAddressRange (addr, range))
{
return no_unwind_found;
}
}
- FuncUnwindersSP func_unwinder_sp(new FuncUnwinders(*this, m_assembly_profiler, range));
+ FuncUnwindersSP func_unwinder_sp(new FuncUnwinders(*this, range));
return func_unwinder_sp;
}
@@ -135,6 +136,7 @@ UnwindTable::GetUncachedFuncUnwindersContainingAddress (const Address& addr, Sym
void
UnwindTable::Dump (Stream &s)
{
+ Mutex::Locker locker(m_mutex);
s.Printf("UnwindTable for '%s':\n", m_object_file.GetFileSpec().GetPath().c_str());
const_iterator begin = m_unwinds.begin();
const_iterator end = m_unwinds.end();
@@ -151,3 +153,9 @@ UnwindTable::GetEHFrameInfo ()
Initialize();
return m_eh_frame;
}
+
+bool
+UnwindTable::GetArchitecture (lldb_private::ArchSpec &arch)
+{
+ return m_object_file.GetArchitecture (arch);
+}