diff options
Diffstat (limited to 'lldb')
26 files changed, 93 insertions, 274 deletions
diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h index 01e17773b08..7bba055c963 100644 --- a/lldb/include/lldb/Target/Thread.h +++ b/lldb/include/lldb/Target/Thread.h @@ -494,31 +494,6 @@ public: /// \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. /// diff --git a/lldb/include/lldb/Target/ThreadPlan.h b/lldb/include/lldb/Target/ThreadPlan.h index 23aabc505e4..d20be6505b8 100644 --- a/lldb/include/lldb/Target/ThreadPlan.h +++ b/lldb/include/lldb/Target/ThreadPlan.h @@ -179,10 +179,27 @@ public: 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 @@ public: 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 @@ public: // 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 @@ private: //------------------------------------------------------------------ static lldb::user_id_t GetNextID (); + ThreadPlanKind m_kind; std::string m_name; Mutex m_plan_complete_mutex; bool m_plan_complete; diff --git a/lldb/include/lldb/Target/ThreadPlanContinue.h b/lldb/include/lldb/Target/ThreadPlanContinue.h deleted file mode 100644 index bd50c737fd7..00000000000 --- a/lldb/include/lldb/Target/ThreadPlanContinue.h +++ /dev/null @@ -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_ diff --git a/lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h b/lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h index 14ba453ffd9..3e13eef9789 100644 --- a/lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h +++ b/lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h @@ -38,6 +38,8 @@ public: 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 @@ private: lldb::addr_t m_breakpoint_addr; lldb::user_id_t m_breakpoint_site_id; + bool m_auto_continue; DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepOverBreakpoint); diff --git a/lldb/include/lldb/Target/ThreadPlanStepRange.h b/lldb/include/lldb/Target/ThreadPlanStepRange.h index dfdd2e20e50..b9909ef665f 100644 --- a/lldb/include/lldb/Target/ThreadPlanStepRange.h +++ b/lldb/include/lldb/Target/ThreadPlanStepRange.h @@ -39,7 +39,8 @@ public: protected: - ThreadPlanStepRange (const char *name, + ThreadPlanStepRange (ThreadPlanKind kind, + const char *name, Thread &thread, const AddressRange &range, const SymbolContext &addr_context, diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h index 59500d8f2df..bd294453429 100644 --- a/lldb/include/lldb/lldb-forward.h +++ b/lldb/include/lldb/lldb-forward.h @@ -121,7 +121,6 @@ class TargetList; class Thread; class ThreadList; class ThreadPlan; -class ThreadPlanContinue; class ThreadPlanBase; class ThreadPlanStepInstruction; class ThreadPlanStepOut; diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj index 131e30904a3..781c7f629c0 100644 --- a/lldb/lldb.xcodeproj/project.pbxproj +++ b/lldb/lldb.xcodeproj/project.pbxproj @@ -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 */, diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp index a220cd85a3a..7a86999c797 100644 --- a/lldb/source/API/SBThread.cpp +++ b/lldb/source/API/SBThread.cpp @@ -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" diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index 607383d8ccd..ef529f0e70b 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -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" diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.cpp index a0cb0a86f18..2f2cc39a4ea 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.cpp @@ -33,7 +33,7 @@ ThreadPlanStepThroughObjCTrampoline::ThreadPlanStepThroughObjCTrampoline( 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), diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 9a6ab0c83e8..970e1e48994 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -1313,7 +1313,7 @@ Process::ShouldBroadcastEvent (Event *event_ptr) // 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 @@ Process::ShouldBroadcastEvent (Event *event_ptr) case eVoteYes: Process::ProcessEventData::SetRestartedInEvent (event_ptr, true); case eVoteNoOpinion: - return_value = true; - break; case eVoteNo: return_value = false; break; diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 97a55fb7434..40ea4df14a5 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -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 @@ Thread::SetupForResume () { // 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 @@ Thread::ShouldStop (Event* event_ptr) 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 @@ Thread::ShouldStop (Event* event_ptr) break; } } + if (over_ride_stop) + should_stop = false; } else { @@ -949,14 +945,6 @@ Thread::QueueThreadPlanForStepThrough (bool abort_other_plans, bool stop_other_t } 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, diff --git a/lldb/source/Target/ThreadList.cpp b/lldb/source/Target/ThreadList.cpp index 6bc22712d10..8255c5df3b6 100644 --- a/lldb/source/Target/ThreadList.cpp +++ b/lldb/source/Target/ThreadList.cpp @@ -178,7 +178,7 @@ ThreadList::ShouldStop (Event *event_ptr) // 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 @@ ThreadList::ShouldStop (Event *event_ptr) 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) diff --git a/lldb/source/Target/ThreadPlan.cpp b/lldb/source/Target/ThreadPlan.cpp index 3be8e9a36bd..3e1a9fda050 100644 --- a/lldb/source/Target/ThreadPlan.cpp +++ b/lldb/source/Target/ThreadPlan.cpp @@ -23,7 +23,8 @@ using namespace lldb_private; //---------------------------------------------------------------------- // 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), diff --git a/lldb/source/Target/ThreadPlanBase.cpp b/lldb/source/Target/ThreadPlanBase.cpp index 283f3bef4c9..5f5845429c0 100644 --- a/lldb/source/Target/ThreadPlanBase.cpp +++ b/lldb/source/Target/ThreadPlanBase.cpp @@ -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 @@ using namespace lldb_private; //---------------------------------------------------------------------- ThreadPlanBase::ThreadPlanBase (Thread &thread) : - ThreadPlan("base plan", thread, eVoteYes, eVoteNoOpinion) + ThreadPlan(ThreadPlan::eKindBase, "base plan", thread, eVoteYes, eVoteNoOpinion) { } @@ -94,13 +92,16 @@ ThreadPlanBase::ShouldStop (Event *event_ptr) { // 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; diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 4b3533a3446..0309505e4ae 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -35,7 +35,7 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, 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 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, 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), diff --git a/lldb/source/Target/ThreadPlanContinue.cpp b/lldb/source/Target/ThreadPlanContinue.cpp deleted file mode 100644 index 63d8a3323d0..00000000000 --- a/lldb/source/Target/ThreadPlanContinue.cpp +++ /dev/null @@ -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; -} diff --git a/lldb/source/Target/ThreadPlanRunToAddress.cpp b/lldb/source/Target/ThreadPlanRunToAddress.cpp index 0544ea5bcbe..077541ed27c 100644 --- a/lldb/source/Target/ThreadPlanRunToAddress.cpp +++ b/lldb/source/Target/ThreadPlanRunToAddress.cpp @@ -34,7 +34,7 @@ ThreadPlanRunToAddress::ThreadPlanRunToAddress 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 @@ ThreadPlanRunToAddress::ThreadPlanRunToAddress 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) diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp index f62fdb87c7f..6084b4e815f 100644 --- a/lldb/source/Target/ThreadPlanStepInRange.cpp +++ b/lldb/source/Target/ThreadPlanStepInRange.cpp @@ -40,7 +40,7 @@ ThreadPlanStepInRange::ThreadPlanStepInRange 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 (); diff --git a/lldb/source/Target/ThreadPlanStepInstruction.cpp b/lldb/source/Target/ThreadPlanStepInstruction.cpp index 41c4373105b..644c768eaa7 100644 --- a/lldb/source/Target/ThreadPlanStepInstruction.cpp +++ b/lldb/source/Target/ThreadPlanStepInstruction.cpp @@ -37,12 +37,11 @@ ThreadPlanStepInstruction::ThreadPlanStepInstruction 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(); } diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.cpp index e05a8a440a1..f72dca5e091 100644 --- a/lldb/source/Target/ThreadPlanStepOut.cpp +++ b/lldb/source/Target/ThreadPlanStepOut.cpp @@ -36,7 +36,7 @@ ThreadPlanStepOut::ThreadPlanStepOut 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), diff --git a/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp b/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp index 2b8b06d5960..9f5b1ceeca8 100644 --- a/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp +++ b/lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp @@ -27,13 +27,15 @@ using namespace lldb_private; //---------------------------------------------------------------------- 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 @@ ThreadPlanStepOverBreakpoint::MischiefManaged () } } +void +ThreadPlanStepOverBreakpoint::SetAutoContinue (bool do_it) +{ + m_auto_continue = do_it; +} + +bool +ThreadPlanStepOverBreakpoint::ShouldAutoContinue (Event *event_ptr) +{ + return m_auto_continue; +} diff --git a/lldb/source/Target/ThreadPlanStepOverRange.cpp b/lldb/source/Target/ThreadPlanStepOverRange.cpp index ea56412a010..bbc51047813 100644 --- a/lldb/source/Target/ThreadPlanStepOverRange.cpp +++ b/lldb/source/Target/ThreadPlanStepOverRange.cpp @@ -39,7 +39,7 @@ ThreadPlanStepOverRange::ThreadPlanStepOverRange 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); } diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp index edf80a57d52..2790d8087b0 100644 --- a/lldb/source/Target/ThreadPlanStepRange.cpp +++ b/lldb/source/Target/ThreadPlanStepRange.cpp @@ -32,8 +32,8 @@ using namespace lldb_private; // 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), diff --git a/lldb/source/Target/ThreadPlanStepThrough.cpp b/lldb/source/Target/ThreadPlanStepThrough.cpp index 5e614e5aa52..7fb7538af3f 100644 --- a/lldb/source/Target/ThreadPlanStepThrough.cpp +++ b/lldb/source/Target/ThreadPlanStepThrough.cpp @@ -30,7 +30,7 @@ using namespace lldb_private; //---------------------------------------------------------------------- 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) { diff --git a/lldb/source/Target/ThreadPlanStepUntil.cpp b/lldb/source/Target/ThreadPlanStepUntil.cpp index 3f9cdb55047..d146b6ae5cd 100644 --- a/lldb/source/Target/ThreadPlanStepUntil.cpp +++ b/lldb/source/Target/ThreadPlanStepUntil.cpp @@ -38,7 +38,7 @@ ThreadPlanStepUntil::ThreadPlanStepUntil 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), |