[Lldb-commits] [lldb] r142632 - in /lldb/trunk: include/lldb/Target/Unwind.h source/Plugins/Process/Utility/UnwindLLDB.cpp source/Plugins/Process/Utility/UnwindLLDB.h source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h
Jim Ingham
jingham at apple.com
Thu Oct 20 18:49:48 PDT 2011
Author: jingham
Date: Thu Oct 20 20:49:48 2011
New Revision: 142632
URL: http://llvm.org/viewvc/llvm-project?rev=142632&view=rev
Log:
Lock the Unwinder before accessing it.
Modified:
lldb/trunk/include/lldb/Target/Unwind.h
lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h
lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h
Modified: lldb/trunk/include/lldb/Target/Unwind.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Unwind.h?rev=142632&r1=142631&r2=142632&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Unwind.h (original)
+++ lldb/trunk/include/lldb/Target/Unwind.h Thu Oct 20 20:49:48 2011
@@ -15,6 +15,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
+#include "lldb/Host/Mutex.h"
namespace lldb_private {
@@ -25,7 +26,8 @@
// Classes that inherit from Unwind can see and modify these
//------------------------------------------------------------------
Unwind(Thread &thread) :
- m_thread (thread)
+ m_thread (thread),
+ m_unwind_mutex()
{
}
@@ -35,20 +37,37 @@
{
}
- virtual void
- Clear() = 0;
+ void
+ Clear()
+ {
+ Mutex::Locker locker(m_unwind_mutex);
+ DoClear();
+
+ }
- virtual uint32_t
- GetFrameCount() = 0;
+ uint32_t
+ GetFrameCount()
+ {
+ Mutex::Locker locker(m_unwind_mutex);
+ return DoGetFrameCount();
+ }
- virtual bool
+ bool
GetFrameInfoAtIndex (uint32_t frame_idx,
lldb::addr_t& cfa,
- lldb::addr_t& pc) = 0;
+ lldb::addr_t& pc)
+ {
+ Mutex::Locker locker(m_unwind_mutex);
+ return DoGetFrameInfoAtIndex (frame_idx, cfa, pc);
+ }
+
+ lldb::RegisterContextSP
+ CreateRegisterContextForFrame (StackFrame *frame)
+ {
+ Mutex::Locker locker(m_unwind_mutex);
+ return DoCreateRegisterContextForFrame (frame);
+ }
- virtual lldb::RegisterContextSP
- CreateRegisterContextForFrame (StackFrame *frame) = 0;
-
Thread &
GetThread()
{
@@ -59,7 +78,22 @@
//------------------------------------------------------------------
// Classes that inherit from Unwind can see and modify these
//------------------------------------------------------------------
+ virtual void
+ DoClear() = 0;
+
+ virtual uint32_t
+ DoGetFrameCount() = 0;
+
+ virtual bool
+ DoGetFrameInfoAtIndex (uint32_t frame_idx,
+ lldb::addr_t& cfa,
+ lldb::addr_t& pc) = 0;
+
+ virtual lldb::RegisterContextSP
+ DoCreateRegisterContextForFrame (StackFrame *frame) = 0;
+
Thread &m_thread;
+ Mutex m_unwind_mutex;
private:
DISALLOW_COPY_AND_ASSIGN (Unwind);
};
Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=142632&r1=142631&r2=142632&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Thu Oct 20 20:49:48 2011
@@ -30,7 +30,7 @@
}
uint32_t
-UnwindLLDB::GetFrameCount()
+UnwindLLDB::DoGetFrameCount()
{
if (m_frames.empty())
{
@@ -177,7 +177,7 @@
}
bool
-UnwindLLDB::GetFrameInfoAtIndex (uint32_t idx, addr_t& cfa, addr_t& pc)
+UnwindLLDB::DoGetFrameInfoAtIndex (uint32_t idx, addr_t& cfa, addr_t& pc)
{
if (m_frames.size() == 0)
{
@@ -200,7 +200,7 @@
}
lldb::RegisterContextSP
-UnwindLLDB::CreateRegisterContextForFrame (StackFrame *frame)
+UnwindLLDB::DoCreateRegisterContextForFrame (StackFrame *frame)
{
lldb::RegisterContextSP reg_ctx_sp;
uint32_t idx = frame->GetConcreteFrameIndex ();
Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h?rev=142632&r1=142631&r2=142632&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h Thu Oct 20 20:49:48 2011
@@ -30,22 +30,23 @@
virtual
~UnwindLLDB() { }
+protected:
void
- Clear()
+ DoClear()
{
m_frames.clear();
}
virtual uint32_t
- GetFrameCount();
+ DoGetFrameCount();
bool
- GetFrameInfoAtIndex (uint32_t frame_idx,
+ DoGetFrameInfoAtIndex (uint32_t frame_idx,
lldb::addr_t& cfa,
lldb::addr_t& start_pc);
lldb::RegisterContextSP
- CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
+ DoCreateRegisterContextForFrame (lldb_private::StackFrame *frame);
private:
struct Cursor
Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp?rev=142632&r1=142631&r2=142632&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp Thu Oct 20 20:49:48 2011
@@ -28,7 +28,7 @@
}
uint32_t
-UnwindMacOSXFrameBackchain::GetFrameCount()
+UnwindMacOSXFrameBackchain::DoGetFrameCount()
{
if (m_cursors.empty())
{
@@ -45,7 +45,7 @@
}
bool
-UnwindMacOSXFrameBackchain::GetFrameInfoAtIndex (uint32_t idx, addr_t& cfa, addr_t& pc)
+UnwindMacOSXFrameBackchain::DoGetFrameInfoAtIndex (uint32_t idx, addr_t& cfa, addr_t& pc)
{
const uint32_t frame_count = GetFrameCount();
if (idx < frame_count)
@@ -64,7 +64,7 @@
}
lldb::RegisterContextSP
-UnwindMacOSXFrameBackchain::CreateRegisterContextForFrame (StackFrame *frame)
+UnwindMacOSXFrameBackchain::DoCreateRegisterContextForFrame (StackFrame *frame)
{
lldb::RegisterContextSP reg_ctx_sp;
uint32_t concrete_idx = frame->GetConcreteFrameIndex ();
Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h?rev=142632&r1=142631&r2=142632&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h Thu Oct 20 20:49:48 2011
@@ -30,27 +30,24 @@
{
}
+protected:
virtual void
- Clear()
+ DoClear()
{
m_cursors.clear();
}
virtual uint32_t
- GetFrameCount();
+ DoGetFrameCount();
bool
- GetFrameInfoAtIndex (uint32_t frame_idx,
+ DoGetFrameInfoAtIndex (uint32_t frame_idx,
lldb::addr_t& cfa,
lldb::addr_t& pc);
lldb::RegisterContextSP
- CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
-
- lldb_private::Thread &
- GetThread();
+ DoCreateRegisterContextForFrame (lldb_private::StackFrame *frame);
-protected:
friend class RegisterContextMacOSXFrameBackchain;
struct Cursor
More information about the lldb-commits
mailing list