mirror of
https://github.com/intel/llvm.git
synced 2026-01-14 03:50:17 +08:00
This commit reworks how the thread plan's ShouldStopHere mechanism works, so that it is useful not only
for customizing "step-in" behavior (e.g. step-in doesn't step into code with no debug info), but also the behavior of step-in/step-out and step-over when they step out of the frame they started in. I also added as a proof of concept of this reworking a mode for stepping where stepping out of a frame into a frame with no debug information will continue stepping out till it arrives at a frame that does have debug information. This is useful when you are debugging callback based code where the callbacks are separated from the code that initiated them by some library glue you don't care about, among other things. llvm-svn: 203747
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
using namespace lldb_private;
|
||||
using namespace lldb;
|
||||
|
||||
uint32_t ThreadPlanStepOverRange::s_default_flag_values = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// ThreadPlanStepOverRange: Step through a stack range, either stepping over or into
|
||||
@@ -42,11 +43,15 @@ ThreadPlanStepOverRange::ThreadPlanStepOverRange
|
||||
Thread &thread,
|
||||
const AddressRange &range,
|
||||
const SymbolContext &addr_context,
|
||||
lldb::RunMode stop_others
|
||||
lldb::RunMode stop_others,
|
||||
LazyBool step_out_avoids_code_without_debug_info
|
||||
) :
|
||||
ThreadPlanStepRange (ThreadPlan::eKindStepOverRange, "Step range stepping over", thread, range, addr_context, stop_others),
|
||||
ThreadPlanShouldStopHere (this),
|
||||
m_first_resume(true)
|
||||
{
|
||||
SetFlagsToDefault();
|
||||
SetupAvoidNoDebug(step_out_avoids_code_without_debug_info);
|
||||
}
|
||||
|
||||
ThreadPlanStepOverRange::~ThreadPlanStepOverRange ()
|
||||
@@ -65,6 +70,28 @@ ThreadPlanStepOverRange::GetDescription (Stream *s, lldb::DescriptionLevel level
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ThreadPlanStepOverRange::SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info)
|
||||
{
|
||||
bool avoid_nodebug = true;
|
||||
switch (step_out_avoids_code_without_debug_info)
|
||||
{
|
||||
case eLazyBoolYes:
|
||||
avoid_nodebug = true;
|
||||
break;
|
||||
case eLazyBoolNo:
|
||||
avoid_nodebug = false;
|
||||
break;
|
||||
case eLazyBoolCalculate:
|
||||
avoid_nodebug = m_thread.GetStepOutAvoidsNoDebug();
|
||||
break;
|
||||
}
|
||||
if (avoid_nodebug)
|
||||
GetFlags().Set (ThreadPlanShouldStopHere::eStepOutAvoidNoDebug);
|
||||
else
|
||||
GetFlags().Clear (ThreadPlanShouldStopHere::eStepOutAvoidNoDebug);
|
||||
}
|
||||
|
||||
bool
|
||||
ThreadPlanStepOverRange::IsEquivalentContext(const SymbolContext &context)
|
||||
{
|
||||
@@ -146,13 +173,13 @@ ThreadPlanStepOverRange::ShouldStop (Event *event_ptr)
|
||||
const SymbolContext &older_context = older_frame_sp->GetSymbolContext(eSymbolContextEverything);
|
||||
if (IsEquivalentContext(older_context))
|
||||
{
|
||||
new_plan_sp = m_thread.QueueThreadPlanForStepOut (false,
|
||||
NULL,
|
||||
true,
|
||||
stop_others,
|
||||
eVoteNo,
|
||||
eVoteNoOpinion,
|
||||
0);
|
||||
new_plan_sp = m_thread.QueueThreadPlanForStepOutNoShouldStop (false,
|
||||
NULL,
|
||||
true,
|
||||
stop_others,
|
||||
eVoteNo,
|
||||
eVoteNoOpinion,
|
||||
0);
|
||||
break;
|
||||
}
|
||||
else
|
||||
@@ -277,6 +304,13 @@ ThreadPlanStepOverRange::ShouldStop (Event *event_ptr)
|
||||
// If we get to this point, we're not going to use a previously set "next branch" breakpoint, so delete it:
|
||||
ClearNextBranchBreakpoint();
|
||||
|
||||
|
||||
// If we haven't figured out something to do yet, then ask the ShouldStopHere callback:
|
||||
if (!new_plan_sp)
|
||||
{
|
||||
new_plan_sp = CheckShouldStopHereAndQueueStepOut (frame_order);
|
||||
}
|
||||
|
||||
if (!new_plan_sp)
|
||||
m_no_more_plans = true;
|
||||
else
|
||||
@@ -390,3 +424,4 @@ ThreadPlanStepOverRange::DoWillResume (lldb::StateType resume_state, bool curren
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user