diff options
Diffstat (limited to 'source/Target/ThreadPlanShouldStopHere.cpp')
-rw-r--r-- | source/Target/ThreadPlanShouldStopHere.cpp | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/source/Target/ThreadPlanShouldStopHere.cpp b/source/Target/ThreadPlanShouldStopHere.cpp index 55aaaf00b569..fcbc7f01c901 100644 --- a/source/Target/ThreadPlanShouldStopHere.cpp +++ b/source/Target/ThreadPlanShouldStopHere.cpp @@ -11,10 +11,11 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Core/Log.h" +#include "lldb/Symbol/Symbol.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanShouldStopHere.h" -#include "lldb/Core/Log.h" using namespace lldb; using namespace lldb_private; @@ -113,19 +114,45 @@ ThreadPlanShouldStopHere::DefaultStepFromHereCallback (ThreadPlan *current_plan, 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. + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); + StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get(); if (!frame) return return_plan_sp; SymbolContext sc; - sc = frame->GetSymbolContext (eSymbolContextLineEntry); + sc = frame->GetSymbolContext (eSymbolContextLineEntry|eSymbolContextSymbol); + 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 the whole function is marked line 0 just step out, that's easier & faster than continuing + // to step through it. + bool just_step_out = false; + if (sc.symbol && sc.symbol->ValueIsAddress()) + { + Address symbol_end = sc.symbol->GetAddress(); + symbol_end.Slide(sc.symbol->GetByteSize() - 1); + if (range.ContainsFileAddress(sc.symbol->GetAddress()) && range.ContainsFileAddress(symbol_end)) + { + if (log) + log->Printf("Stopped in a function with only line 0 lines, just stepping out."); + just_step_out = true; + } + } + if (!just_step_out) + { + if (log) + log->Printf ("ThreadPlanShouldStopHere::DefaultStepFromHereCallback Queueing StepInRange plan to step through line 0 code."); + + return_plan_sp = current_plan->GetThread().QueueThreadPlanForStepInRange(false, + range, + sc, + NULL, + eOnlyDuringStepping, + eLazyBoolCalculate, + eLazyBoolNo); + } } if (!return_plan_sp) |