Don't cache the public stop reason, since it can change as plan completion gets processed.  That means GetStopReason needs to return a shared pointer, not a pointer to the thread's cached version.  Also allow the thread plans to get and set the thread private stop reason - that is usually more appropriate for the logic the thread plans need to do.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116892 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/ThreadPlanBase.cpp b/source/Target/ThreadPlanBase.cpp
index 81fe215..393a3dd 100644
--- a/source/Target/ThreadPlanBase.cpp
+++ b/source/Target/ThreadPlanBase.cpp
@@ -67,10 +67,10 @@
     m_stop_vote = eVoteYes;
     m_run_vote = eVoteYes;
 
-    StopInfo *stop_info = m_thread.GetStopInfo();
-    if (stop_info)
+    StopInfoSP stop_info_sp = GetPrivateStopReason();
+    if (stop_info_sp)
     {
-        StopReason reason = stop_info->GetStopReason();
+        StopReason reason = stop_info_sp->GetStopReason();
         switch (reason)
         {
         case eStopReasonInvalid:
@@ -80,7 +80,7 @@
             return false;
 
         case eStopReasonBreakpoint:
-            if (stop_info->ShouldStop(event_ptr))
+            if (stop_info_sp->ShouldStop(event_ptr))
             {
                 // If we are going to stop for a breakpoint, then unship the other plans
                 // at this point.  Don't force the discard, however, so Master plans can stay
@@ -92,7 +92,7 @@
             // don't report this stop or the subsequent running event.  
             // Otherwise we will post the stopped & running, but the stopped event will get marked
             // with "restarted" so the UI will know to wait and expect the consequent "running".
-            if (stop_info->ShouldNotify (event_ptr))
+            if (stop_info_sp->ShouldNotify (event_ptr))
             {
                 m_stop_vote = eVoteYes;
                 m_run_vote = eVoteYes;
@@ -115,7 +115,7 @@
             return true;
 
         case eStopReasonSignal:
-            if (stop_info->ShouldStop(event_ptr))
+            if (stop_info_sp->ShouldStop(event_ptr))
             {
                 m_thread.DiscardThreadPlans(false);
                 return true;
@@ -124,7 +124,7 @@
             {
                 // We're not going to stop, but while we are here, let's figure out
                 // whether to report this.
-                 if (stop_info->ShouldNotify(event_ptr))
+                 if (stop_info_sp->ShouldNotify(event_ptr))
                     m_stop_vote = eVoteYes;
                 else
                     m_stop_vote = eVoteNo;