[Lldb-commits] [lldb] r106378 - in /lldb/trunk: include/lldb/ include/lldb/Target/ lldb.xcodeproj/ source/API/ source/Commands/ source/Plugins/DynamicLoader/MacOSX-DYLD/ source/Target/

Jim Ingham jingham at apple.com
Fri Jun 18 21:45:33 PDT 2010


Author: jingham
Date: Fri Jun 18 23:45:32 2010
New Revision: 106378

URL: http://llvm.org/viewvc/llvm-project?rev=106378&view=rev
Log:
Two changes in this checkin.  Added a ThreadPlanKind so that I can do some reasoning based on the kind of thread plan
without having to use RTTI.
Removed the ThreadPlanContinue and replaced with a ShouldAutoContinue query that serves the same purpose.  Having to push
another plan to assert that if there's no other indication the target should continue when this plan is popped was flakey
and error prone.  This method is more stable, and fixed problems we were having with thread specific breakpoints.

Removed:
    lldb/trunk/include/lldb/Target/ThreadPlanContinue.h
    lldb/trunk/source/Target/ThreadPlanContinue.cpp
Modified:
    lldb/trunk/include/lldb/Target/Thread.h
    lldb/trunk/include/lldb/Target/ThreadPlan.h
    lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
    lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h
    lldb/trunk/include/lldb/lldb-forward.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/source/API/SBThread.cpp
    lldb/trunk/source/Commands/CommandObjectThread.cpp
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Target/ThreadList.cpp
    lldb/trunk/source/Target/ThreadPlan.cpp
    lldb/trunk/source/Target/ThreadPlanBase.cpp
    lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
    lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp
    lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
    lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp
    lldb/trunk/source/Target/ThreadPlanStepOut.cpp
    lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp
    lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
    lldb/trunk/source/Target/ThreadPlanStepRange.cpp
    lldb/trunk/source/Target/ThreadPlanStepThrough.cpp
    lldb/trunk/source/Target/ThreadPlanStepUntil.cpp

Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Fri Jun 18 23:45:32 2010
@@ -494,31 +494,6 @@
     ///    \b true if we discard the currently queued plans and replace them with this one.
     ///    Otherwise this plan will go on the end of the plan stack.
     ///
-    /// @param[in] stop_other_threads
-    ///    \b true if we will stop other threads while we single step this one.
-    ///
-    /// @param[in] stop_vote
-    /// @param[in] run_vote
-    ///    See standard meanings for the stop & run votes in ThreadPlan.h.
-    ///
-    /// @return
-    ///     A pointer to the newly queued thread plan, or NULL if the plan could not be queued.
-    //------------------------------------------------------------------
-    virtual ThreadPlan *
-    QueueThreadPlanForContinue (bool abort_other_plans,
-                                bool stop_other_threads,
-                                    lldb::Vote stop_vote,
-                                    lldb::Vote run_vote = lldb::eVoteNoOpinion,
-                                    bool immediate = false);
-    //------------------------------------------------------------------
-    /// Gets the plan used to continue from the current PC.
-    /// This is a simple plan, mostly useful as a backstop when you are continuing
-    /// for some particular purpose.
-    ///
-    /// @param[in] abort_other_plans
-    ///    \b true if we discard the currently queued plans and replace them with this one.
-    ///    Otherwise this plan will go on the end of the plan stack.
-    ///
     /// @param[in] target_addr
     ///    The address to which we're running.
     ///

Modified: lldb/trunk/include/lldb/Target/ThreadPlan.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlan.h?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadPlan.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlan.h Fri Jun 18 23:45:32 2010
@@ -179,10 +179,27 @@
         eThisThread
     } ThreadScope;
 
+    typedef enum
+    {
+        eKindGeneric,
+        eKindBase,
+        eKindCallFunction,
+        eKindStepInstruction,
+        eKindStepOut,
+        eKindStepOverBreakpoint,
+        eKindStepOverRange,
+        eKindStepInRange,
+        eKindRunToAddress,
+        eKindStepThrough,
+        eKindStepUntil
+        
+    } ThreadPlanKind;
+    
     //------------------------------------------------------------------
     // Constructors and Destructors
     //------------------------------------------------------------------
