diff options
author | Jim Ingham <jingham@apple.com> | 2012-04-09 22:37:39 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2012-04-09 22:37:39 +0000 |
commit | cf274f910e3885035c278c4ea9df770678d3a8dd (patch) | |
tree | 337ed77a018d0bb913420cee1010fd9db1ea4dc8 | |
parent | 383fda29befaca805e04d8160ada6234a75d2ec4 (diff) | |
download | bcm5719-llvm-cf274f910e3885035c278c4ea9df770678d3a8dd.tar.gz bcm5719-llvm-cf274f910e3885035c278c4ea9df770678d3a8dd.zip |
Rework how master plans declare themselves. Also make "PlanIsBasePlan" not rely only on this being the bottom plan in the stack, but allow the plan to declare itself as such.
llvm-svn: 154351
-rw-r--r-- | lldb/include/lldb/Target/Thread.h | 8 | ||||
-rw-r--r-- | lldb/include/lldb/Target/ThreadPlan.h | 19 | ||||
-rw-r--r-- | lldb/include/lldb/Target/ThreadPlanBase.h | 13 | ||||
-rw-r--r-- | lldb/include/lldb/Target/ThreadPlanCallFunction.h | 6 | ||||
-rw-r--r-- | lldb/include/lldb/Target/ThreadPlanStepOverRange.h | 5 | ||||
-rw-r--r-- | lldb/include/lldb/Target/ThreadPlanStepUntil.h | 6 | ||||
-rw-r--r-- | lldb/source/Target/Thread.cpp | 13 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlan.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlanBase.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlanCallFunction.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlanStepOverRange.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlanStepUntil.cpp | 4 |
12 files changed, 55 insertions, 32 deletions
diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h index 7a11d027784..77eb0a8bfe6 100644 --- a/lldb/include/lldb/Target/Thread.h +++ b/lldb/include/lldb/Target/Thread.h @@ -587,12 +587,8 @@ public: private: bool - PlanIsBasePlan (ThreadPlan *plan_ptr) - { - if (m_plan_stack.size() == 0) - return false; - return m_plan_stack[0].get() == plan_ptr; - } + PlanIsBasePlan (ThreadPlan *plan_ptr); + public: //------------------------------------------------------------------ diff --git a/lldb/include/lldb/Target/ThreadPlan.h b/lldb/include/lldb/Target/ThreadPlan.h index a814c46ff03..090c473adf3 100644 --- a/lldb/include/lldb/Target/ThreadPlan.h +++ b/lldb/include/lldb/Target/ThreadPlan.h @@ -334,10 +334,18 @@ public: virtual bool WillStop () = 0; - virtual bool + bool IsMasterPlan() { - return false; + return m_is_master_plan; + } + + bool + SetIsMasterPlan (bool value) + { + bool old_value = m_is_master_plan; + m_is_master_plan = value; + return old_value; } virtual bool @@ -390,6 +398,12 @@ public: void SetPlanComplete (); + virtual bool + IsBasePlan() + { + return false; + } + lldb::ThreadPlanTracerSP & GetThreadPlanTracer() { @@ -474,6 +488,7 @@ private: bool m_plan_complete; bool m_plan_private; bool m_okay_to_discard; + bool m_is_master_plan; lldb::ThreadPlanTracerSP m_tracer_sp; diff --git a/lldb/include/lldb/Target/ThreadPlanBase.h b/lldb/include/lldb/Target/ThreadPlanBase.h index f89d1d68fe9..3e941f3b6df 100644 --- a/lldb/include/lldb/Target/ThreadPlanBase.h +++ b/lldb/include/lldb/Target/ThreadPlanBase.h @@ -14,6 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Target/Process.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" @@ -28,6 +29,7 @@ namespace lldb_private { class ThreadPlanBase : public ThreadPlan { +friend class Process; // RunThreadPlan manages "stopper" base plans. public: virtual ~ThreadPlanBase (); @@ -41,16 +43,17 @@ public: virtual bool MischiefManaged (); virtual bool WillResume (lldb::StateType resume_state, bool current_plan); - virtual bool IsMasterPlan() - { - return true; - } - virtual bool OkayToDiscard() { return false; } + virtual bool + IsBasePlan() + { + return true; + } + protected: ThreadPlanBase (Thread &thread); diff --git a/lldb/include/lldb/Target/ThreadPlanCallFunction.h b/lldb/include/lldb/Target/ThreadPlanCallFunction.h index dde1d6780fd..d4f3d3ef485 100644 --- a/lldb/include/lldb/Target/ThreadPlanCallFunction.h +++ b/lldb/include/lldb/Target/ThreadPlanCallFunction.h @@ -80,12 +80,6 @@ public: virtual bool MischiefManaged (); - virtual bool - IsMasterPlan() - { - return true; - } - // To get the return value from a function call you must create a // lldb::ValueSP that contains a valid clang type in its context and call // RequestReturnValue. The ValueSP will be stored and when the function is diff --git a/lldb/include/lldb/Target/ThreadPlanStepOverRange.h b/lldb/include/lldb/Target/ThreadPlanStepOverRange.h index 8190b81d14f..39b1414f27b 100644 --- a/lldb/include/lldb/Target/ThreadPlanStepOverRange.h +++ b/lldb/include/lldb/Target/ThreadPlanStepOverRange.h @@ -35,11 +35,6 @@ public: virtual void GetDescription (Stream *s, lldb::DescriptionLevel level); virtual bool ShouldStop (Event *event_ptr); - virtual bool - IsMasterPlan() - { - return true; - } protected: diff --git a/lldb/include/lldb/Target/ThreadPlanStepUntil.h b/lldb/include/lldb/Target/ThreadPlanStepUntil.h index 17002e47254..9f9d6db99a4 100644 --- a/lldb/include/lldb/Target/ThreadPlanStepUntil.h +++ b/lldb/include/lldb/Target/ThreadPlanStepUntil.h @@ -35,12 +35,6 @@ public: virtual bool WillStop (); virtual bool MischiefManaged (); - virtual bool - IsMasterPlan() - { - return true; - } - protected: ThreadPlanStepUntil (Thread &thread, lldb::addr_t *address_list, diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 6a86a3b435b..fe5c4295443 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -349,7 +349,7 @@ Thread::ShouldStop (Event* event_ptr) } else { - // If the current plan doesn't explain the stop, then, find one that + // If the current plan doesn't explain the stop, then find one that // does and let it handle the situation. ThreadPlan *plan_ptr = current_plan; while ((plan_ptr = GetPreviousPlan(plan_ptr)) != NULL) @@ -839,6 +839,17 @@ Thread::DiscardThreadPlans(bool force) } } +bool +Thread::PlanIsBasePlan (ThreadPlan *plan_ptr) +{ + if (plan_ptr->IsBasePlan()) + return true; + else if (m_plan_stack.size() == 0) + return false; + else + return m_plan_stack[0].get() == plan_ptr; +} + ThreadPlan * Thread::QueueFundamentalPlan (bool abort_other_plans) { diff --git a/lldb/source/Target/ThreadPlan.cpp b/lldb/source/Target/ThreadPlan.cpp index 8e9cb477447..5f396d94755 100644 --- a/lldb/source/Target/ThreadPlan.cpp +++ b/lldb/source/Target/ThreadPlan.cpp @@ -36,7 +36,8 @@ ThreadPlan::ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, Vo m_plan_complete_mutex (Mutex::eMutexTypeRecursive), m_plan_complete (false), m_plan_private (false), - m_okay_to_discard (false) + m_okay_to_discard (false), + m_is_master_plan (false) { SetID (GetNextID()); } diff --git a/lldb/source/Target/ThreadPlanBase.cpp b/lldb/source/Target/ThreadPlanBase.cpp index ebaa4dcf86f..fcb868302da 100644 --- a/lldb/source/Target/ThreadPlanBase.cpp +++ b/lldb/source/Target/ThreadPlanBase.cpp @@ -47,6 +47,7 @@ ThreadPlanBase::ThreadPlanBase (Thread &thread) : #endif new_tracer_sp->EnableTracing (m_thread.GetTraceEnabledState()); SetThreadPlanTracer(new_tracer_sp); + SetIsMasterPlan (true); } ThreadPlanBase::~ThreadPlanBase () diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 09bdd3d73c0..9f6c18e5bd8 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -52,6 +52,9 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, m_takedown_done (false), m_stop_address (LLDB_INVALID_ADDRESS) { + // Call function thread plans need to be master plans so that they can potentially stay on the stack when + // a breakpoint is hit during the function call. + SetIsMasterPlan (true); SetOkayToDiscard (discard_on_error); ProcessSP process_sp (thread.GetProcess()); @@ -172,6 +175,9 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, m_return_type (return_type), m_takedown_done (false) { + // Call function thread plans need to be master plans so that they can potentially stay on the stack when + // a breakpoint is hit during the function call. + SetIsMasterPlan (true); SetOkayToDiscard (discard_on_error); ProcessSP process_sp (thread.GetProcess()); diff --git a/lldb/source/Target/ThreadPlanStepOverRange.cpp b/lldb/source/Target/ThreadPlanStepOverRange.cpp index 54fe8ea62a8..c147e83b19e 100644 --- a/lldb/source/Target/ThreadPlanStepOverRange.cpp +++ b/lldb/source/Target/ThreadPlanStepOverRange.cpp @@ -43,6 +43,9 @@ ThreadPlanStepOverRange::ThreadPlanStepOverRange ) : ThreadPlanStepRange (ThreadPlan::eKindStepOverRange, "Step range stepping over", thread, range, addr_context, stop_others) { + // Step over range plans can be master plans, since you could hit a breakpoint while stepping over, step around + // a bit, then continue to finish up the step over. + SetIsMasterPlan (true); SetOkayToDiscard (okay_to_discard); } diff --git a/lldb/source/Target/ThreadPlanStepUntil.cpp b/lldb/source/Target/ThreadPlanStepUntil.cpp index 79c2544dfff..3c418f20aca 100644 --- a/lldb/source/Target/ThreadPlanStepUntil.cpp +++ b/lldb/source/Target/ThreadPlanStepUntil.cpp @@ -52,7 +52,11 @@ ThreadPlanStepUntil::ThreadPlanStepUntil m_stop_others (stop_others) { + // Step until plans can be master plans, since you could hit a breakpoint while stepping to the stop point, step around + // a bit, then continue to finish up the step until. + SetIsMasterPlan (true); SetOkayToDiscard(true); + // Stash away our "until" addresses: TargetSP target_sp (m_thread.CalculateTarget()); |