diff options
author | Jim Ingham <jingham@apple.com> | 2016-05-06 23:44:10 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2016-05-06 23:44:10 +0000 |
commit | 9b8eb155d8a47344fd2b60d4a74bb427703d8ab8 (patch) | |
tree | 2a0642855a068b0c67de73307f4eb177ec157a78 | |
parent | 1ed1aeaa94061a9007df291e44a4407958d54223 (diff) | |
download | bcm5719-llvm-9b8eb155d8a47344fd2b60d4a74bb427703d8ab8.tar.gz bcm5719-llvm-9b8eb155d8a47344fd2b60d4a74bb427703d8ab8.zip |
Fix the way the ShouldStopHere checker handles the general case of "stepping through line 0 code".
That's good 'cause it means all the different kinds of source line stepping won't leave user in the middle of
compiler implementation code or code inlined from odd places, etc. But it turns out that the compiler
also marks functions it MIGHT inline as all being of line 0. That would mean we single step through this code
instead of just stepping out. That is both inefficient, and more error prone 'cause these little nuggets tend
to be bits of hand-written assembly and the like and are hard to step through.
This change just checks and if the entire function is marked with line 0, we step out rather than step through.
<rdar://problem/25966460>
llvm-svn: 268823
-rw-r--r-- | lldb/source/Target/ThreadPlanShouldStopHere.cpp | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/lldb/source/Target/ThreadPlanShouldStopHere.cpp b/lldb/source/Target/ThreadPlanShouldStopHere.cpp index 55aaaf00b56..bc77c6eaaff 100644 --- a/lldb/source/Target/ThreadPlanShouldStopHere.cpp +++ b/lldb/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) |