-    ThreadPlan (const char *name,
+    ThreadPlan (ThreadPlanKind kind,
+                const char *name,
                 Thread &thread,
                 lldb::Vote stop_vote,
                 lldb::Vote run_vote);
@@ -259,6 +276,12 @@
 
     virtual bool
     ShouldStop (Event *event_ptr) = 0;
+    
+    virtual bool
+    ShouldAutoContinue (Event *event_ptr)
+    {
+        return false;
+    }
 
     // Whether a "stop class" event should be reported to the "outside world".  In general
     // if a thread plan is active, events should not be reported.
@@ -313,6 +336,11 @@
     // This pushes \a plan onto the plan stack of the current plan's thread.
     void
     PushPlan (lldb::ThreadPlanSP &thread_plan_sp);
+    
+    ThreadPlanKind GetKind() const
+    {
+        return m_kind;
+    }
 
 protected:
     //------------------------------------------------------------------
@@ -342,6 +370,7 @@
     //------------------------------------------------------------------
     static lldb::user_id_t GetNextID ();
 
+    ThreadPlanKind m_kind;
     std::string m_name;
     Mutex m_plan_complete_mutex;
     bool m_plan_complete;

Removed: lldb/trunk/include/lldb/Target/ThreadPlanContinue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanContinue.h?rev=106377&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadPlanContinue.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanContinue.h (removed)
@@ -1,60 +0,0 @@
-//===-- ThreadPlanContinue.h ------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ThreadPlanContinue_h_
-#define liblldb_ThreadPlanContinue_h_
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/lldb-private.h"
-#include "lldb/Target/ThreadPlan.h"
-
-namespace lldb_private {
-
-class ThreadPlanContinue : public ThreadPlan
-{
-public:
-    ThreadPlanContinue (Thread &thread,
-                        bool stop_others,
-                        lldb::Vote stop_vote,
-                        lldb::Vote run_vote,
-                        bool immediate = false);
-    virtual ~ThreadPlanContinue ();
-
-    virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
-
-    virtual bool ValidatePlan (Stream *error);
-
-    virtual bool PlanExplainsStop ();
-    virtual bool ShouldStop (Event *event_ptr);
-    virtual bool StopOthers ();
-    virtual lldb::StateType RunState ();
-    virtual bool IsImmediate () const;
-    virtual bool WillResume (lldb::StateType resume_state, bool current_plan);
-    virtual bool WillStop ();
-    virtual bool MischiefManaged ();
-
-protected:
-    bool InRange();
-private:
-    bool m_stop_others;
-    bool m_did_run;
-    bool m_immediate;
-    // Need an appropriate marker for the current stack so we can tell step out
-    // from step in.
-
-    DISALLOW_COPY_AND_ASSIGN (ThreadPlanContinue);
-
-};
-
-} // namespace lldb_private
-
-#endif  // liblldb_ThreadPlanContinue_h_

Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h Fri Jun 18 23:45:32 2010
@@ -38,6 +38,8 @@
     virtual bool WillResume (lldb::StateType resume_state, bool current_plan);
     virtual bool WillStop ();
     virtual bool MischiefManaged ();
+    void SetAutoContinue (bool do_it);
+    virtual bool ShouldAutoContinue(Event *event_ptr);
 
 protected:
 
@@ -45,6 +47,7 @@
 
     lldb::addr_t m_breakpoint_addr;
     lldb::user_id_t m_breakpoint_site_id;
+    bool m_auto_continue;
 
     DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepOverBreakpoint);
 

Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h Fri Jun 18 23:45:32 2010
@@ -39,7 +39,8 @@
 
 protected:
 
-    ThreadPlanStepRange (const char *name,
+    ThreadPlanStepRange (ThreadPlanKind kind,
+                         const char *name,
                          Thread &thread,
                          const AddressRange &range,
                          const SymbolContext &addr_context,

Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Fri Jun 18 23:45:32 2010
@@ -121,7 +121,6 @@
 class   Thread;
 class   ThreadList;
 class   ThreadPlan;
-class   ThreadPlanContinue;
 class   ThreadPlanBase;
 class   ThreadPlanStepInstruction;
 class   ThreadPlanStepOut;

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jun 18 23:45:32 2010
@@ -194,7 +194,6 @@
 		26D5B0EA11B07550009A862E /* ThreadList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7F3E10F1B90C00F91463 /* ThreadList.cpp */; };
 		26D5B0EB11B07550009A862E /* ThreadPlan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7F3F10F1B90C00F91463 /* ThreadPlan.cpp */; };
 		26D5B0EC11B07550009A862E /* ObjectFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7F4C10F1BC1A00F91463 /* ObjectFile.cpp */; };
