Skip to content

Commit 2871699

Browse files
sstricklCommit Queue
authored andcommitted
[vm,dyn_modules] Fix stepping over when debugging the interpreter.
Since any instruction is a possible pause point when single stepping in the interpreter, the debugger may pause too early when stepping over an expression; for example, if the value returned from an expression is ignored, stepping over the expression should also step over the following Drop1 instruction (which will have the same source location), but currently does not. To avoid this, set last_stepping_fp_ and last_stepping_pos_ when stepping over either a sync or async expression so that the debugger won't pause until a new source position is reached. TEST=pkg/vm_service/test Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try Change-Id: I0934f6bda3fc075a225a85b66eccf46b94cb4020 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449420 Reviewed-by: Alexander Markov <[email protected]> Commit-Queue: Tess Strickland <[email protected]>
1 parent 6851655 commit 2871699

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

runtime/vm/debugger.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,6 +3091,16 @@ void Debugger::ResumptionBreakpoint() {
30913091
"ResumptionBreakpoint - hit a breakpoint, continue single "
30923092
"stepping\n");
30933093
}
3094+
#if defined(DART_DYNAMIC_MODULES)
3095+
if (top_frame->IsInterpreted()) {
3096+
// The interpreter calls the single step handler on every instruction,
3097+
// so set the last stepping fp/position to the current fp/position when
3098+
// stepping over so the debugger doesn't pause until it reaches
3099+
// a _new_ source position.
3100+
last_stepping_fp_ = top_frame->fp();
3101+
last_stepping_pos_ = top_frame->TokenPos();
3102+
}
3103+
#endif
30943104
EnterSingleStepMode();
30953105
return;
30963106
}
@@ -3416,6 +3426,12 @@ void Debugger::SetSyncSteppingFramePointer(DebuggerStackTrace* stack_trace) {
34163426
stepping_fp_ = frame->fp();
34173427
#if defined(DART_DYNAMIC_MODULES)
34183428
stepping_fp_from_interpreted_frame_ = frame->IsInterpreted();
3429+
// The interpreter calls the single step handler on every instruction,
3430+
// so set the last stepping fp/position to the current fp/position when
3431+
// stepping over so the debugger doesn't pause until it reaches
3432+
// a _new_ source position.
3433+
last_stepping_fp_ = frame->fp();
3434+
last_stepping_pos_ = frame->TokenPos();
34193435
#endif
34203436
} else {
34213437
stepping_fp_ = 0;

0 commit comments

Comments
 (0)