[Lldb-commits] [lldb] r204087 - Get "ThreadPlanShouldStopHere" to handle auto-stepping through line number 0 code.
Jim Ingham
jingham at apple.com
Mon Mar 17 16:03:34 PDT 2014
Author: jingham
Date: Mon Mar 17 18:03:34 2014
New Revision: 204087
URL: http://llvm.org/viewvc/llvm-project?rev=204087&view=rev
Log:
Get "ThreadPlanShouldStopHere" to handle auto-stepping through line number 0 code.
Modified:
lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp
Modified: lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp?rev=204087&r1=204086&r2=204087&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp Mon Mar 17 18:03:34 2014
@@ -76,6 +76,9 @@ ThreadPlanShouldStopHere::DefaultShouldS
{
bool should_stop_here = true;
StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get();
+ if (!frame)
+ return true;
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if ((operation == eFrameCompareOlder && flags.Test(eStepOutAvoidNoDebug))
@@ -90,6 +93,17 @@ ThreadPlanShouldStopHere::DefaultShouldS
}
}
+ // Always avoid code with line number 0.
+ // FIXME: At present the ShouldStop and the StepFromHere calculate this independently. If this ever
+ // becomes expensive (this one isn't) we can try to have this set a state that the StepFromHere can use.
+ if (frame)
+ {
+ SymbolContext sc;
+ sc = frame->GetSymbolContext (eSymbolContextLineEntry);
+ if (sc.line_entry.line == 0)
+ should_stop_here = false;
+ }
+
return should_stop_here;
}
@@ -99,16 +113,35 @@ ThreadPlanShouldStopHere::DefaultStepFro
FrameComparison operation,
void *baton)
{
- const bool stop_others = false;
- const size_t frame_index = 0;
- ThreadPlanSP return_plan_sp = current_plan->GetThread().QueueThreadPlanForStepOutNoShouldStop (false,
- NULL,
- true,
- stop_others,
- eVoteNo,
- eVoteNoOpinion,
- frame_index);
+ const bool stop_others = false;
+ const size_t frame_index = 0;
+ ThreadPlanSP return_plan_sp;
+ // If we are stepping through code at line number 0, then we need to step over this range. Otherwise
+ // we will step out.
+ StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get();
+ if (!frame)
return return_plan_sp;
+ SymbolContext sc;
+ sc = frame->GetSymbolContext (eSymbolContextLineEntry);
+ if (sc.line_entry.line == 0)
+ {
+ AddressRange range = sc.line_entry.range;
+ return_plan_sp = current_plan->GetThread().QueueThreadPlanForStepOverRange(false,
+ range,
+ sc,
+ eOnlyDuringStepping,
+ eLazyBoolNo);
+ }
+
+ if (!return_plan_sp)
+ return_plan_sp = current_plan->GetThread().QueueThreadPlanForStepOutNoShouldStop (false,
+ NULL,
+ true,
+ stop_others,
+ eVoteNo,
+ eVoteNoOpinion,
+ frame_index);
+ return return_plan_sp;
}
ThreadPlanSP
More information about the lldb-commits
mailing list