Commit 28d2cb1f authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[liftoff][debug] Implement StepOut

R=clemensb@chromium.org

Bug: v8:10321
Change-Id: I318d46fa638c1d6f4d5d347e5aa0ad1faf02d5e2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2120532
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66855}
parent 33306c4e
......@@ -709,16 +709,23 @@ class DebugInfoImpl {
DCHECK(!it.done());
DCHECK(it.frame()->is_wasm_compiled());
WasmCompiledFrame* frame = WasmCompiledFrame::cast(it.frame());
StepAction step_action = isolate->debug()->last_step_action();
// If we are at a return instruction, then any stepping action is equivalent
// to StepOut, and we need to flood the parent function.
if (IsAtReturn(frame)) {
if (IsAtReturn(frame) || step_action == StepOut) {
it.Advance();
if (it.done() || !it.frame()->is_wasm_compiled()) return;
frame = WasmCompiledFrame::cast(it.frame());
}
if (static_cast<int>(frame->function_index()) != flooded_function_index_) {
if (flooded_function_index_ != -1) {
std::vector<int>& breakpoints =
breakpoints_per_function_[flooded_function_index_];
RecompileLiftoffWithBreakpoints(flooded_function_index_,
VectorOf(breakpoints), isolate);
}
FloodWithBreakpoints(frame->function_index(), isolate);
flooded_function_index_ = frame->function_index();
}
......
......@@ -8,9 +8,13 @@ Setting breakpoint on offset 72 (should be propagated to 73, the offset of the c
scriptId : <scriptId>
}
Paused at wasm://wasm/42af3c82:0:73
Debugger.stepInto called
Paused at wasm://wasm/42af3c82:0:52
Debugger.stepOver called
Paused at wasm://wasm/42af3c82:0:53
Debugger.stepOut called
Paused at wasm://wasm/42af3c82:0:75
Debugger.resume called
Debugger.stepOut called
Paused at wasm://wasm/42af3c82:0:73
Debugger.stepOver called
Paused at wasm://wasm/42af3c82:0:75
......@@ -20,11 +24,7 @@ Debugger.resume called
Paused at wasm://wasm/42af3c82:0:73
Debugger.stepInto called
Paused at wasm://wasm/42af3c82:0:52
Debugger.stepOver called
Paused at wasm://wasm/42af3c82:0:53
Debugger.stepOver called
Paused at wasm://wasm/42af3c82:0:54
Debugger.stepOver called
Debugger.stepOut called
Paused at wasm://wasm/42af3c82:0:75
Debugger.stepInto called
Paused at wasm://wasm/42af3c82:0:59
......
......@@ -93,15 +93,15 @@ function instantiate(bytes) {
InspectorTest.logMessage(bpmsg.result.actualLocation);
Protocol.Runtime.evaluate({ expression: 'instance.exports.main(4)' });
await waitForPauseAndStep('stepOver'); // over call to wasm_A
await waitForPauseAndStep('resume'); // stop on breakpoint
await waitForPauseAndStep('stepInto'); // into call to wasm_A
await waitForPauseAndStep('stepOver'); // over first nop
await waitForPauseAndStep('stepOut'); // out of wasm_A
await waitForPauseAndStep('stepOut'); // out of wasm_B, stop on breakpoint
await waitForPauseAndStep('stepOver'); // over call
await waitForPauseAndStep('stepInto'); // == stepOver br
await waitForPauseAndStep('resume'); // to next breakpoint (3rd iteration)
await waitForPauseAndStep('stepInto'); // into wasm_A
// Step out of wasm_A, back to wasm_B.
// TODO(clemensb/thibaudm): Replace by an actual 'stepOut'.
for (let i = 0; i < 3; ++i) await waitForPauseAndStep('stepOver');
await waitForPauseAndStep('stepOut'); // out to wasm_B
// Now step 10 times, until we are in wasm_A again.
for (let i = 0; i < 10; ++i) await waitForPauseAndStep('stepInto');
// 3 more times, back to wasm_B.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment