[Lldb-commits] [lldb] r181795 - Fix inline stepping test case on Linux because Thread::ThreadStoppedForAReason ignored virtual steps.

Daniel Malea daniel.malea at intel.com
Tue May 14 08:20:12 PDT 2013


Author: dmalea
Date: Tue May 14 10:20:12 2013
New Revision: 181795

URL: http://llvm.org/viewvc/llvm-project?rev=181795&view=rev
Log:
Fix inline stepping test case on Linux because Thread::ThreadStoppedForAReason ignored virtual steps.
- add IsVirtualStep() virtual function to ThreadPlan, and implement it for
  ThreadPlanStepInRange
- make GetPrivateStopReason query the current thread plan for a virtual stop to
  decide if the current stop reason needs to be preserved
- remove extra check for an existing process in GetPrivateStopReason


Modified:
    lldb/trunk/include/lldb/Target/Thread.h
    lldb/trunk/include/lldb/Target/ThreadPlan.h
    lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Target/ThreadPlanStepInRange.cpp

Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=181795&r1=181794&r2=181795&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Tue May 14 10:20:12 2013
@@ -895,9 +895,19 @@ public:
         return !m_destroy_called;
     }
 
-    // When you implement this method, make sure you don't overwrite the m_actual_stop_info if it claims to be
-    // valid.  The stop info may be a "checkpointed and restored" stop info, so if it is still around it is right
-    // even if you have not calculated this yourself, or if it disagrees with what you might have calculated.
+    // Sets and returns a valid stop info based on the process stop ID and the
+    // current thread plan. If the thread stop ID does not match the process'
+    // stop ID, the private stop reason is not set and an invalid StopInfoSP may
+    // be returned.
+    //
+    // NOTE: This function must be called before the current thread plan is
+    // moved to the completed plan stack (in Thread::ShouldStop()).
+    //
+    // NOTE: If subclasses override this function, ensure they do not overwrite
+    // the m_actual_stop_info if it is valid.  The stop info may be a
+    // "checkpointed and restored" stop info, so if it is still around it is
+    // right even if you have not calculated this yourself, or if it disagrees
+    // with what you might have calculated.
     virtual lldb::StopInfoSP
     GetPrivateStopInfo ();
 

Modified: lldb/trunk/include/lldb/Target/ThreadPlan.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlan.h?rev=181795&r1=181794&r2=181795&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadPlan.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlan.h Tue May 14 10:20:12 2013
@@ -516,6 +516,12 @@ public:
         // Nothing to do in general.
         return true;
     }
+
+    virtual bool
+    IsVirtualStep()
+    {
+        return false;
+    }
     
 protected:
     //------------------------------------------------------------------

Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h?rev=181795&r1=181794&r2=181795&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h Tue May 14 10:20:12 2013
@@ -60,6 +60,9 @@ public:
     static void
     SetDefaultFlagValue (uint32_t new_value);
     
+    bool
+    IsVirtualStep();
+
 protected:
     virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);
 

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=181795&r1=181794&r2=181795&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Tue May 14 10:20:12 2013
@@ -390,32 +390,23 @@ Thread::GetPrivateStopInfo ()
     ProcessSP process_sp (GetProcess());
     if (process_sp)
     {
-        ProcessSP process_sp (GetProcess());
-        if (process_sp)
+        const uint32_t process_stop_id = process_sp->GetStopID();
+        if (m_stop_info_stop_id != process_stop_id)
         {
-            const uint32_t process_stop_id = process_sp->GetStopID();
-            if (m_stop_info_stop_id != process_stop_id)
+            if (m_stop_info_sp)
             {
-                if (m_stop_info_sp)
-                {
-                    if (m_stop_info_sp->IsValid())
-                    {
-                        SetStopInfo (m_stop_info_sp);
-                    }
-                    else
-                    {
-                        if (IsStillAtLastBreakpointHit())
-                            SetStopInfo(m_stop_info_sp);
-                        else
-                            m_stop_info_sp.reset();
-                    }
-                }
-                
-                if (!m_stop_info_sp)
-                {
-                    if (CalculateStopInfo() == false)
-                        SetStopInfo (StopInfoSP());
-                }
+                if (m_stop_info_sp->IsValid()
+                    || IsStillAtLastBreakpointHit()
+                    || GetCurrentPlan()->IsVirtualStep())
+                    SetStopInfo (m_stop_info_sp);
+                else
+                    m_stop_info_sp.reset();
+            }
+
+            if (!m_stop_info_sp)
+            {
+                if (CalculateStopInfo() == false)
+                    SetStopInfo (StopInfoSP());
             }
         }
     }
@@ -693,6 +684,10 @@ Thread::ShouldStop (Event* event_ptr)
         return false;
     }
     
+    // Based on the current thread plan and process stop info, check if this
+    // thread caused the process to stop. NOTE: this must take place before
+    // the plan is moved from the current plan stack to the completed plan
+    // stack.
     if (ThreadStoppedForAReason() == false)
     {
         if (log)

Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=181795&r1=181794&r2=181795&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Tue May 14 10:20:12 2013
@@ -463,3 +463,9 @@ ThreadPlanStepInRange::DoWillResume (lld
     }
     return true;
 }
+
+bool
+ThreadPlanStepInRange::IsVirtualStep()
+{
+  return m_virtual_step;
+}





More information about the lldb-commits mailing list