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 /lldb/source/Target | |
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
Diffstat (limited to 'lldb/source/Target')
-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 |
6 files changed, 28 insertions, 2 deletions
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()); |