[wasm][test] Consolidate stepping tests
Stepping always happens in Liftoff now, and always by byte offset. Thus remove the redundant "wasm-stepping-byte-offset" test, which was fully subsumed by "wasm-stepping-liftoff". Also, rename "wasm-stepping-liftoff" to "wasm-stepping". R=thibaudm@chromium.org Bug: chromium:1137710 Change-Id: Ifb68ce795ecdcbb1f85500dc4be4c2e64d15a9c6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2474116 Reviewed-by: Thibaud Michaud <thibaudm@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/master@{#70528}
This commit is contained in:
parent
86facf07b2
commit
b47c42e3ab
@ -1,317 +0,0 @@
|
||||
Tests stepping through wasm scripts by byte offsets
|
||||
Setting up global instance variable.
|
||||
Got wasm script: wasm://wasm/befe41aa
|
||||
Setting breakpoint on offset 59 (should be propagated to 60, the offset of the call), url wasm://wasm/befe41aa
|
||||
{
|
||||
columnNumber : 60
|
||||
lineNumber : 0
|
||||
scriptId : <scriptId>
|
||||
}
|
||||
Script wasm://wasm/befe41aa byte offset 60: Wasm opcode 0x10
|
||||
at wasm_B (0:60):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":3}
|
||||
- scope (wasm-expression-stack):
|
||||
{"0":1024}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 39: Wasm opcode 0x01
|
||||
at wasm_A (0:39):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1024}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at wasm_B (0:60):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":3}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepOver called
|
||||
Script wasm://wasm/befe41aa byte offset 40: Wasm opcode 0x01
|
||||
at wasm_A (0:40):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1024}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at wasm_B (0:60):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":3}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepOut called
|
||||
Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c
|
||||
at wasm_B (0:62):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":3}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepOut called
|
||||
Script wasm://wasm/befe41aa byte offset 60: Wasm opcode 0x10
|
||||
at wasm_B (0:60):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":2}
|
||||
- scope (wasm-expression-stack):
|
||||
{"0":1024}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepOver called
|
||||
Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c
|
||||
at wasm_B (0:62):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":2}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 46: Wasm opcode 0x20
|
||||
at wasm_B (0:46):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":2}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.resume called
|
||||
Script wasm://wasm/befe41aa byte offset 60: Wasm opcode 0x10
|
||||
at wasm_B (0:60):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1}
|
||||
- scope (wasm-expression-stack):
|
||||
{"0":1024}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 39: Wasm opcode 0x01
|
||||
at wasm_A (0:39):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1024}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at wasm_B (0:60):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepOut called
|
||||
Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c
|
||||
at wasm_B (0:62):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 46: Wasm opcode 0x20
|
||||
at wasm_B (0:46):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 48: Wasm opcode 0x04
|
||||
at wasm_B (0:48):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1}
|
||||
- scope (wasm-expression-stack):
|
||||
{"0":1}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 50: Wasm opcode 0x20
|
||||
at wasm_B (0:50):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 52: Wasm opcode 0x41
|
||||
at wasm_B (0:52):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1}
|
||||
- scope (wasm-expression-stack):
|
||||
{"0":1}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 54: Wasm opcode 0x6b
|
||||
at wasm_B (0:54):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1}
|
||||
- scope (wasm-expression-stack):
|
||||
{"0":1,"1":1}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 55: Wasm opcode 0x21
|
||||
at wasm_B (0:55):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1}
|
||||
- scope (wasm-expression-stack):
|
||||
{"0":0}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 57: Wasm opcode 0x41
|
||||
at wasm_B (0:57):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":0}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 60: Wasm opcode 0x10
|
||||
at wasm_B (0:60):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":0}
|
||||
- scope (wasm-expression-stack):
|
||||
{"0":1024}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 39: Wasm opcode 0x01
|
||||
at wasm_A (0:39):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1024}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at wasm_B (0:60):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":0}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 40: Wasm opcode 0x01
|
||||
at wasm_A (0:40):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1024}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at wasm_B (0:60):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":0}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 41: Wasm opcode 0x0b
|
||||
at wasm_A (0:41):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":1024}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at wasm_B (0:60):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":0}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.stepInto called
|
||||
Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c
|
||||
at wasm_B (0:62):
|
||||
- scope (module):
|
||||
-- skipped
|
||||
- scope (local):
|
||||
{"var0":0}
|
||||
- scope (wasm-expression-stack):
|
||||
{}
|
||||
at (anonymous) (0:17):
|
||||
- scope (global):
|
||||
-- skipped
|
||||
Debugger.resume called
|
||||
exports.main returned!
|
||||
Finished!
|
@ -1,106 +0,0 @@
|
||||
// Copyright 2019 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
utils.load('test/inspector/wasm-inspector-test.js');
|
||||
|
||||
let {session, contextGroup, Protocol} =
|
||||
InspectorTest.start('Tests stepping through wasm scripts by byte offsets');
|
||||
session.setupScriptMap();
|
||||
|
||||
var builder = new WasmModuleBuilder();
|
||||
|
||||
var func_a_idx =
|
||||
builder.addFunction('wasm_A', kSig_v_i).addBody([kExprNop, kExprNop]).index;
|
||||
|
||||
// wasm_B calls wasm_A <param0> times.
|
||||
builder.addFunction('wasm_B', kSig_v_i)
|
||||
.addBody([
|
||||
// clang-format off
|
||||
kExprLoop, kWasmStmt, // while
|
||||
kExprLocalGet, 0, // -
|
||||
kExprIf, kWasmStmt, // if <param0> != 0
|
||||
kExprLocalGet, 0, // -
|
||||
kExprI32Const, 1, // -
|
||||
kExprI32Sub, // -
|
||||
kExprLocalSet, 0, // decrease <param0>
|
||||
...wasmI32Const(1024), // some longer i32 const (2 byte imm)
|
||||
kExprCallFunction, func_a_idx, // -
|
||||
kExprBr, 1, // continue
|
||||
kExprEnd, // -
|
||||
kExprEnd, // break
|
||||
// clang-format on
|
||||
])
|
||||
.exportAs('main');
|
||||
|
||||
|
||||
var module_bytes = builder.toArray();
|
||||
|
||||
(async function test() {
|
||||
for (const action of ['stepInto', 'stepOver', 'stepOut', 'resume'])
|
||||
InspectorTest.logProtocolCommandCalls('Debugger.' + action);
|
||||
|
||||
await Protocol.Debugger.enable();
|
||||
InspectorTest.log('Setting up global instance variable.');
|
||||
WasmInspectorTest.instantiate(module_bytes);
|
||||
const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2);
|
||||
|
||||
InspectorTest.log('Got wasm script: ' + wasmScript.url);
|
||||
|
||||
// Set the breakpoint on a non-breakable position. This should resolve to the
|
||||
// next instruction.
|
||||
InspectorTest.log(
|
||||
`Setting breakpoint on offset 59 (should be propagated to 60, the ` +
|
||||
`offset of the call), url ${wasmScript.url}`);
|
||||
const bpmsg = await Protocol.Debugger.setBreakpoint({
|
||||
location: {scriptId: wasmScript.scriptId, lineNumber: 0, columnNumber: 59}
|
||||
});
|
||||
|
||||
const actualLocation = bpmsg.result.actualLocation;
|
||||
InspectorTest.logMessage(actualLocation);
|
||||
Protocol.Runtime.evaluate({ expression: 'instance.exports.main(4)' });
|
||||
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
|
||||
await waitForPauseAndStep('stepOut'); // out to wasm_B
|
||||
// Now step 9 times, until we are in wasm_A again.
|
||||
for (let i = 0; i < 9; ++i) await waitForPauseAndStep('stepInto');
|
||||
// 3 more times, back to wasm_B.
|
||||
for (let i = 0; i < 3; ++i) await waitForPauseAndStep('stepInto');
|
||||
// Then just resume.
|
||||
await waitForPauseAndStep('resume');
|
||||
InspectorTest.log('exports.main returned!');
|
||||
InspectorTest.log('Finished!');
|
||||
})().catch(reason => InspectorTest.log(`Failed: ${reason}`))
|
||||
.finally(InspectorTest.completeTest);
|
||||
|
||||
async function waitForPauseAndStep(stepAction) {
|
||||
const {params: {callFrames}} = await Protocol.Debugger.oncePaused();
|
||||
await session.logSourceLocation(callFrames[0].location);
|
||||
for (var frame of callFrames) {
|
||||
const functionName = frame.functionName || '(anonymous)';
|
||||
const lineNumber = frame.location.lineNumber;
|
||||
const columnNumber = frame.location.columnNumber;
|
||||
InspectorTest.log(`at ${functionName} (${lineNumber}:${columnNumber}):`);
|
||||
for (var scope of frame.scopeChain) {
|
||||
InspectorTest.logObject(' - scope (' + scope.type + '):');
|
||||
if (scope.type === 'module' || scope.type === 'global') {
|
||||
InspectorTest.logObject(' -- skipped');
|
||||
} else {
|
||||
const {result: {result: {value}}} =
|
||||
await Protocol.Runtime.callFunctionOn({
|
||||
objectId: scope.object.objectId,
|
||||
functionDeclaration: 'function() { return this; }',
|
||||
returnByValue: true
|
||||
});
|
||||
InspectorTest.log(` ${JSON.stringify(value)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
Protocol.Debugger[stepAction]();
|
||||
}
|
Loading…
Reference in New Issue
Block a user