Changed the formerly pure virtual function:

namespace lldb_private {
    class Thread
    {
        virtual lldb::StopInfoSP
        GetPrivateStopReason() = 0;
    };
}

To not be virtual. The lldb_private::Thread now handles the correct caching and will call a new pure virtual function:

namespace lldb_private {
    class Thread
    {
        virtual bool
        CalculateStopInfo() = 0;
    }
}

This function must be overridden by thead lldb_private::Thread subclass and the only thing it needs to do is to set the Thread::StopInfo() with the current stop reason and return true, or return false if there is no stop reason. The  lldb_private::Thread class will take care of calling this function only when it is required. This allows lldb_private::Thread subclasses to be a bit simpler and not all need to duplicate the cache and invalidation settings.

Also renamed:

lldb::StopInfoSP
lldb_private::Thread::GetPrivateStopReason();

To:

lldb::StopInfoSP
lldb_private::Thread::GetPrivateStopInfo();

Also cleaned up a case where the ThreadPlanStepOverBreakpoint might not re-set its breakpoint if the thread disappears (which was happening due to a bug when using the OperatingSystem plug-ins with memory threads and real threads).

llvm-svn: 181501
diff --git a/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp b/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp
index 00a1980..ff4fee7 100644
--- a/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp
+++ b/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp
@@ -34,7 +34,8 @@
                             // first in the thread plan stack when stepping
                             // over a breakpoint
     m_breakpoint_addr (LLDB_INVALID_ADDRESS),
-    m_auto_continue(false)
+    m_auto_continue(false),
+    m_reenabled_breakpoint_site (false)
 
 {
     m_breakpoint_addr = m_thread.GetRegisterContext()->GetPC();
@@ -105,9 +106,7 @@
 bool
 ThreadPlanStepOverBreakpoint::WillStop ()
 {
-    BreakpointSiteSP bp_site_sp (m_thread.GetProcess()->GetBreakpointSiteList().FindByAddress (m_breakpoint_addr));
-    if (bp_site_sp)
-        m_thread.GetProcess()->EnableBreakpointSite (bp_site_sp.get());
+    ReenableBreakpointSite ();
     return true;
 }
 
@@ -128,15 +127,32 @@
         if (log)
             log->Printf("Completed step over breakpoint plan.");
         // Otherwise, re-enable the breakpoint we were stepping over, and we're done.
-        BreakpointSiteSP bp_site_sp (m_thread.GetProcess()->GetBreakpointSiteList().FindByAddress (m_breakpoint_addr));
-        if (bp_site_sp)
-            m_thread.GetProcess()->EnableBreakpointSite (bp_site_sp.get());
+        ReenableBreakpointSite ();
         ThreadPlan::MischiefManaged ();
         return true;
     }
 }
 
 void
+ThreadPlanStepOverBreakpoint::ReenableBreakpointSite ()
+{
+    if (!m_reenabled_breakpoint_site)
+    {
+        m_reenabled_breakpoint_site = true;
+        BreakpointSiteSP bp_site_sp (m_thread.GetProcess()->GetBreakpointSiteList().FindByAddress (m_breakpoint_addr));
+        if (bp_site_sp)
+        {
+            m_thread.GetProcess()->EnableBreakpointSite (bp_site_sp.get());
+        }
+    }
+}
+void
+ThreadPlanStepOverBreakpoint::ThreadDestroyed ()
+{
+    ReenableBreakpointSite ();
+}
+
+void
 ThreadPlanStepOverBreakpoint::SetAutoContinue (bool do_it)
 {
     m_auto_continue = do_it;