-		26D5B0ED11B07550009A862E /* ThreadPlanContinue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C847010F50EFC00BB2B04 /* ThreadPlanContinue.cpp */; };
 		26D5B0EE11B07550009A862E /* ThreadPlanBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C847110F50EFC00BB2B04 /* ThreadPlanBase.cpp */; };
 		26D5B0EF11B07550009A862E /* ThreadPlanStepInstruction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C847210F50EFC00BB2B04 /* ThreadPlanStepInstruction.cpp */; };
 		26D5B0F011B07550009A862E /* ThreadPlanStepOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C847310F50EFC00BB2B04 /* ThreadPlanStepOut.cpp */; };
@@ -392,14 +391,12 @@
 		260223E8115F06E500A601A2 /* SBCommunication.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBCommunication.cpp; path = source/API/SBCommunication.cpp; sourceTree = "<group>"; };
 		26022531115F27FA00A601A2 /* SBFileSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBFileSpec.h; path = include/lldb/API/SBFileSpec.h; sourceTree = "<group>"; };
 		26022532115F281400A601A2 /* SBFileSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBFileSpec.cpp; path = source/API/SBFileSpec.cpp; sourceTree = "<group>"; };
-		260C847010F50EFC00BB2B04 /* ThreadPlanContinue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanContinue.cpp; path = source/Target/ThreadPlanContinue.cpp; sourceTree = "<group>"; };
 		260C847110F50EFC00BB2B04 /* ThreadPlanBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanBase.cpp; path = source/Target/ThreadPlanBase.cpp; sourceTree = "<group>"; };
 		260C847210F50EFC00BB2B04 /* ThreadPlanStepInstruction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepInstruction.cpp; path = source/Target/ThreadPlanStepInstruction.cpp; sourceTree = "<group>"; };
 		260C847310F50EFC00BB2B04 /* ThreadPlanStepOut.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepOut.cpp; path = source/Target/ThreadPlanStepOut.cpp; sourceTree = "<group>"; };
 		260C847410F50EFC00BB2B04 /* ThreadPlanStepOverBreakpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepOverBreakpoint.cpp; path = source/Target/ThreadPlanStepOverBreakpoint.cpp; sourceTree = "<group>"; };
 		260C847510F50EFC00BB2B04 /* ThreadPlanStepThrough.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepThrough.cpp; path = source/Target/ThreadPlanStepThrough.cpp; sourceTree = "<group>"; };
 		260C847610F50EFC00BB2B04 /* ThreadPlanStepRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepRange.cpp; path = source/Target/ThreadPlanStepRange.cpp; sourceTree = "<group>"; };
-		260C847E10F50F0A00BB2B04 /* ThreadPlanContinue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanContinue.h; path = include/lldb/Target/ThreadPlanContinue.h; sourceTree = "<group>"; };
 		260C847F10F50F0A00BB2B04 /* ThreadPlanBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanBase.h; path = include/lldb/Target/ThreadPlanBase.h; sourceTree = "<group>"; };
 		260C848010F50F0A00BB2B04 /* ThreadPlanStepInstruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanStepInstruction.h; path = include/lldb/Target/ThreadPlanStepInstruction.h; sourceTree = "<group>"; };
 		260C848110F50F0A00BB2B04 /* ThreadPlanStepOut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanStepOut.h; path = include/lldb/Target/ThreadPlanStepOut.h; sourceTree = "<group>"; };
@@ -1940,8 +1937,6 @@
 				260C847110F50EFC00BB2B04 /* ThreadPlanBase.cpp */,
 				49EC3E9C118F90D400B1265E /* ThreadPlanCallFunction.h */,
 				49EC3E98118F90AC00B1265E /* ThreadPlanCallFunction.cpp */,
