Reworked the way Process::RunThreadPlan and the ThreadPlanCallFunction interoperate to fix problems where
hitting auto-continue signals while running a thread plan would cause us to lose control of the debug 
session.

<rdar://problem/12993641>

llvm-svn: 174793
diff --git a/lldb/source/Target/StopInfo.cpp b/lldb/source/Target/StopInfo.cpp
index 1a7779d..e0a0046 100644
--- a/lldb/source/Target/StopInfo.cpp
+++ b/lldb/source/Target/StopInfo.cpp
@@ -38,7 +38,9 @@
     m_thread (thread),
     m_stop_id (thread.GetProcess()->GetStopID()),
     m_resume_id (thread.GetProcess()->GetResumeID()),
-    m_value (value)
+    m_value (value),
+    m_override_set(false),
+    m_override_value(true)
 {
 }
 
@@ -773,6 +775,12 @@
     }
 
     virtual bool
+    ShouldStopSynchronous (Event *event_ptr)
+    {
+        return m_thread.GetProcess()->GetUnixSignals().GetShouldStop (m_value);
+    }
+
+    virtual bool
     ShouldStop (Event *event_ptr)
     {
         return m_thread.GetProcess()->GetUnixSignals().GetShouldStop (m_value);
@@ -783,7 +791,16 @@
     virtual bool
     ShouldNotify (Event *event_ptr)
     {
-        return m_thread.GetProcess()->GetUnixSignals().GetShouldNotify (m_value);
+        bool should_notify = m_thread.GetProcess()->GetUnixSignals().GetShouldNotify (m_value);
+        if (should_notify)
+        {
+            StreamString strm;
+            strm.Printf ("thread %d received signal: %s",
+                         m_thread.GetIndexID(),
+                         m_thread.GetProcess()->GetUnixSignals().GetSignalAsCString (m_value));
+            Process::ProcessEventData::AddRestartedReason(event_ptr, strm.GetData());
+        }
+        return should_notify;
     }
 
     
@@ -924,6 +941,16 @@
     {
         return m_return_valobj_sp;
     }
+    
+protected:
+    virtual bool
+    ShouldStop (Event *event_ptr)
+    {
+        if (m_plan_sp)
+            return m_plan_sp->ShouldStop(event_ptr);
+        else
+            return StopInfo::ShouldStop(event_ptr);
+    }
 
 private:
     ThreadPlanSP m_plan_sp;
@@ -957,7 +984,6 @@
         return "exec";
     }
 protected:
-protected:
     
     virtual void
     PerformAction (Event *event_ptr)