Commit 90099394 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[liftoff] Allow resuming execution after stepping

R=clemensb@chromium.org

Bug: v8:10321
Change-Id: Ia082b842de8947ead3931943b3bc05903a0f9e29
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2101002Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66704}
parent a0913c9d
......@@ -619,6 +619,7 @@ RUNTIME_FUNCTION(Runtime_WasmDebugBreak) {
const auto undefined = ReadOnlyRoots(isolate).undefined_value();
auto* debug_info = frame_finder.frame()->native_module()->GetDebugInfo();
if (debug_info->IsStepping(frame_finder.frame())) {
debug_info->ClearStepping();
isolate->debug()->OnDebugBreak(isolate->factory()->empty_fixed_array());
return undefined;
}
......
......@@ -684,10 +684,14 @@ class DebugInfoImpl {
isolate);
stepping_frame_ = frame->id();
}
stepping_ = true;
}
void ClearStepping() { stepping_ = false; }
bool IsStepping(WasmCompiledFrame* frame) {
return frame->id() == stepping_frame_;
DCHECK_IMPLIES(stepping_, stepping_frame_ != NO_ID);
return stepping_;
}
void RemoveDebugSideTables(Vector<WasmCode* const> codes) {
......@@ -788,6 +792,7 @@ class DebugInfoImpl {
// Store the frame ID when stepping, to avoid breaking in recursive calls of
// the same function.
StackFrameId stepping_frame_ = NO_ID;
bool stepping_ = false;
DISALLOW_COPY_AND_ASSIGN(DebugInfoImpl);
};
......@@ -813,6 +818,8 @@ void DebugInfo::SetBreakpoint(int func_index, int offset,
void DebugInfo::PrepareStep(Isolate* isolate) { impl_->PrepareStep(isolate); }
void DebugInfo::ClearStepping() { impl_->ClearStepping(); }
bool DebugInfo::IsStepping(WasmCompiledFrame* frame) {
return impl_->IsStepping(frame);
}
......
......@@ -149,6 +149,8 @@ class DebugInfo {
void PrepareStep(Isolate*);
void ClearStepping();
bool IsStepping(WasmCompiledFrame*);
void RemoveDebugSideTables(Vector<WasmCode* const>);
......
......@@ -10,6 +10,16 @@ Setting breakpoint on offset 59 (should be propagated to 60, the offset of the c
Paused at wasm://wasm/befe41aa:0:60
Debugger.stepOver called
Paused at wasm://wasm/befe41aa:0:62
Debugger.resume called
Paused at wasm://wasm/befe41aa:0:60
Debugger.stepOver called
Paused at wasm://wasm/befe41aa:0:62
Debugger.stepOver called
Paused at wasm://wasm/befe41aa:0:46
Debugger.resume called
Paused at wasm://wasm/befe41aa:0:60
Debugger.stepOver called
Paused at wasm://wasm/befe41aa:0:62
Debugger.stepOver called
Paused at wasm://wasm/befe41aa:0:46
Debugger.stepOver called
......@@ -27,4 +37,9 @@ Paused at wasm://wasm/befe41aa:0:57
Debugger.stepOver called
Paused at wasm://wasm/befe41aa:0:60
Debugger.stepOver called
Paused at wasm://wasm/befe41aa:0:62
Debugger.stepOver called
Paused at wasm://wasm/befe41aa:0:46
Debugger.resume called
exports.main returned!
Finished!
......@@ -75,8 +75,17 @@ function instantiate(bytes) {
const actualLocation = bpmsg.result.actualLocation;
InspectorTest.logMessage(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('stepOver'); // over call
await waitForPauseAndStep('stepOver'); // over br
await waitForPauseAndStep('resume'); // to next breakpoint (3rd iteration)
await waitForPauseAndStep('stepOver'); // over wasm_A
// Step over 10 times.
for (let i = 0; i < 10; ++i) await waitForPauseAndStep('stepOver');
// Then just resume.
await waitForPauseAndStep('resume');
InspectorTest.log('exports.main returned!');
InspectorTest.log('Finished!');
})().catch(reason => InspectorTest.log(`Failed: ${reason}`))
.finally(InspectorTest.completeTest);
......
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