-				260C847E10F50F0A00BB2B04 /* ThreadPlanContinue.h */,
-				260C847010F50EFC00BB2B04 /* ThreadPlanContinue.cpp */,
 				4C43DEF9110641F300E55CBF /* ThreadPlanShouldStopHere.h */,
 				4C43DEFA110641F300E55CBF /* ThreadPlanShouldStopHere.cpp */,
 				260C848010F50F0A00BB2B04 /* ThreadPlanStepInstruction.h */,
@@ -2501,7 +2496,6 @@
 				26D5B0EA11B07550009A862E /* ThreadList.cpp in Sources */,
 				26D5B0EB11B07550009A862E /* ThreadPlan.cpp in Sources */,
 				26D5B0EC11B07550009A862E /* ObjectFile.cpp in Sources */,
-				26D5B0ED11B07550009A862E /* ThreadPlanContinue.cpp in Sources */,
 				26D5B0EE11B07550009A862E /* ThreadPlanBase.cpp in Sources */,
 				26D5B0EF11B07550009A862E /* ThreadPlanStepInstruction.cpp in Sources */,
 				26D5B0F011B07550009A862E /* ThreadPlanStepOut.cpp in Sources */,

Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Fri Jun 18 23:45:32 2010
@@ -19,7 +19,6 @@
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/ThreadPlan.h"
-#include "lldb/Target/ThreadPlanContinue.h"
 #include "lldb/Target/ThreadPlanStepInstruction.h"
 #include "lldb/Target/ThreadPlanStepOut.h"
 #include "lldb/Target/ThreadPlanStepRange.h"

Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Fri Jun 18 23:45:32 2010
@@ -25,7 +25,6 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Target/ThreadPlan.h"
-#include "lldb/Target/ThreadPlanContinue.h"
 #include "lldb/Target/ThreadPlanStepInstruction.h"
 #include "lldb/Target/ThreadPlanStepOut.h"
 #include "lldb/Target/ThreadPlanStepRange.h"

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.cpp Fri Jun 18 23:45:32 2010
@@ -33,7 +33,7 @@
         lldb::addr_t class_ptr, 
         lldb::addr_t sel_ptr, 
         bool stop_others) :
-    ThreadPlan ("MacOSX Step through ObjC Trampoline", thread, eVoteNoOpinion, eVoteNoOpinion),
+    ThreadPlan (ThreadPlan::eKindGeneric, "MacOSX Step through ObjC Trampoline", thread, eVoteNoOpinion, eVoteNoOpinion),
     m_objc_trampoline_handler (trampoline_handler),
     m_impl_function (trampoline_handler->GetLookupImplementationWrapperFunction()),
     m_args_addr (args_addr),

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Jun 18 23:45:32 2010
@@ -1313,7 +1313,7 @@
             // We've stopped.  First see if we're going to restart the target.
             // If we are going to stop, then we always broadcast the event.
             // If we aren't going to stop, let the thread plans decide if we're going to report this event.
