[Lldb-commits] [PATCH 1/8] Have LinuxThread cache it's current StopInfo object.

Stephen Wilson wilsons at start.ca
Fri Jan 14 13:12:15 PST 2011


---
 source/Plugins/Process/Linux/LinuxThread.cpp |   47 ++++++++++++++++----------
 source/Plugins/Process/Linux/LinuxThread.h   |    4 ++
 2 files changed, 33 insertions(+), 18 deletions(-)

diff --git a/source/Plugins/Process/Linux/LinuxThread.cpp b/source/Plugins/Process/Linux/LinuxThread.cpp
index e189064..4ceb051 100644
--- a/source/Plugins/Process/Linux/LinuxThread.cpp
+++ b/source/Plugins/Process/Linux/LinuxThread.cpp
@@ -40,6 +40,7 @@ LinuxThread::GetMonitor()
 void
 LinuxThread::RefreshStateAfterStop()
 {
+    RefreshPrivateStopReason();
 }
 
 const char *
@@ -101,24 +102,9 @@ LinuxThread::CreateRegisterContextForFrame (lldb_private::StackFrame *frame)
 lldb::StopInfoSP
 LinuxThread::GetPrivateStopReason()
 {
-    lldb::StopInfoSP stop_info;
-
-    switch (m_note)
-    {
-    default:
-        break;
-
-    case eBreak:
-        stop_info = StopInfo::CreateStopReasonWithBreakpointSiteID(
-            *this, m_breakpoint->GetID());
-        break;
-
-    case eTrace:
-        stop_info = StopInfo::CreateStopReasonToTrace(*this);
-        break;
-    }
-
-    return stop_info;
+    if (!m_stop_info || !m_stop_info->IsValid())
+        RefreshPrivateStopReason();
+    return m_stop_info;
 }
 
 Unwind *
@@ -196,3 +182,28 @@ LinuxThread::ExitNotify()
 {
     m_note = eExit;
 }
+
+void
+LinuxThread::RefreshPrivateStopReason()
+{
+    switch (m_note) {
+
+    default:
+    case eNone:
+        m_stop_info.reset();
+        break;
+
+    case eBreak:
+        m_stop_info = StopInfo::CreateStopReasonWithBreakpointSiteID(
+            *this, m_breakpoint->GetID());
+        break;
+
+    case eTrace:
+        m_stop_info = StopInfo::CreateStopReasonToTrace(*this);
+        break;
+
+    case eExit:
+        m_stop_info = StopInfo::CreateStopReasonWithSignal(*this, SIGCHLD);
+        break;
+    }
+}
diff --git a/source/Plugins/Process/Linux/LinuxThread.h b/source/Plugins/Process/Linux/LinuxThread.h
index 4dcdbb3..ee69cf7 100644
--- a/source/Plugins/Process/Linux/LinuxThread.h
+++ b/source/Plugins/Process/Linux/LinuxThread.h
@@ -72,6 +72,7 @@ private:
     std::auto_ptr<lldb_private::StackFrame> m_frame_ap;
 
     lldb::BreakpointSiteSP m_breakpoint;
+    lldb::StopInfoSP m_stop_info;
 
     enum Notification {
         eNone,
@@ -87,6 +88,9 @@ private:
     lldb::StopInfoSP
     GetPrivateStopReason();
 
+    void
+    RefreshPrivateStopReason();
+
     lldb_private::Unwind *
     GetUnwinder();
 };
-- 
1.7.3.5




More information about the lldb-commits mailing list