[Lldb-commits] [PATCH 8/9] Make LinuxThread use the LLDB unwinder.

Stephen Wilson wilsons at start.ca
Tue Jan 18 14:39:14 PST 2011


diff --git a/source/Plugins/Process/Linux/LinuxThread.cpp b/source/Plugins/Process/Linux/LinuxThread.cpp
index b7b2df1..5c278d4 100644
--- a/source/Plugins/Process/Linux/LinuxThread.cpp
+++ b/source/Plugins/Process/Linux/LinuxThread.cpp
@@ -7,9 +7,9 @@
 //
 //===----------------------------------------------------------------------===//
 
+// C Includes
 #include <errno.h>
 
-// C Includes
 // C++ Includes
 // Other libraries and framework includes
 #include "lldb/Target/Process.h"
@@ -20,6 +20,7 @@
 #include "ProcessLinux.h"
 #include "ProcessMonitor.h"
 #include "RegisterContextLinux_x86_64.h"
+#include "UnwindLLDB.h"
 
 using namespace lldb_private;
 
@@ -91,17 +92,19 @@ LinuxThread::RestoreSaveFrameZero(const RegisterCheckpoint &checkpoint)
 }
 
 lldb::RegisterContextSP
-LinuxThread::CreateRegisterContextForFrame (lldb_private::StackFrame *frame)
+LinuxThread::CreateRegisterContextForFrame(lldb_private::StackFrame *frame)
 {
     lldb::RegisterContextSP reg_ctx_sp;
     uint32_t concrete_frame_idx = 0;
+
     if (frame)
         concrete_frame_idx = frame->GetConcreteFrameIndex();
         
     if (concrete_frame_idx == 0)
         reg_ctx_sp = GetRegisterContext();
     else
-        reg_ctx_sp.reset (new RegisterContextLinux_x86_64(*this, frame->GetConcreteFrameIndex()));
+        reg_ctx_sp = GetUnwinder()->CreateRegisterContextForFrame(frame);
+
     return reg_ctx_sp;
 }
 
@@ -118,6 +121,9 @@ LinuxThread::GetPrivateStopReason()
 Unwind *
 LinuxThread::GetUnwinder()
 {
+    if (m_unwinder_ap.get() == NULL)
+        m_unwinder_ap.reset(new UnwindLLDB(*this));
+
     return m_unwinder_ap.get();
 }
 
@@ -125,6 +131,11 @@ bool
 LinuxThread::WillResume(lldb::StateType resume_state)
 {
     SetResumeState(resume_state);
+
+    ClearStackFrames();
+    if (m_unwinder_ap.get())
+        m_unwinder_ap->Clear();
+
     return Thread::WillResume(resume_state);
 }
 
diff --git a/source/Plugins/Process/Linux/Makefile b/source/Plugins/Process/Linux/Makefile
index 0454e6d..d2260f5 100644
--- a/source/Plugins/Process/Linux/Makefile
+++ b/source/Plugins/Process/Linux/Makefile
@@ -11,4 +11,7 @@ LLDB_LEVEL := ../../../..
 LIBRARYNAME := lldbPluginProcessLinux
 BUILD_ARCHIVE = 1
 
+# Extend the include path so we may locate UnwindLLDB.h
+CPPFLAGS += -I $(LLDB_LEVEL)/source/Plugins/Utility
+
 include $(LLDB_LEVEL)/Makefile
-- 
1.7.3.5




More information about the lldb-commits mailing list