-            // If no thread has an opinion, we also report it.
+            // If no thread has an opinion, we don't report it.
             if (state != eStateInvalid)
             {
 
@@ -1326,8 +1326,6 @@
                         case eVoteYes:
                             Process::ProcessEventData::SetRestartedInEvent (event_ptr, true);
                         case eVoteNoOpinion:
-                            return_value = true;
-                            break;
                         case eVoteNo:
                             return_value = false;
                             break;

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Fri Jun 18 23:45:32 2010
@@ -20,7 +20,6 @@
 #include "lldb/Target/Thread.h"
 #include "lldb/Target/ThreadPlan.h"
 #include "lldb/Target/ThreadPlanCallFunction.h"
-#include "lldb/Target/ThreadPlanContinue.h"
 #include "lldb/Target/ThreadPlanBase.h"
 #include "lldb/Target/ThreadPlanStepInstruction.h"
 #include "lldb/Target/ThreadPlanStepOut.h"
@@ -431,28 +430,22 @@
         {
             // Note, don't assume there's a ThreadPlanStepOverBreakpoint, the target may not require anything
             // special to step over a breakpoint.
-            
-            // TODO: Jim Ingham -- this is the only place left that does RTTI in
-            // all of LLDB. I am adding a hack right now to let us compile 
-            // without RTTI, but we will need to look at and fix this. Right
-            // now it will always push the breakpoint thread plan which is 
-            // probably wrong. We will need to work around this.
-    
-//            ThreadPlan *cur_plan = GetCurrentPlan();
-//            ThreadPlanStepOverBreakpoint *step_over_bp = dynamic_cast<ThreadPlanStepOverBreakpoint *> (cur_plan);
-//            if (step_over_bp == NULL)
-            {
+                
+            ThreadPlan *cur_plan = GetCurrentPlan();
 
-                ThreadPlanSP step_bp_plan_sp (new ThreadPlanStepOverBreakpoint (*this));
-                if (step_bp_plan_sp)
+            if (cur_plan->GetKind() != ThreadPlan::eKindStepOverBreakpoint)
+            {
+                ThreadPlanStepOverBreakpoint *step_bp_plan = new ThreadPlanStepOverBreakpoint (*this);
+                if (step_bp_plan)
                 {
+                    ThreadPlanSP step_bp_plan_sp;
+                    step_bp_plan->SetPrivate (true);
+
                     if (GetCurrentPlan()->RunState() != eStateStepping)
                     {
-                        ThreadPlanSP continue_plan_sp (new ThreadPlanContinue(*this, false, eVoteNo, eVoteNoOpinion));
-                        continue_plan_sp->SetPrivate (true);
-                        QueueThreadPlan (continue_plan_sp, false);
+                        step_bp_plan->SetAutoContinue(true);
                     }
-                    step_bp_plan_sp->SetPrivate (true);
+                    step_bp_plan_sp.reset (step_bp_plan);
                     QueueThreadPlan (step_bp_plan_sp, false);
                 }
             }
@@ -524,6 +517,7 @@
 
     if (current_plan->PlanExplainsStop())
     {
+        bool over_ride_stop = current_plan->ShouldAutoContinue(event_ptr);
         while (1)
         {
             should_stop = current_plan->ShouldStop(event_ptr);
@@ -558,6 +552,8 @@
                 break;
             }
         }
+        if (over_ride_stop)
+            should_stop = false;
     }
     else
     {
@@ -949,14 +945,6 @@
 }
 
 ThreadPlan *
-Thread::QueueThreadPlanForContinue (bool abort_other_plans, bool stop_other_threads, Vote stop_vote, Vote run_vote, bool immediate)
-{
-    ThreadPlanSP thread_plan_sp (new ThreadPlanContinue (*this, stop_other_threads, stop_vote, run_vote, immediate));
-    QueueThreadPlan (thread_plan_sp, abort_other_plans);
-    return thread_plan_sp.get();
-}
-
-ThreadPlan *
 Thread::QueueThreadPlanForCallFunction (bool abort_other_plans,
                                         Address& function,
                                         lldb::addr_t arg,

Modified: lldb/trunk/source/Target/ThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadList.cpp (original)
+++ lldb/trunk/source/Target/ThreadList.cpp Fri Jun 18 23:45:32 2010
@@ -178,7 +178,7 @@
     // Running events should never stop, obviously...
 
 
-    bool should_stop = false;
+    bool should_stop = false;    
     m_process->UpdateThreadListIfNeeded();
 
     collection::iterator pos, end = m_threads.end();
@@ -189,12 +189,12 @@
     for (pos = m_threads.begin(); pos != end; ++pos)
     {
         ThreadSP thread_sp(*pos);
-        if ((thread_sp->ThreadStoppedForAReason())
-            && (thread_sp->GetResumeState () != eStateSuspended))
+        if ((thread_sp->GetResumeState () != eStateSuspended) && (thread_sp->ThreadStoppedForAReason()))
         {
-            should_stop |= thread_sp->ShouldStop(event_ptr);
+            should_stop |=  thread_sp->ShouldStop(event_ptr);
         }
     }
+
     if (should_stop)
     {
         for (pos = m_threads.begin(); pos != end; ++pos)

Modified: lldb/trunk/source/Target/ThreadPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlan.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlan.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlan.cpp Fri Jun 18 23:45:32 2010
@@ -23,7 +23,8 @@
 //----------------------------------------------------------------------
 // ThreadPlan constructor
 //----------------------------------------------------------------------
-ThreadPlan::ThreadPlan(const char *name, Thread &thread, Vote stop_vote, Vote run_vote) :
+ThreadPlan::ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, Vote stop_vote, Vote run_vote) :
+    m_kind (kind),
     m_name (name),
     m_thread (thread),
     m_plan_complete(false),

Modified: lldb/trunk/source/Target/ThreadPlanBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanBase.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanBase.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanBase.cpp Fri Jun 18 23:45:32 2010
@@ -21,8 +21,6 @@
 #include "lldb/Core/Stream.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
-#include "lldb/Target/ThreadPlanContinue.h"
-#include "lldb/Target/ThreadPlanStepOverBreakpoint.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -34,7 +32,7 @@
 //----------------------------------------------------------------------
 
 ThreadPlanBase::ThreadPlanBase (Thread &thread) :
-    ThreadPlan("base plan", thread, eVoteYes, eVoteNoOpinion)
+    ThreadPlan(ThreadPlan::eKindBase, "base plan", thread, eVoteYes, eVoteNoOpinion)
 {
 
 }
@@ -94,13 +92,16 @@
                 {
                     // We want to step over the breakpoint and then continue.  So push these two plans.
 
-                    StoppointCallbackContext hit_context(event_ptr, &m_thread.GetProcess(), &m_thread, m_thread.GetStackFrameAtIndex(0).get());
-                    bool should_stop = m_thread.GetProcess().GetBreakpointSiteList().ShouldStop(&hit_context, bp_site_sp->GetID());
+                    StoppointCallbackContext hit_context(event_ptr, &m_thread.GetProcess(), &m_thread, 
+                                                         m_thread.GetStackFrameAtIndex(0).get());
+                    bool should_stop = m_thread.GetProcess().GetBreakpointSiteList().ShouldStop(&hit_context, 
+                                                                                                bp_site_sp->GetID());
 
                     if (!should_stop)
                     {
-                        // If we aren't going to stop at this breakpoint, and it is internal, don't report this stop or the subsequent
-                        // running event.  Otherwise we will post the stopped & running, but the stopped event will get marked
+                        // If we aren't going to stop at this breakpoint, and it is internal, 
+                        // 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".
                         uint32_t i;
                         bool is_wholly_internal = true;

Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Fri Jun 18 23:45:32 2010
@@ -35,7 +35,7 @@
                                                 lldb::addr_t arg,
                                                 bool stop_other_threads,
                                                 bool discard_on_error) :
-    ThreadPlan ("Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion),
+    ThreadPlan (ThreadPlan::eKindCallFunction, "Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion),
     m_valid(false),
     m_process(thread.GetProcess()),
     m_arg_addr (arg),
@@ -89,7 +89,7 @@
                                                 ValueList &args,
                                                 bool stop_other_threads,
                                                 bool discard_on_error) :
-    ThreadPlan ("Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion),
+    ThreadPlan (ThreadPlan::eKindCallFunction, "Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion),
     m_valid(false),
     m_process(thread.GetProcess()),
     m_arg_addr (0),

Removed: lldb/trunk/source/Target/ThreadPlanContinue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanContinue.cpp?rev=106377&view=auto
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanContinue.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanContinue.cpp (removed)
@@ -1,120 +0,0 @@
-//===-- ThreadPlanContinue.cpp ----------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Target/ThreadPlanContinue.h"
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/lldb-private-log.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Core/Stream.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-//----------------------------------------------------------------------
-// ThreadPlanContinue: Continue plan
-//----------------------------------------------------------------------
-
-ThreadPlanContinue::ThreadPlanContinue (Thread &thread, bool stop_others, Vote stop_vote, Vote run_vote, bool immediate) :
-    ThreadPlan ("Continue after previous plan", thread, stop_vote, run_vote),
-    m_stop_others (stop_others),
-    m_did_run (false),
-    m_immediate (immediate)
-{
-}
-
-ThreadPlanContinue::~ThreadPlanContinue ()
-{
-}
-
-void
-ThreadPlanContinue::GetDescription (Stream *s, lldb::DescriptionLevel level)
-{
-    if (level == lldb::eDescriptionLevelBrief)
-        s->Printf ("continue");
-    else
-    {
-        s->Printf ("Continue from the previous plan");
-    }
-}
-
-bool
-ThreadPlanContinue::ValidatePlan (Stream *error)
-{
-    // Since we read the instruction we're stepping over from the thread,
-    // this plan will always work.
-    return true;
-}
-
-bool
-ThreadPlanContinue::PlanExplainsStop ()
-{
-    return true;
-}
-
-bool
-ThreadPlanContinue::ShouldStop (Event *event_ptr)
-{
-    return false;
-}
-
-bool
-ThreadPlanContinue::IsImmediate () const
-{
-    return m_immediate;
-    return false;
-}
-
-bool
-ThreadPlanContinue::StopOthers ()
-{
-    return m_stop_others;
-}
-
-StateType
-ThreadPlanContinue::RunState ()
-{
-    return eStateRunning;
-}
-
-bool
-ThreadPlanContinue::WillResume (StateType resume_state, bool current_plan)
-{
-    ThreadPlan::WillResume (resume_state, current_plan);
-    if (current_plan)
-    {
-        m_did_run = true;
-    }
-    return true;
-}
-
-bool
-ThreadPlanContinue::WillStop ()
-{
-    return true;
-}
-
-bool
-ThreadPlanContinue::MischiefManaged ()
-{
-    Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
-
-    if (m_did_run)
-    {
-        if (log)
-            log->Printf("Completed continue plan.");
-        ThreadPlan::MischiefManaged ();
-        return true;
-    }
-    else
-        return false;
-}

Modified: lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp Fri Jun 18 23:45:32 2010
@@ -34,7 +34,7 @@
     Address &address,
     bool stop_others
 ) :
-    ThreadPlan ("Run to breakpoint plan", thread, eVoteNoOpinion, eVoteNoOpinion),
+    ThreadPlan (ThreadPlan::eKindRunToAddress, "Run to breakpoint plan", thread, eVoteNoOpinion, eVoteNoOpinion),
     m_stop_others (stop_others),
     m_address (LLDB_INVALID_ADDRESS),
     m_break_id (LLDB_INVALID_BREAK_ID)
@@ -49,7 +49,7 @@
     lldb::addr_t address,
     bool stop_others
 ) :
-    ThreadPlan ("Run to breakpoint plan", thread, eVoteNoOpinion, eVoteNoOpinion),
+    ThreadPlan (ThreadPlan::eKindRunToAddress, "Run to breakpoint plan", thread, eVoteNoOpinion, eVoteNoOpinion),
     m_stop_others (stop_others),
     m_address (address),
     m_break_id (LLDB_INVALID_BREAK_ID)

Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Fri Jun 18 23:45:32 2010
@@ -40,7 +40,7 @@
     const SymbolContext &addr_context,
     lldb::RunMode stop_others
 ) :
-    ThreadPlanStepRange ("Step Range stepping in", thread, range, addr_context, stop_others),
+    ThreadPlanStepRange (ThreadPlan::eKindStepInRange, "Step Range stepping in", thread, range, addr_context, stop_others),
     ThreadPlanShouldStopHere (this, ThreadPlanStepInRange::DefaultShouldStopHereCallback, NULL)
 {
     SetFlagsToDefault ();

Modified: lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp Fri Jun 18 23:45:32 2010
@@ -37,12 +37,11 @@
     Vote stop_vote,
     Vote run_vote
 ) :
-    ThreadPlan ("Step over single instruction", thread, stop_vote, run_vote),
+    ThreadPlan (ThreadPlan::eKindStepInstruction, "Step over single instruction", thread, stop_vote, run_vote),
     m_instruction_addr (0),
     m_step_over (step_over),
     m_stack_depth(0),
-    m_stop_other_threads (stop_other_threads)
-{
+    m_stop_other_threads (stop_other_threads){
     m_instruction_addr = m_thread.GetRegisterContext()->GetPC(0);
     m_stack_depth = m_thread.GetStackFrameCount();
 }

Modified: lldb/trunk/source/Target/ThreadPlanStepOut.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOut.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOut.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOut.cpp Fri Jun 18 23:45:32 2010
@@ -36,7 +36,7 @@
     Vote stop_vote,
     Vote run_vote
 ) :
-    ThreadPlan ("Step out", thread, stop_vote, run_vote),
+    ThreadPlan (ThreadPlan::eKindStepOut, "Step out", thread, stop_vote, run_vote),
     m_step_from_context (context),
     m_step_from_insn (LLDB_INVALID_ADDRESS),
     m_return_addr (LLDB_INVALID_ADDRESS),

Modified: lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp Fri Jun 18 23:45:32 2010
@@ -27,13 +27,15 @@
 //----------------------------------------------------------------------
 
 ThreadPlanStepOverBreakpoint::ThreadPlanStepOverBreakpoint (Thread &thread) :
-    ThreadPlan ("Step over breakpoint trap",
+    ThreadPlan (ThreadPlan::eKindStepOverBreakpoint, "Step over breakpoint trap",
                 thread,
                 eVoteNo,
                 eVoteNoOpinion),  // We need to report the run since this happens
                             // first in the thread plan stack when stepping
                             // over a breakpoint
-    m_breakpoint_addr (LLDB_INVALID_ADDRESS)
+    m_breakpoint_addr (LLDB_INVALID_ADDRESS),
+    m_auto_continue(false)
+
 {
     m_breakpoint_addr = m_thread.GetRegisterContext()->GetPC();
     m_breakpoint_site_id =  m_thread.GetProcess().GetBreakpointSiteList().FindIDByAddress (m_breakpoint_addr);
@@ -128,3 +130,14 @@
     }
 }
 
+void
+ThreadPlanStepOverBreakpoint::SetAutoContinue (bool do_it)
+{
+    m_auto_continue = do_it;
+}
+
+bool
+ThreadPlanStepOverBreakpoint::ShouldAutoContinue (Event *event_ptr)
+{
+    return m_auto_continue;
+}

Modified: lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp Fri Jun 18 23:45:32 2010
@@ -39,7 +39,7 @@
     lldb::RunMode stop_others,
     bool okay_to_discard
 ) :
-    ThreadPlanStepRange ("Step range stepping over", thread, range, addr_context, stop_others)
+    ThreadPlanStepRange (ThreadPlan::eKindStepOverRange, "Step range stepping over", thread, range, addr_context, stop_others)
 {
     SetOkayToDiscard (okay_to_discard);
 }

Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepRange.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp Fri Jun 18 23:45:32 2010
@@ -32,8 +32,8 @@
 // based on the value of \a type.
 //----------------------------------------------------------------------
 
-ThreadPlanStepRange::ThreadPlanStepRange (const char *name, Thread &thread, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_others) :
-    ThreadPlan (name, thread, eVoteNoOpinion, eVoteNoOpinion),
+ThreadPlanStepRange::ThreadPlanStepRange (ThreadPlanKind kind, const char *name, Thread &thread, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_others) :
+    ThreadPlan (ThreadPlan::eKindGeneric, name, thread, eVoteNoOpinion, eVoteNoOpinion),
     m_address_range (range),
     m_addr_context (addr_context),
     m_stop_others (stop_others),

Modified: lldb/trunk/source/Target/ThreadPlanStepThrough.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepThrough.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepThrough.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepThrough.cpp Fri Jun 18 23:45:32 2010
@@ -30,7 +30,7 @@
 //----------------------------------------------------------------------
 
 ThreadPlanStepThrough::ThreadPlanStepThrough (Thread &thread, bool stop_others) :
-    ThreadPlan ("Step through trampolines and prologues", thread, eVoteNoOpinion, eVoteNoOpinion),
+    ThreadPlan (ThreadPlan::eKindStepThrough, "Step through trampolines and prologues", thread, eVoteNoOpinion, eVoteNoOpinion),
     m_start_address (0),
     m_stop_others (stop_others)
 {

Modified: lldb/trunk/source/Target/ThreadPlanStepUntil.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepUntil.cpp?rev=106378&r1=106377&r2=106378&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepUntil.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepUntil.cpp Fri Jun 18 23:45:32 2010
@@ -38,7 +38,7 @@
     size_t num_addresses,
     bool stop_others
 ) :
-    ThreadPlan ("Step out", thread, eVoteNoOpinion, eVoteNoOpinion),
+    ThreadPlan (ThreadPlan::eKindStepUntil, "Step until", thread, eVoteNoOpinion, eVoteNoOpinion),
     m_step_from_insn (LLDB_INVALID_ADDRESS),
     m_return_addr (LLDB_INVALID_ADDRESS),
     m_return_bp_id(LLDB_INVALID_BREAK_ID),





More information about the lldb-commits mailing list