forked from OSchip/llvm-project
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
This commit is contained in:
parent
383fda29be
commit
cf274f910e
|
@ -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:
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ ThreadPlanBase::ThreadPlanBase (Thread &thread) :
|
|||
#endif
|
||||
new_tracer_sp->EnableTracing (m_thread.GetTraceEnabledState());
|
||||
SetThreadPlanTracer(new_tracer_sp);
|
||||
SetIsMasterPlan (true);
|
||||
}
|
||||
|
||||
ThreadPlanBase::~ThreadPlanBase ()
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
Loading…
Reference in New Issue