Commit 6f448efb authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[inspector] Make wasm tests fail rather than time out.

Consistently use InspectorTest.runAsyncTestSuite() in wasm inspector
tests to make tests easier to debug (they'll fail instead of timing
out in case of errors).

Bug: chromium:1162229, chromium:1071432
Change-Id: I7aada196f9e34071aa1bb059bb45f85f75226060
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2609414
Commit-Queue: Yang Guo <yangguo@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71908}
parent afd3f63e
Test that breakpoints do not survive a restart of the debugger. Test that breakpoints do not survive a restart of the debugger.
Running test: test
Instantiating. Instantiating.
Waiting for wasm script (ignoring first non-wasm script). Waiting for wasm script (ignoring first non-wasm script).
Setting breakpoint. Setting breakpoint.
...@@ -8,4 +10,3 @@ func returned. ...@@ -8,4 +10,3 @@ func returned.
Restarting debugger. Restarting debugger.
Calling func. Calling func.
func returned. func returned.
Finished.
...@@ -9,10 +9,8 @@ const {session, contextGroup, Protocol} = InspectorTest.start( ...@@ -9,10 +9,8 @@ const {session, contextGroup, Protocol} = InspectorTest.start(
session.setupScriptMap(); session.setupScriptMap();
const builder = new WasmModuleBuilder(); const builder = new WasmModuleBuilder();
const func = const func =
builder.addFunction('func', kSig_v_v).addBody([kExprNop]).exportFunc(); builder.addFunction('func', kSig_v_v).addBody([kExprNop]).exportFunc();
const module_bytes = builder.toArray(); const module_bytes = builder.toArray();
Protocol.Debugger.onPaused(async msg => { Protocol.Debugger.onPaused(async msg => {
...@@ -20,31 +18,31 @@ Protocol.Debugger.onPaused(async msg => { ...@@ -20,31 +18,31 @@ Protocol.Debugger.onPaused(async msg => {
Protocol.Debugger.resume(); Protocol.Debugger.resume();
}); });
(async function test() { InspectorTest.runAsyncTestSuite([
await Protocol.Debugger.enable(); async function test() {
InspectorTest.log('Instantiating.');
// Spawn asynchronously:
WasmInspectorTest.instantiate(module_bytes);
InspectorTest.log(
'Waiting for wasm script (ignoring first non-wasm script).');
const [, {params: wasm_script}] = await Protocol.Debugger.onceScriptParsed(2);
InspectorTest.log('Setting breakpoint.');
await Protocol.Debugger.setBreakpoint({
'location': {
'scriptId': wasm_script.scriptId,
'lineNumber': 0,
'columnNumber': func.body_offset
}
});
for (let run of [0, 1]) {
InspectorTest.log('Calling func.');
await Protocol.Runtime.evaluate({'expression': 'instance.exports.func()'});
InspectorTest.log('func returned.');
if (run == 1) continue;
InspectorTest.log('Restarting debugger.');
await Protocol.Debugger.disable();
await Protocol.Debugger.enable(); await Protocol.Debugger.enable();
InspectorTest.log('Instantiating.');
// Spawn asynchronously:
WasmInspectorTest.instantiate(module_bytes);
InspectorTest.log(
'Waiting for wasm script (ignoring first non-wasm script).');
const [, {params: wasm_script}] = await Protocol.Debugger.onceScriptParsed(2);
InspectorTest.log('Setting breakpoint.');
await Protocol.Debugger.setBreakpoint({
'location': {
'scriptId': wasm_script.scriptId,
'lineNumber': 0,
'columnNumber': func.body_offset
}
});
for (let run of [0, 1]) {
InspectorTest.log('Calling func.');
await Protocol.Runtime.evaluate({'expression': 'instance.exports.func()'});
InspectorTest.log('func returned.');
if (run == 1) continue;
InspectorTest.log('Restarting debugger.');
await Protocol.Debugger.disable();
await Protocol.Debugger.enable();
}
} }
InspectorTest.log('Finished.'); ]);
InspectorTest.completeTest();
})();
Tests debug command for wasm Tests debug command for wasm
Running test: test
Waiting for wasm scripts to be parsed. Waiting for wasm scripts to be parsed.
Ignoring script with url v8://test/instantiate Ignoring script with url v8://test/instantiate
Got wasm script: wasm://wasm/7d022e0e Got wasm script: wasm://wasm/7d022e0e
...@@ -6,4 +8,3 @@ paused No 1 ...@@ -6,4 +8,3 @@ paused No 1
Script wasm://wasm/7d022e0e byte offset 35: Wasm opcode 0x20 (kExprLocalGet) Script wasm://wasm/7d022e0e byte offset 35: Wasm opcode 0x20 (kExprLocalGet)
Debugger.resume Debugger.resume
exports.main returned! exports.main returned!
Finished!
...@@ -43,17 +43,17 @@ function test() { ...@@ -43,17 +43,17 @@ function test() {
} }
//# sourceURL=test.js`); //# sourceURL=test.js`);
(async function Test() { InspectorTest.runAsyncTestSuite([
breakCount = 0; async function test() {
breakpointId = 0; breakCount = 0;
await Protocol.Debugger.enable(); breakpointId = 0;
WasmInspectorTest.instantiate(module_bytes); await Protocol.Debugger.enable();
await waitForWasmScript(); WasmInspectorTest.instantiate(module_bytes);
await Protocol.Runtime.evaluate({ expression: 'test()', includeCommandLineAPI: true}); await waitForWasmScript();
InspectorTest.log('exports.main returned!'); await Protocol.Runtime.evaluate({ expression: 'test()', includeCommandLineAPI: true});
InspectorTest.log('Finished!'); InspectorTest.log('exports.main returned!');
InspectorTest.completeTest(); }
})(); ]);
function printFailure(message) { function printFailure(message) {
if (!message.result) { if (!message.result) {
......
...@@ -9,8 +9,8 @@ utils.load('test/inspector/wasm-inspector-test.js'); ...@@ -9,8 +9,8 @@ utils.load('test/inspector/wasm-inspector-test.js');
let {session, contextGroup, Protocol} = let {session, contextGroup, Protocol} =
InspectorTest.start('Test wasm scope information with externref globals'); InspectorTest.start('Test wasm scope information with externref globals');
(async function() { InspectorTest.runAsyncTestSuite([
try { async function test() {
let builder = new WasmModuleBuilder(); let builder = new WasmModuleBuilder();
builder.addImportedGlobal('m', 'global', kWasmExternRef, false); builder.addImportedGlobal('m', 'global', kWasmExternRef, false);
let func = builder.addFunction('func', kSig_v_v) let func = builder.addFunction('func', kSig_v_v)
...@@ -74,11 +74,5 @@ let {session, contextGroup, Protocol} = ...@@ -74,11 +74,5 @@ let {session, contextGroup, Protocol} =
InspectorTest.log(` ${prop.name}: {${values}}`); InspectorTest.log(` ${prop.name}: {${values}}`);
} }
} }
InspectorTest.log('Finished.');
} catch (exc) {
InspectorTest.log(`Failed with exception: ${exc}.`);
} finally {
InspectorTest.completeTest();
} }
})(); ]);
Tests breakable locations in wasm Tests breakable locations in wasm
Running test: test
Running testFunction... Running testFunction...
Script nr 0 parsed. URL: v8://test/instantiate Script nr 0 parsed. URL: v8://test/instantiate
Script nr 1 parsed. URL: wasm://wasm/354ada0e Script nr 1 parsed. URL: wasm://wasm/354ada0e
...@@ -73,4 +75,3 @@ Stopped at wasm://wasm/354ada0e:0:57 ...@@ -73,4 +75,3 @@ Stopped at wasm://wasm/354ada0e:0:57
Missing breakpoints: 1 Missing breakpoints: 1
Stopped at wasm://wasm/354ada0e:0:58 Stopped at wasm://wasm/354ada0e:0:58
Missing breakpoints: 0 Missing breakpoints: 0
Finished!
...@@ -35,23 +35,20 @@ var module_bytes = builder.toArray(); ...@@ -35,23 +35,20 @@ var module_bytes = builder.toArray();
Protocol.Debugger.enable(); Protocol.Debugger.enable();
Protocol.Debugger.onScriptParsed(handleScriptParsed); Protocol.Debugger.onScriptParsed(handleScriptParsed);
async function runTest() { InspectorTest.runAsyncTestSuite([
InspectorTest.log('Running testFunction...'); async function test() {
await WasmInspectorTest.instantiate(module_bytes); InspectorTest.log('Running testFunction...');
await getBreakableLocationsForAllWasmScripts(); await WasmInspectorTest.instantiate(module_bytes);
await setAllBreakableLocations(); await getBreakableLocationsForAllWasmScripts();
InspectorTest.log('Running wasm code...'); await setAllBreakableLocations();
// Begin executing code: InspectorTest.log('Running wasm code...');
var promise = WasmInspectorTest.evalWithUrl('instance.exports.main(1)', 'runWasm'); // Begin executing code:
await waitForAllPauses(); var promise = WasmInspectorTest.evalWithUrl('instance.exports.main(1)', 'runWasm');
// Code should now complete await waitForAllPauses();
await promise; // Code should now complete
InspectorTest.log('Finished!'); await promise;
} }
]);
runTest()
.catch(reason => InspectorTest.log(`Failed: ${reason}`))
.then(InspectorTest.completeTest);
var allBreakableLocations = []; var allBreakableLocations = [];
......
Test wasm global names Test wasm global names
Running test: test
Waiting for wasm script to be parsed. Waiting for wasm script to be parsed.
Setting breakpoint in wasm. Setting breakpoint in wasm.
Running main. Running main.
Paused in debugger. Paused in debugger.
globals: {"module_name.imported_global", "exported_global", "global2"} globals: {"module_name.imported_global", "exported_global", "global2"}
Finished.
...@@ -17,23 +17,13 @@ let func = builder.addFunction('func', kSig_v_i) ...@@ -17,23 +17,13 @@ let func = builder.addFunction('func', kSig_v_i)
.exportAs('main'); .exportAs('main');
var o = builder.addGlobal(kWasmI32, func).exportAs('exported_global'); var o = builder.addGlobal(kWasmI32, func).exportAs('exported_global');
builder.addGlobal(kWasmI32); // global2 builder.addGlobal(kWasmI32); // global2
let moduleBytes = JSON.stringify(builder.toArray()); let moduleBytes = builder.toArray();
function test(moduleBytes) { InspectorTest.runAsyncTestSuite([
let module = new WebAssembly.Module((new Uint8Array(moduleBytes)).buffer); async function test() {
let imported_global_value = 123;
instance = new WebAssembly.Instance(
module, {module_name: {imported_global: imported_global_value}});
}
(async function() {
try {
Protocol.Debugger.enable(); Protocol.Debugger.enable();
Protocol.Runtime.evaluate({ Protocol.Runtime.evaluate({
expression: ` expression: `var instance = (${WasmInspectorTest.instantiateFromBuffer})(${JSON.stringify(moduleBytes)}, {module_name: {imported_global: 123}});`
let instance;
${test.toString()}
test(${moduleBytes});`
}); });
InspectorTest.log('Waiting for wasm script to be parsed.'); InspectorTest.log('Waiting for wasm script to be parsed.');
...@@ -72,11 +62,5 @@ function test(moduleBytes) { ...@@ -72,11 +62,5 @@ function test(moduleBytes) {
InspectorTest.log(` ${prop.name}: {${values}}`); InspectorTest.log(` ${prop.name}: {${values}}`);
} }
} }
InspectorTest.log('Finished.');
} catch (exc) {
InspectorTest.log(`Failed with exception: ${exc}.`);
} finally {
InspectorTest.completeTest();
} }
})(); ]);
Test inspecting register values in Liftoff. Test inspecting register values in Liftoff.
Running test: test
Testing i32. Testing i32.
Waiting for wasm script. Waiting for wasm script.
Setting 20 breakpoints. Setting 20 breakpoints.
...@@ -99,4 +101,3 @@ Paused at offset 75; wasm-expression-stack: [0, 1, 44]; local: [0, 1, 2, 3, 4, 5 ...@@ -99,4 +101,3 @@ Paused at offset 75; wasm-expression-stack: [0, 1, 44]; local: [0, 1, 2, 3, 4, 5
Paused at offset 76; wasm-expression-stack: [0, 45]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Paused at offset 76; wasm-expression-stack: [0, 45]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Paused at offset 77; wasm-expression-stack: [45]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Paused at offset 77; wasm-expression-stack: [45]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
main returned. main returned.
Finished!
...@@ -88,11 +88,11 @@ async function testConfig(config) { ...@@ -88,11 +88,11 @@ async function testConfig(config) {
InspectorTest.log('main returned.'); InspectorTest.log('main returned.');
} }
(async function test() { InspectorTest.runAsyncTestSuite([
await Protocol.Debugger.enable(); async function test() {
for (let config in configs) { await Protocol.Debugger.enable();
await testConfig(config); for (let config in configs) {
await testConfig(config);
}
} }
InspectorTest.log('Finished!'); ]);
InspectorTest.completeTest();
})();
Test wasm memory names Test wasm memory names
Running test: test
Waiting for wasm script to be parsed. Waiting for wasm script to be parsed.
Setting breakpoint in wasm. Setting breakpoint in wasm.
Running main. Running main.
......
...@@ -102,17 +102,11 @@ contextGroup.addScript(` ...@@ -102,17 +102,11 @@ contextGroup.addScript(`
let instance; let instance;
${createInstance.toString()}`); ${createInstance.toString()}`);
(async function test() { InspectorTest.runAsyncTestSuite([
try { async function test() {
Protocol.Debugger.enable(); Protocol.Debugger.enable();
await check(createModuleBytesUnnamedMemory()); await check(createModuleBytesUnnamedMemory());
await check(createModuleBytesExportedMemory()); await check(createModuleBytesExportedMemory());
await check(createModuleBytesImportedMemory()); await check(createModuleBytesImportedMemory());
} catch (exc) {
InspectorTest.log(`Failed with exception: ${exc}.`);
} finally {
InspectorTest.completeTest();
} }
})(); ]);
Regress 10957 Regress 10957
Running test: testRegress10957
Instantiate Instantiate
Finished!
7 7
...@@ -53,18 +53,17 @@ function instantiate(bytes, imports) { ...@@ -53,18 +53,17 @@ function instantiate(bytes, imports) {
return new WebAssembly.Instance(module, imports); return new WebAssembly.Instance(module, imports);
} }
(async function Regress10957() { InspectorTest.runAsyncTestSuite([
await Protocol.Debugger.enable(); async function testRegress10957() {
InspectorTest.log('Instantiate'); await Protocol.Debugger.enable();
const code = InspectorTest.log('Instantiate');
`let instance = (${instantiate})(${JSON.stringify(module_bytes)}, {'imports': {'pause': () => { %ScheduleBreak() } }}); const code =
instance.exports.main(); `let instance = (${instantiate})(${JSON.stringify(module_bytes)}, {'imports': {'pause': () => { %ScheduleBreak() } }});
`; instance.exports.main();
Protocol.Runtime.evaluate({'expression': code}).then(message => `;
InspectorTest.logMessage(message.result.result.value)); Protocol.Runtime.evaluate({'expression': code}).then(message =>
await Protocol.Debugger.oncePaused(); InspectorTest.logMessage(message.result.result.value));
Protocol.Debugger.resume(); await Protocol.Debugger.oncePaused();
Protocol.Debugger.resume();
InspectorTest.log('Finished!'); }
InspectorTest.completeTest(); ]);
})();
Tests remove breakpoint from wasm scripts. Tests remove breakpoint from wasm scripts.
Running test: Test
Calling instantiate function. Calling instantiate function.
Waiting for wasm scripts to be parsed. Waiting for wasm scripts to be parsed.
Ignoring script with url v8://test/instantiate Ignoring script with url v8://test/instantiate
...@@ -14,4 +16,3 @@ Script wasm://wasm/7d022e0e byte offset 39: Wasm opcode 0x6b (kExprI32Sub) ...@@ -14,4 +16,3 @@ Script wasm://wasm/7d022e0e byte offset 39: Wasm opcode 0x6b (kExprI32Sub)
Remove breakpoint Remove breakpoint
Debugger.resume Debugger.resume
exports.main returned! exports.main returned!
Finished!
...@@ -46,24 +46,24 @@ function test() { ...@@ -46,24 +46,24 @@ function test() {
} }
//# sourceURL=test.js`); //# sourceURL=test.js`);
(async function Test() { InspectorTest.runAsyncTestSuite([
await Protocol.Debugger.enable(); async function Test() {
InspectorTest.log('Calling instantiate function.'); await Protocol.Debugger.enable();
WasmInspectorTest.instantiate(module_bytes); InspectorTest.log('Calling instantiate function.');
const scriptId = await waitForWasmScript(); WasmInspectorTest.instantiate(module_bytes);
InspectorTest.log( const scriptId = await waitForWasmScript();
'Setting breakpoint on line 3 of wasm function'); InspectorTest.log(
let msg = await Protocol.Debugger.setBreakpoint( 'Setting breakpoint on line 3 of wasm function');
{'location': {'scriptId': scriptId, 'lineNumber': 0, 'columnNumber': func.body_offset + 4}}); let msg = await Protocol.Debugger.setBreakpoint(
printFailure(msg); {'location': {'scriptId': scriptId, 'lineNumber': 0, 'columnNumber': func.body_offset + 4}});
InspectorTest.logMessage(msg.result.actualLocation); printFailure(msg);
breakpointId = msg.result.breakpointId; InspectorTest.logMessage(msg.result.actualLocation);
await Protocol.Runtime.evaluate({ expression: 'test()' }); breakpointId = msg.result.breakpointId;
await Protocol.Runtime.evaluate({ expression: 'test()' }); await Protocol.Runtime.evaluate({ expression: 'test()' });
InspectorTest.log('exports.main returned!'); await Protocol.Runtime.evaluate({ expression: 'test()' });
InspectorTest.log('Finished!'); InspectorTest.log('exports.main returned!');
InspectorTest.completeTest(); }
})(); ]);
function printFailure(message) { function printFailure(message) {
if (!message.result) { if (!message.result) {
......
Checks resetting context group with wasm. Checks resetting context group with wasm.
Running test: test
{ {
id : <messageId> id : <messageId>
result : { result : {
......
...@@ -30,21 +30,21 @@ let contextGroup2 = new InspectorTest.ContextGroup(); ...@@ -30,21 +30,21 @@ let contextGroup2 = new InspectorTest.ContextGroup();
let session2 = contextGroup2.connect(); let session2 = contextGroup2.connect();
session2.setupScriptMap(); session2.setupScriptMap();
(async function test() { InspectorTest.runAsyncTestSuite([
await session1.Protocol.Debugger.enable(); async function test() {
await session2.Protocol.Debugger.enable(); await session1.Protocol.Debugger.enable();
await session2.Protocol.Debugger.enable();
session1.Protocol.Runtime.evaluate({ session1.Protocol.Runtime.evaluate({
expression: `var instance = (${WasmInspectorTest.instantiateFromBuffer})(${JSON.stringify(module_bytes)})`}); expression: `var instance = (${WasmInspectorTest.instantiateFromBuffer})(${JSON.stringify(module_bytes)})`});
session2.Protocol.Runtime.evaluate({ session2.Protocol.Runtime.evaluate({
expression: `var instance = (${WasmInspectorTest.instantiateFromBuffer})(${JSON.stringify(module_bytes)})`}); expression: `var instance = (${WasmInspectorTest.instantiateFromBuffer})(${JSON.stringify(module_bytes)})`});
contextGroup2.reset(); contextGroup2.reset();
await session1.Protocol.Debugger.onceScriptParsed(2); await session1.Protocol.Debugger.onceScriptParsed(2);
InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: 'instance.exports.main(4)'})); InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: 'instance.exports.main(4)'}));
InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: 'instance.exports.main(5)'})); InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: 'instance.exports.main(5)'}));
}
InspectorTest.completeTest(); ]);
})();
Test retrieving scope information when pausing in wasm functions Test retrieving scope information when pausing in wasm functions
Running test: test
Calling instantiate function. Calling instantiate function.
Waiting for wasm script to be parsed. Waiting for wasm script to be parsed.
Got wasm script! Got wasm script!
......
Test retrieving scope information from compiled Liftoff frames Test retrieving scope information from compiled Liftoff frames
Running test: test
Calling instantiate function. Calling instantiate function.
Waiting for wasm script to be parsed. Waiting for wasm script to be parsed.
Got wasm script! Got wasm script!
......
...@@ -16,24 +16,25 @@ Protocol.Debugger.onPaused(printPauseLocationsAndContinue); ...@@ -16,24 +16,25 @@ Protocol.Debugger.onPaused(printPauseLocationsAndContinue);
let breakpointLocation = -1; let breakpointLocation = -1;
(async function test() { InspectorTest.runAsyncTestSuite([
// Instantiate wasm and wait for three wasm scripts for the three functions. async function test() {
instantiateWasm(); // Instantiate wasm and wait for three wasm scripts for the three functions.
let scriptIds = await waitForWasmScripts(); instantiateWasm();
let scriptIds = await waitForWasmScripts();
// Set a breakpoint.
InspectorTest.log( // Set a breakpoint.
'Setting breakpoint on line 2 (first instruction) of third function'); InspectorTest.log(
let breakpoint = await Protocol.Debugger.setBreakpoint( 'Setting breakpoint on line 2 (first instruction) of third function');
{'location': {'scriptId': scriptIds[0], 'lineNumber': 0, 'columnNumber': breakpointLocation}}); let breakpoint = await Protocol.Debugger.setBreakpoint(
printIfFailure(breakpoint); {'location': {'scriptId': scriptIds[0], 'lineNumber': 0, 'columnNumber': breakpointLocation}});
InspectorTest.logMessage(breakpoint.result.actualLocation); printIfFailure(breakpoint);
InspectorTest.logMessage(breakpoint.result.actualLocation);
// Now run the wasm code.
await WasmInspectorTest.evalWithUrl('instance.exports.main(42)', 'runWasm'); // Now run the wasm code.
InspectorTest.log('exports.main returned. Test finished.'); await WasmInspectorTest.evalWithUrl('instance.exports.main(42)', 'runWasm');
InspectorTest.completeTest(); InspectorTest.log('exports.main returned. Test finished.');
})(); }
]);
async function printPauseLocationsAndContinue(msg) { async function printPauseLocationsAndContinue(msg) {
let loc = msg.params.callFrames[0].location; let loc = msg.params.callFrames[0].location;
......
...@@ -16,29 +16,30 @@ Protocol.Debugger.onPaused(printPauseLocationsAndContinue); ...@@ -16,29 +16,30 @@ Protocol.Debugger.onPaused(printPauseLocationsAndContinue);
let breakpointLocation = undefined; // Will be set by {instantiateWasm}. let breakpointLocation = undefined; // Will be set by {instantiateWasm}.
(async function test() { InspectorTest.runAsyncTestSuite([
// Instantiate wasm and wait for three wasm scripts for the three functions. async function test() {
instantiateWasm(); // Instantiate wasm and wait for three wasm scripts for the three functions.
let scriptIds = await waitForWasmScripts(); instantiateWasm();
let scriptIds = await waitForWasmScripts();
// Set a breakpoint.
InspectorTest.log( // Set a breakpoint.
'Setting breakpoint on first instruction of second function'); InspectorTest.log(
let breakpoint = await Protocol.Debugger.setBreakpoint({ 'Setting breakpoint on first instruction of second function');
'location' : { let breakpoint = await Protocol.Debugger.setBreakpoint({
'scriptId' : scriptIds[0], 'location' : {
'lineNumber' : 0, 'scriptId' : scriptIds[0],
'columnNumber' : breakpointLocation 'lineNumber' : 0,
} 'columnNumber' : breakpointLocation
}); }
printIfFailure(breakpoint); });
InspectorTest.logMessage(breakpoint.result.actualLocation); printIfFailure(breakpoint);
InspectorTest.logMessage(breakpoint.result.actualLocation);
// Now run the wasm code.
await WasmInspectorTest.evalWithUrl('instance.exports.main(4)', 'runWasm'); // Now run the wasm code.
InspectorTest.log('exports.main returned. Test finished.'); await WasmInspectorTest.evalWithUrl('instance.exports.main(4)', 'runWasm');
InspectorTest.completeTest(); InspectorTest.log('exports.main returned. Test finished.');
})(); }
]);
async function printPauseLocationsAndContinue(msg) { async function printPauseLocationsAndContinue(msg) {
let loc = msg.params.callFrames[0].location; let loc = msg.params.callFrames[0].location;
......
Tests reported code offsets on wasm scripts Tests reported code offsets on wasm scripts
Running test: test
Wasm script parsed: ID 0, startColumn: 0, endColumn: 29, codeOffset: 0 Wasm script parsed: ID 0, startColumn: 0, endColumn: 29, codeOffset: 0
Wasm script parsed: ID 1, startColumn: 0, endColumn: 29, codeOffset: 0 Wasm script parsed: ID 1, startColumn: 0, endColumn: 29, codeOffset: 0
Wasm script parsed: ID 2, startColumn: 0, endColumn: 32, codeOffset: 31 Wasm script parsed: ID 2, startColumn: 0, endColumn: 32, codeOffset: 31
......
Tests reported code offsets on wasm scripts Tests reported code offsets on wasm scripts
Running test: test
Wasm script parsed: ID 0, startColumn: 0, endColumn: 29, codeOffset: 0 Wasm script parsed: ID 0, startColumn: 0, endColumn: 29, codeOffset: 0
Wasm script parsed: ID 1, startColumn: 0, endColumn: 29, codeOffset: 0 Wasm script parsed: ID 1, startColumn: 0, endColumn: 29, codeOffset: 0
Wasm script parsed: ID 2, startColumn: 0, endColumn: 32, codeOffset: 31 Wasm script parsed: ID 2, startColumn: 0, endColumn: 32, codeOffset: 31
......
...@@ -109,37 +109,37 @@ function compileAsync(bytes) { ...@@ -109,37 +109,37 @@ function compileAsync(bytes) {
contextGroup.addScript( contextGroup.addScript(
`${compileSync}${compileAsync}`, 0, 0, 'v8://test/compileFunctions'); `${compileSync}${compileAsync}`, 0, 0, 'v8://test/compileFunctions');
(async function test() { InspectorTest.runAsyncTestSuite([
Protocol.Debugger.enable(); async function test() {
let script_ids = new Map(); Protocol.Debugger.enable();
let generators = [ let script_ids = new Map();
createModuleWithNoCodeSection, createModuleWithEmptyCodeSection, let generators = [
createModuleWithFiveByteSectionLength, createModuleWithFiveBytePayload createModuleWithNoCodeSection, createModuleWithEmptyCodeSection,
]; createModuleWithFiveByteSectionLength, createModuleWithFiveBytePayload
for (let generator of generators) { ];
session.Protocol.Runtime.evaluate({ for (let generator of generators) {
'expression': ` session.Protocol.Runtime.evaluate({
compileSync([${generator()}]); 'expression': `
compileAsync([${generator()}]); compileSync([${generator()}]);
` compileAsync([${generator()}]);
}); `
});
// Wait for both wasm scripts to be there and print their information.
for (let wasm_scripts = 0; wasm_scripts < 2;) { // Wait for both wasm scripts to be there and print their information.
({params} = await Protocol.Debugger.onceScriptParsed()); for (let wasm_scripts = 0; wasm_scripts < 2;) {
if (!params.url.startsWith('wasm://')) continue; ({params} = await Protocol.Debugger.onceScriptParsed());
if (!script_ids.has(params.scriptId)) { if (!params.url.startsWith('wasm://')) continue;
script_ids.set(params.scriptId, script_ids.size); if (!script_ids.has(params.scriptId)) {
script_ids.set(params.scriptId, script_ids.size);
}
// Print script IDs to ensure that script are not deduplicated (via
// cache).
let stable_id = script_ids.get(params.scriptId);
InspectorTest.log(`Wasm script parsed: ID ${stable_id}, startColumn: ${
params.startColumn}, endColumn: ${params.endColumn}, codeOffset: ${
params.codeOffset}`);
++wasm_scripts;
} }
// Print script IDs to ensure that script are not deduplicated (via
// cache).
let stable_id = script_ids.get(params.scriptId);
InspectorTest.log(`Wasm script parsed: ID ${stable_id}, startColumn: ${
params.startColumn}, endColumn: ${params.endColumn}, codeOffset: ${
params.codeOffset}`);
++wasm_scripts;
} }
} }
]);
InspectorTest.completeTest();
})();
...@@ -107,37 +107,37 @@ function compileAsync(bytes) { ...@@ -107,37 +107,37 @@ function compileAsync(bytes) {
contextGroup.addScript( contextGroup.addScript(
`${compileSync}${compileAsync}`, 0, 0, 'v8://test/compileFunctions'); `${compileSync}${compileAsync}`, 0, 0, 'v8://test/compileFunctions');
(async function test() { InspectorTest.runAsyncTestSuite([
Protocol.Debugger.enable(); async function test() {
let script_ids = new Map(); Protocol.Debugger.enable();
let generators = [ let script_ids = new Map();
createModuleWithNoCodeSection, createModuleWithEmptyCodeSection, let generators = [
createModuleWithFiveByteSectionLength, createModuleWithFiveBytePayload createModuleWithNoCodeSection, createModuleWithEmptyCodeSection,
]; createModuleWithFiveByteSectionLength, createModuleWithFiveBytePayload
for (let generator of generators) { ];
session.Protocol.Runtime.evaluate({ for (let generator of generators) {
'expression': ` session.Protocol.Runtime.evaluate({
compileSync([${generator()}]); 'expression': `
compileAsync([${generator()}]); compileSync([${generator()}]);
` compileAsync([${generator()}]);
}); `
});
// Wait for both wasm scripts to be there and print their information.
for (let wasm_scripts = 0; wasm_scripts < 2;) { // Wait for both wasm scripts to be there and print their information.
({params} = await Protocol.Debugger.onceScriptParsed()); for (let wasm_scripts = 0; wasm_scripts < 2;) {
if (!params.url.startsWith('wasm://')) continue; ({params} = await Protocol.Debugger.onceScriptParsed());
if (!script_ids.has(params.scriptId)) { if (!params.url.startsWith('wasm://')) continue;
script_ids.set(params.scriptId, script_ids.size); if (!script_ids.has(params.scriptId)) {
script_ids.set(params.scriptId, script_ids.size);
}
// Print script IDs to ensure that script are not deduplicated (via
// cache).
let stable_id = script_ids.get(params.scriptId);
InspectorTest.log(`Wasm script parsed: ID ${stable_id}, startColumn: ${
params.startColumn}, endColumn: ${params.endColumn}, codeOffset: ${
params.codeOffset}`);
++wasm_scripts;
} }
// Print script IDs to ensure that script are not deduplicated (via
// cache).
let stable_id = script_ids.get(params.scriptId);
InspectorTest.log(`Wasm script parsed: ID ${stable_id}, startColumn: ${
params.startColumn}, endColumn: ${params.endColumn}, codeOffset: ${
params.codeOffset}`);
++wasm_scripts;
} }
} }
]);
InspectorTest.completeTest();
})();
Tests if breakpoint set is first breakable location Tests if breakpoint set is first breakable location
Running test: test
Running test function... Running test function...
Set breakpoint outside of any function: (0, 0). Set breakpoint outside of any function: (0, 0).
Setting breakpoint for id: 4 at 0, 0. Setting breakpoint for id: 4 at 0, 0.
...@@ -18,4 +20,3 @@ Set breakpoint at non-breakable location: (0, 42). ...@@ -18,4 +20,3 @@ Set breakpoint at non-breakable location: (0, 42).
Setting breakpoint for id: 4 at 0, 42. Setting breakpoint for id: 4 at 0, 42.
Location match for (0, 43). Location match for (0, 43).
Initial location is expected to be breakable: false. Initial location is expected to be breakable: false.
Finished!
\ No newline at end of file
...@@ -32,17 +32,14 @@ builder.addFunction('main', kSig_v_i) ...@@ -32,17 +32,14 @@ builder.addFunction('main', kSig_v_i)
var module_bytes = builder.toArray(); var module_bytes = builder.toArray();
Protocol.Debugger.enable(); Protocol.Debugger.enable();
runTest() InspectorTest.runAsyncTestSuite([
.catch(reason => InspectorTest.log(`Failed: ${reason}.`)) async function test() {
.then(InspectorTest.completeTest); InspectorTest.log('Running test function...');
WasmInspectorTest.instantiate(module_bytes);
async function runTest() { const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2);
InspectorTest.log('Running test function...'); await checkSetBreakpointForScript(wasmScript.scriptId);
WasmInspectorTest.instantiate(module_bytes); }
const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2); ]);
await checkSetBreakpointForScript(wasmScript.scriptId);
InspectorTest.log('Finished!');
}
function printFailure(message) { function printFailure(message) {
if (!message.result) { if (!message.result) {
......
Tests stepping through wasm scripts. Tests stepping through wasm scripts.
Running test: test
Instantiating. Instantiating.
Waiting for wasm script (ignoring first non-wasm script). Waiting for wasm script (ignoring first non-wasm script).
Setting breakpoint at offset 54 on script wasm://wasm/0c10a5fe Setting breakpoint at offset 54 on script wasm://wasm/0c10a5fe
...@@ -35,4 +37,3 @@ Breaking on byte offset 54 ...@@ -35,4 +37,3 @@ Breaking on byte offset 54
Breaking on byte offset 45 Breaking on byte offset 45
Breaking on byte offset 47 Breaking on byte offset 47
exports.main returned! exports.main returned!
Finished!
Tests stepping through wasm scripts. Tests stepping through wasm scripts.
Running test: test
Instantiating. Instantiating.
Waiting for wasm script (ignoring first non-wasm script). Waiting for wasm script (ignoring first non-wasm script).
Setting breakpoint at offset 38 on script wasm://wasm/0c10a5fe Setting breakpoint at offset 38 on script wasm://wasm/0c10a5fe
...@@ -425,4 +427,3 @@ at wasm_B (0:61): ...@@ -425,4 +427,3 @@ at wasm_B (0:61):
at (anonymous) (0:17): at (anonymous) (0:17):
-- skipped -- skipped
exports.main returned! exports.main returned!
Finished!
...@@ -84,21 +84,21 @@ Protocol.Debugger.onPaused(async msg => { ...@@ -84,21 +84,21 @@ Protocol.Debugger.onPaused(async msg => {
Protocol.Debugger.resume(); Protocol.Debugger.resume();
}); });
(async function test() { InspectorTest.runAsyncTestSuite([
await Protocol.Debugger.enable(); async function test() {
InspectorTest.log('Instantiating.'); await Protocol.Debugger.enable();
// Spawn asynchronously: InspectorTest.log('Instantiating.');
WasmInspectorTest.instantiate(module_bytes); // Spawn asynchronously:
InspectorTest.log( WasmInspectorTest.instantiate(module_bytes);
'Waiting for wasm script (ignoring first non-wasm script).'); InspectorTest.log(
// Ignore javascript and full module wasm script, get scripts for functions. 'Waiting for wasm script (ignoring first non-wasm script).');
const [, {params: wasm_script}] = await Protocol.Debugger.onceScriptParsed(2); // Ignore javascript and full module wasm script, get scripts for functions.
// Set a breakpoint in function A at offset 0. When the debugger hits this const [, {params: wasm_script}] = await Protocol.Debugger.onceScriptParsed(2);
// breakpoint, new ones will be added. // Set a breakpoint in function A at offset 0. When the debugger hits this
await setBreakpoint(func_a.body_offset, wasm_script.scriptId, wasm_script.url); // breakpoint, new ones will be added.
InspectorTest.log('Calling main(4)'); await setBreakpoint(func_a.body_offset, wasm_script.scriptId, wasm_script.url);
await WasmInspectorTest.evalWithUrl('instance.exports.main(4)', 'runWasm'); InspectorTest.log('Calling main(4)');
InspectorTest.log('exports.main returned!'); await WasmInspectorTest.evalWithUrl('instance.exports.main(4)', 'runWasm');
InspectorTest.log('Finished!'); InspectorTest.log('exports.main returned!');
InspectorTest.completeTest(); }
})(); ]);
...@@ -53,21 +53,21 @@ Protocol.Debugger.onPaused(pause_msg => { ...@@ -53,21 +53,21 @@ Protocol.Debugger.onPaused(pause_msg => {
Protocol.Debugger.resume(); Protocol.Debugger.resume();
}); });
(async function test() { InspectorTest.runAsyncTestSuite([
await Protocol.Debugger.enable(); async function test() {
InspectorTest.log('Instantiating.'); await Protocol.Debugger.enable();
// Spawn asynchronously: InspectorTest.log('Instantiating.');
WasmInspectorTest.instantiate(module_bytes); // Spawn asynchronously:
InspectorTest.log( WasmInspectorTest.instantiate(module_bytes);
'Waiting for wasm script (ignoring first non-wasm script).'); InspectorTest.log(
// Ignore javascript and full module wasm script, get scripts for functions. 'Waiting for wasm script (ignoring first non-wasm script).');
const [, {params: wasm_script}] = await Protocol.Debugger.onceScriptParsed(2); // Ignore javascript and full module wasm script, get scripts for functions.
for (offset of [11, 10, 8, 6, 2, 4]) { const [, {params: wasm_script}] = await Protocol.Debugger.onceScriptParsed(2);
await setBreakpoint(func_b.body_offset + offset, wasm_script); for (offset of [11, 10, 8, 6, 2, 4]) {
await setBreakpoint(func_b.body_offset + offset, wasm_script);
}
InspectorTest.log('Calling main(4)');
await WasmInspectorTest.evalWithUrl('instance.exports.main(4)', 'runWasm');
InspectorTest.log('exports.main returned!');
} }
InspectorTest.log('Calling main(4)'); ]);
await WasmInspectorTest.evalWithUrl('instance.exports.main(4)', 'runWasm');
InspectorTest.log('exports.main returned!');
InspectorTest.log('Finished!');
InspectorTest.completeTest();
})();
Tests pausing a running script and stepping Tests pausing a running script and stepping
Running test: testPauseAndStep
Instantiate Instantiate
Wait for script Wait for script
Got wasm script: wasm://wasm/c84b7cde Got wasm script: wasm://wasm/c84b7cde
...@@ -9,4 +11,3 @@ Paused at offset 62; wasm-expression-stack: []; local: [12] ...@@ -9,4 +11,3 @@ Paused at offset 62; wasm-expression-stack: []; local: [12]
Paused at offset 64; wasm-expression-stack: [12]; local: [12] Paused at offset 64; wasm-expression-stack: [12]; local: [12]
Paused at offset 66; wasm-expression-stack: [12, 1]; local: [12] Paused at offset 66; wasm-expression-stack: [12, 1]; local: [12]
Paused at offset 67; wasm-expression-stack: [13]; local: [12] Paused at offset 67; wasm-expression-stack: [13]; local: [12]
Finished!
...@@ -35,26 +35,26 @@ function instantiate(bytes, imports) { ...@@ -35,26 +35,26 @@ function instantiate(bytes, imports) {
return new WebAssembly.Instance(module, imports); return new WebAssembly.Instance(module, imports);
} }
(async function pauseAndStep() { InspectorTest.runAsyncTestSuite([
await Protocol.Debugger.enable(); async function testPauseAndStep() {
InspectorTest.log('Instantiate'); await Protocol.Debugger.enable();
const instantiate_code = `var instance = (${instantiate})(${JSON.stringify(module_bytes)}, {'imports': {'pause': () => { %ScheduleBreak() } }});`; InspectorTest.log('Instantiate');
WasmInspectorTest.evalWithUrl(instantiate_code, 'instantiate'); const instantiate_code = `var instance = (${instantiate})(${JSON.stringify(module_bytes)}, {'imports': {'pause': () => { %ScheduleBreak() } }});`;
InspectorTest.log('Wait for script'); WasmInspectorTest.evalWithUrl(instantiate_code, 'instantiate');
const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2); InspectorTest.log('Wait for script');
InspectorTest.log('Got wasm script: ' + wasmScript.url); const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2);
InspectorTest.log('Got wasm script: ' + wasmScript.url);
InspectorTest.log('Run'); InspectorTest.log('Run');
Protocol.Runtime.evaluate({expression: 'instance.exports.main()'}); Protocol.Runtime.evaluate({expression: 'instance.exports.main()'});
InspectorTest.log('Expecting to pause at ' + (f.body_offset - 1)); InspectorTest.log('Expecting to pause at ' + (f.body_offset - 1));
await waitForPauseAndStep('stepInto'); await waitForPauseAndStep('stepInto');
await waitForPauseAndStep('stepInto'); await waitForPauseAndStep('stepInto');
await waitForPauseAndStep('stepInto'); await waitForPauseAndStep('stepInto');
await waitForPauseAndStep('stepInto'); await waitForPauseAndStep('stepInto');
await waitForPauseAndStep('resume'); await waitForPauseAndStep('resume');
InspectorTest.log('Finished!'); }
InspectorTest.completeTest(); ]);
})();
async function waitForPauseAndStep(stepAction) { async function waitForPauseAndStep(stepAction) {
const msg = await Protocol.Debugger.oncePaused(); const msg = await Protocol.Debugger.oncePaused();
......
Test scope inspection and stepping after a trap. Test scope inspection and stepping after a trap.
Running test: test
Instantiating. Instantiating.
Calling div function. Calling div function.
Paused at: Paused at:
...@@ -61,4 +63,3 @@ Paused at: ...@@ -61,4 +63,3 @@ Paused at:
------------- -------------
-> resume -> resume
Finished.
...@@ -62,16 +62,16 @@ function call_div() { ...@@ -62,16 +62,16 @@ function call_div() {
contextGroup.addScript(call_div.toString()); contextGroup.addScript(call_div.toString());
(async function test() { InspectorTest.runAsyncTestSuite([
await Protocol.Debugger.enable(); async function test() {
await Protocol.Debugger.setPauseOnExceptions({state: 'all'}); await Protocol.Debugger.enable();
InspectorTest.log('Instantiating.'); await Protocol.Debugger.setPauseOnExceptions({state: 'all'});
await WasmInspectorTest.instantiate(module_bytes); InspectorTest.log('Instantiating.');
InspectorTest.log('Calling div function.'); await WasmInspectorTest.instantiate(module_bytes);
await Protocol.Runtime.evaluate({'expression': 'call_div()'}); InspectorTest.log('Calling div function.');
InspectorTest.log('Finished.'); await Protocol.Runtime.evaluate({'expression': 'call_div()'});
InspectorTest.completeTest(); }
})(); ]);
async function printLocalScope(frame) { async function printLocalScope(frame) {
InspectorTest.log(`scope at ${frame.functionName} (${ InspectorTest.log(`scope at ${frame.functionName} (${
......
Step into a function that starts with a non-breakable opcode (i.e. block), then step from there. See https://crbug.com/1137710. Step into a function that starts with a non-breakable opcode (i.e. block), then step from there. See https://crbug.com/1137710.
Running test: test
Setting up global instance variable. Setting up global instance variable.
Got wasm script: wasm://wasm/4658c40e Got wasm script: wasm://wasm/4658c40e
Setting breakpoint on offset 44 Setting breakpoint on offset 44
......
...@@ -21,34 +21,35 @@ var main = builder.addFunction('main', kSig_v_i) ...@@ -21,34 +21,35 @@ var main = builder.addFunction('main', kSig_v_i)
var module_bytes = builder.toArray(); var module_bytes = builder.toArray();
(async function test() { InspectorTest.runAsyncTestSuite([
InspectorTest.logProtocolCommandCalls('Debugger.stepInto'); async function test() {
InspectorTest.logProtocolCommandCalls('Debugger.resume'); InspectorTest.logProtocolCommandCalls('Debugger.stepInto');
InspectorTest.logProtocolCommandCalls('Debugger.resume');
await Protocol.Debugger.enable();
InspectorTest.log('Setting up global instance variable.'); await Protocol.Debugger.enable();
WasmInspectorTest.instantiate(module_bytes); InspectorTest.log('Setting up global instance variable.');
const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2); WasmInspectorTest.instantiate(module_bytes);
const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2);
InspectorTest.log(`Got wasm script: ${wasmScript.url}`);
InspectorTest.log(`Got wasm script: ${wasmScript.url}`);
// Set a breakpoint in 'main', at the call.
InspectorTest.log(`Setting breakpoint on offset ${main.body_offset}`); // Set a breakpoint in 'main', at the call.
await Protocol.Debugger.setBreakpoint({ InspectorTest.log(`Setting breakpoint on offset ${main.body_offset}`);
location: { await Protocol.Debugger.setBreakpoint({
scriptId: wasmScript.scriptId, location: {
lineNumber: 0, scriptId: wasmScript.scriptId,
columnNumber: main.body_offset lineNumber: 0,
columnNumber: main.body_offset
}
});
InspectorTest.log('Running main function.');
Protocol.Runtime.evaluate({ expression: 'instance.exports.main()' });
for (let action of ['stepInto', 'stepInto', 'resume']) {
const {params: {callFrames}} = await Protocol.Debugger.oncePaused();
await session.logSourceLocation(callFrames[0].location);
Protocol.Debugger[action]();
} }
}); InspectorTest.log('exports.main returned.');
InspectorTest.log('Running main function.');
Protocol.Runtime.evaluate({ expression: 'instance.exports.main()' });
for (let action of ['stepInto', 'stepInto', 'resume']) {
const {params: {callFrames}} = await Protocol.Debugger.oncePaused();
await session.logSourceLocation(callFrames[0].location);
Protocol.Debugger[action]();
} }
InspectorTest.log('exports.main returned.'); ]);
})().catch(reason => InspectorTest.log(`Failed: ${reason}`))
.finally(InspectorTest.completeTest);
Tests stepping through wasm scripts by byte offsets Tests stepping through wasm scripts by byte offsets
Running test: test
Setting up global instance variable. Setting up global instance variable.
Got wasm script: wasm://wasm/42af3c82 Got wasm script: wasm://wasm/42af3c82
Setting breakpoint on offset 72 (should be propagated to 73, the offset of the call), url wasm://wasm/42af3c82 Setting breakpoint on offset 72 (should be propagated to 73, the offset of the call), url wasm://wasm/42af3c82
...@@ -66,4 +68,3 @@ Removing breakpoint ...@@ -66,4 +68,3 @@ Removing breakpoint
Debugger.stepOver called Debugger.stepOver called
Script wasm://wasm/42af3c82 byte offset 95: Wasm opcode 0x20 (kExprLocalGet) Script wasm://wasm/42af3c82 byte offset 95: Wasm opcode 0x20 (kExprLocalGet)
Debugger.resume called Debugger.resume called
Finished!
Tests stepping from javascript into wasm Tests stepping from javascript into wasm
Running test: test
Calling instantiate function. Calling instantiate function.
Waiting for wasm scripts to be parsed. Waiting for wasm scripts to be parsed.
Ignoring script with url v8://test/instantiate Ignoring script with url v8://test/instantiate
...@@ -28,4 +30,3 @@ paused ...@@ -28,4 +30,3 @@ paused
Script wasm://wasm/7d022e0e byte offset 37: Wasm opcode 0x41 (kExprI32Const) Script wasm://wasm/7d022e0e byte offset 37: Wasm opcode 0x41 (kExprI32Const)
Debugger.resume Debugger.resume
exports.main returned! exports.main returned!
Finished!
...@@ -44,26 +44,26 @@ function test() { ...@@ -44,26 +44,26 @@ function test() {
} }
//# sourceURL=test.js`); //# sourceURL=test.js`);
(async function Test() { InspectorTest.runAsyncTestSuite([
await Protocol.Debugger.enable(); async function test() {
InspectorTest.log('Calling instantiate function.'); await Protocol.Debugger.enable();
WasmInspectorTest.instantiate(module_bytes); InspectorTest.log('Calling instantiate function.');
const scriptId = await waitForWasmScript(); WasmInspectorTest.instantiate(module_bytes);
InspectorTest.log('Setting breakpoint on i32.const'); const scriptId = await waitForWasmScript();
let msg = await Protocol.Debugger.setBreakpoint({ InspectorTest.log('Setting breakpoint on i32.const');
'location': { let msg = await Protocol.Debugger.setBreakpoint({
'scriptId': scriptId, 'location': {
'lineNumber': 0, 'scriptId': scriptId,
'columnNumber': 2 + func.body_offset 'lineNumber': 0,
} 'columnNumber': 2 + func.body_offset
}); }
printFailure(msg); });
InspectorTest.logMessage(msg.result.actualLocation); printFailure(msg);
await Protocol.Runtime.evaluate({expression: 'test()'}); InspectorTest.logMessage(msg.result.actualLocation);
InspectorTest.log('exports.main returned!'); await Protocol.Runtime.evaluate({expression: 'test()'});
InspectorTest.log('Finished!'); InspectorTest.log('exports.main returned!');
InspectorTest.completeTest(); }
})(); ]);
function printFailure(message) { function printFailure(message) {
if (!message.result) { if (!message.result) {
......
Tests that Liftoff does not merge opcodes while stepping Tests that Liftoff does not merge opcodes while stepping
Running test: test
Setting breakpoint at offset 33. Setting breakpoint at offset 33.
Paused at offset 33: [0] Paused at offset 33: [0]
Paused at offset 35: [0, 0] Paused at offset 35: [0, 0]
...@@ -11,4 +13,3 @@ Paused at offset 33: [13] ...@@ -11,4 +13,3 @@ Paused at offset 33: [13]
Paused at offset 35: [13, 13] Paused at offset 35: [13, 13]
Paused at offset 36: [13, 0] Paused at offset 36: [13, 0]
Paused at offset 38: [13] Paused at offset 38: [13]
Finished.
...@@ -21,25 +21,25 @@ let module_bytes = builder.toArray(); ...@@ -21,25 +21,25 @@ let module_bytes = builder.toArray();
let wasm_script_id = undefined; let wasm_script_id = undefined;
Protocol.Debugger.onPaused(printPauseLocationAndStep); Protocol.Debugger.onPaused(printPauseLocationAndStep);
(async function test() { InspectorTest.runAsyncTestSuite([
await Protocol.Debugger.enable(); async function test() {
WasmInspectorTest.instantiate(module_bytes); await Protocol.Debugger.enable();
[, {params: {scriptId: wasm_script_id}}] = await Protocol.Debugger.onceScriptParsed(2); WasmInspectorTest.instantiate(module_bytes);
[, {params: {scriptId: wasm_script_id}}] = await Protocol.Debugger.onceScriptParsed(2);
// Set a breakpoint at the beginning of 'fun'. // Set a breakpoint at the beginning of 'fun'.
const offset = fun.body_offset; const offset = fun.body_offset;
InspectorTest.log(`Setting breakpoint at offset ${offset}.`); InspectorTest.log(`Setting breakpoint at offset ${offset}.`);
let bpmsg = await Protocol.Debugger.setBreakpoint({ let bpmsg = await Protocol.Debugger.setBreakpoint({
location: {scriptId: wasm_script_id, lineNumber: 0, columnNumber: offset} location: {scriptId: wasm_script_id, lineNumber: 0, columnNumber: offset}
}); });
for (let value of [0, -1, 13]) { for (let value of [0, -1, 13]) {
await Protocol.Runtime.evaluate( await Protocol.Runtime.evaluate(
{expression: `instance.exports.fun(${value})`}); {expression: `instance.exports.fun(${value})`});
}
} }
InspectorTest.log('Finished.'); ]);
})().catch(reason => InspectorTest.log(`Failed: ${reason}`))
.finally(InspectorTest.completeTest);
async function printPauseLocationAndStep(msg) { async function printPauseLocationAndStep(msg) {
// If we are outside of wasm, continue. // If we are outside of wasm, continue.
......
Tests stepping out from javascript to a wasm caller Tests stepping out from javascript to a wasm caller
Running test: test
Instantiating. Instantiating.
Running exports.main. Running exports.main.
>>> First round >>> First round
......
...@@ -32,30 +32,30 @@ function pauseAlternating() { ...@@ -32,30 +32,30 @@ function pauseAlternating() {
} }
`); `);
(async function Test() { InspectorTest.runAsyncTestSuite([
await Protocol.Debugger.enable(); async function test() {
InspectorTest.log('Instantiating.'); await Protocol.Debugger.enable();
const instantiate_code = InspectorTest.log('Instantiating.');
`const instance = (${WasmInspectorTest.instantiateFromBuffer})(${ const instantiate_code =
JSON.stringify(module_bytes)}, {imp: {pause: pauseAlternating}});`; `const instance = (${WasmInspectorTest.instantiateFromBuffer})(${
WasmInspectorTest.evalWithUrl(instantiate_code, 'instantiate'); JSON.stringify(module_bytes)}, {imp: {pause: pauseAlternating}});`;
const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2); WasmInspectorTest.evalWithUrl(instantiate_code, 'instantiate');
const scriptId = wasmScript.scriptId; const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2);
const scriptId = wasmScript.scriptId;
InspectorTest.log('Running exports.main.');
InspectorTest.log('>>> First round'); InspectorTest.log('Running exports.main.');
await Protocol.Runtime.evaluate({expression: 'instance.exports.main()'}); InspectorTest.log('>>> First round');
InspectorTest.log('exports.main returned.'); await Protocol.Runtime.evaluate({expression: 'instance.exports.main()'});
InspectorTest.log('exports.main returned.');
InspectorTest.log('After stepping out of the last script, we should stop right at the beginning of the next script.');
InspectorTest.log('>>> Second round'); InspectorTest.log('After stepping out of the last script, we should stop right at the beginning of the next script.');
await Protocol.Runtime.evaluate({expression: 'instance.exports.main()'}); InspectorTest.log('>>> Second round');
InspectorTest.log('exports.main returned.'); await Protocol.Runtime.evaluate({expression: 'instance.exports.main()'});
InspectorTest.log('exports.main returned.');
InspectorTest.log('The next cycle should work as before (stopping at the "debugger" statement), after stopping at script entry.');
InspectorTest.log('>>> Third round'); InspectorTest.log('The next cycle should work as before (stopping at the "debugger" statement), after stopping at script entry.');
await Protocol.Runtime.evaluate({expression: 'instance.exports.main()'}); InspectorTest.log('>>> Third round');
InspectorTest.log('exports.main returned.'); await Protocol.Runtime.evaluate({expression: 'instance.exports.main()'});
InspectorTest.log('exports.main returned.');
InspectorTest.completeTest(); }
})(); ]);
Tests stepping to javascript from wasm Tests stepping to javascript from wasm
Running test: test
Calling instantiate function. Calling instantiate function.
Waiting for wasm scripts to be parsed. Waiting for wasm scripts to be parsed.
Ignoring script with url v8://test/instantiate Ignoring script with url v8://test/instantiate
......
...@@ -61,26 +61,27 @@ function test() { ...@@ -61,26 +61,27 @@ function test() {
} }
//# sourceURL=test.js`); //# sourceURL=test.js`);
(async function Test() { InspectorTest.runAsyncTestSuite([
await Protocol.Debugger.enable(); async function test() {
InspectorTest.log('Calling instantiate function.'); await Protocol.Debugger.enable();
WasmInspectorTest.instantiate(module_bytes); InspectorTest.log('Calling instantiate function.');
const scriptId = await waitForWasmScript(); WasmInspectorTest.instantiate(module_bytes);
InspectorTest.log( const scriptId = await waitForWasmScript();
'Setting breakpoint at start of wasm function'); InspectorTest.log(
let msg = await Protocol.Debugger.setBreakpoint( 'Setting breakpoint at start of wasm function');
{'location': {'scriptId': scriptId, 'lineNumber': 0, 'columnNumber': func.body_offset}}); let msg = await Protocol.Debugger.setBreakpoint(
printFailure(msg); {'location': {'scriptId': scriptId, 'lineNumber': 0, 'columnNumber': func.body_offset}});
InspectorTest.logMessage(msg.result.actualLocation); printFailure(msg);
InspectorTest.logMessage(msg.result.actualLocation);
for (var i=1; i<=3; i++) { for (var i=1; i<=3; i++) {
InspectorTest.log('Start run '+ i); InspectorTest.log('Start run '+ i);
await Protocol.Runtime.evaluate({ expression: 'test()' }); await Protocol.Runtime.evaluate({ expression: 'test()' });
InspectorTest.log('exports.main returned!'); InspectorTest.log('exports.main returned!');
InspectorTest.log('Finished run '+ i +'!\n'); InspectorTest.log('Finished run '+ i +'!\n');
}
} }
InspectorTest.completeTest(); ]);
})();
function printFailure(message) { function printFailure(message) {
if (!message.result) { if (!message.result) {
......
Tests stepping through wasm scripts by byte offsets Tests stepping through wasm scripts by byte offsets
Running test: test
Setting up global instance variable Setting up global instance variable
Got wasm script: wasm://wasm/befe41aa Got wasm script: wasm://wasm/befe41aa
{ {
...@@ -114,4 +116,3 @@ Input positions array is not sorted or contains duplicate values. ...@@ -114,4 +116,3 @@ Input positions array is not sorted or contains duplicate values.
Test: skip list is not sorted Test: skip list is not sorted
Testing stepInto with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":50},"end":{"lineNumber":0,"columnNumber":62}},{"scriptId":"4","start":{"lineNumber":0,"columnNumber":48},"end":{"lineNumber":0,"columnNumber":62}}] Testing stepInto with skipList: [{"scriptId":"4","start":{"lineNumber":0,"columnNumber":50},"end":{"lineNumber":0,"columnNumber":62}},{"scriptId":"4","start":{"lineNumber":0,"columnNumber":48},"end":{"lineNumber":0,"columnNumber":62}}]
Input positions array is not sorted or contains duplicate values. Input positions array is not sorted or contains duplicate values.
Finished!
...@@ -44,30 +44,26 @@ const call_function_offset = loop_body_start_offset + 12; ...@@ -44,30 +44,26 @@ const call_function_offset = loop_body_start_offset + 12;
const func_a_start_offset = func_a.body_offset; const func_a_start_offset = func_a.body_offset;
const func_a_end_offset = func_a_start_offset + 2; const func_a_end_offset = func_a_start_offset + 2;
runTest() InspectorTest.runAsyncTestSuite([
.catch(reason => InspectorTest.log(`Failed: ${reason}`)) async function test() {
.then(InspectorTest.completeTest); await Protocol.Debugger.enable();
InspectorTest.log('Setting up global instance variable');
async function runTest() { WasmInspectorTest.instantiate(module_bytes);
await Protocol.Debugger.enable(); const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2);
InspectorTest.log('Setting up global instance variable'); const scriptId = wasmScript.scriptId;
WasmInspectorTest.instantiate(module_bytes);
const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2); InspectorTest.log('Got wasm script: ' + wasmScript.url);
const scriptId = wasmScript.scriptId;
let bpmsg = await Protocol.Debugger.setBreakpoint({
InspectorTest.log('Got wasm script: ' + wasmScript.url); location:
{scriptId: scriptId, lineNumber: 0, columnNumber: loop_start_offset}
let bpmsg = await Protocol.Debugger.setBreakpoint({ });
location: InspectorTest.logMessage(bpmsg.result.actualLocation);
{scriptId: scriptId, lineNumber: 0, columnNumber: loop_start_offset}
}); await checkValidSkipLists(scriptId);
InspectorTest.logMessage(bpmsg.result.actualLocation); await checkInvalidSkipLists(scriptId);
}
await checkValidSkipLists(scriptId); ]);
await checkInvalidSkipLists(scriptId);
InspectorTest.log('Finished!');
}
async function checkValidSkipLists(scriptId) { async function checkValidSkipLists(scriptId) {
InspectorTest.log('Test with valid skip lists'); InspectorTest.log('Test with valid skip lists');
......
Tests stepping through wasm scripts with source maps Tests stepping through wasm scripts with source maps
Running test: test
Got wasm script: wasm://wasm/9b4bf87e Got wasm script: wasm://wasm/9b4bf87e
Script sourceMapURL: abc Script sourceMapURL: abc
Requesting source for wasm://wasm/9b4bf87e... Requesting source for wasm://wasm/9b4bf87e...
...@@ -328,4 +330,3 @@ at (anonymous) (0:17): ...@@ -328,4 +330,3 @@ at (anonymous) (0:17):
-- skipped -- skipped
Debugger.resume called Debugger.resume called
exports.main returned! exports.main returned!
Finished!
...@@ -36,47 +36,47 @@ builder.addCustomSection('sourceMappingURL', [3, 97, 98, 99]); ...@@ -36,47 +36,47 @@ builder.addCustomSection('sourceMappingURL', [3, 97, 98, 99]);
var module_bytes = builder.toArray(); var module_bytes = builder.toArray();
(async function test() { InspectorTest.runAsyncTestSuite([
for (const action of ['stepInto', 'stepOver', 'stepOut', 'resume']) async function test() {
InspectorTest.logProtocolCommandCalls('Debugger.' + action); for (const action of ['stepInto', 'stepOver', 'stepOut', 'resume'])
InspectorTest.logProtocolCommandCalls('Debugger.' + action);
await Protocol.Debugger.enable(); await Protocol.Debugger.enable();
WasmInspectorTest.instantiate(module_bytes); WasmInspectorTest.instantiate(module_bytes);
const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2); const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2);
InspectorTest.log('Got wasm script: ' + wasmScript.url); InspectorTest.log('Got wasm script: ' + wasmScript.url);
InspectorTest.log('Script sourceMapURL: ' + wasmScript.sourceMapURL); InspectorTest.log('Script sourceMapURL: ' + wasmScript.sourceMapURL);
InspectorTest.log('Requesting source for ' + wasmScript.url + '...'); InspectorTest.log('Requesting source for ' + wasmScript.url + '...');
const msg = const msg =
await Protocol.Debugger.getScriptSource({scriptId: wasmScript.scriptId}); await Protocol.Debugger.getScriptSource({scriptId: wasmScript.scriptId});
InspectorTest.log(`Source retrieved without error: ${!msg.error}`); InspectorTest.log(`Source retrieved without error: ${!msg.error}`);
InspectorTest.log( InspectorTest.log(
`Setting breakpoint on offset 54 (on the setlocal before the call), url ${wasmScript.url}`); `Setting breakpoint on offset 54 (on the setlocal before the call), url ${wasmScript.url}`);
const {result: {actualLocation}} = await Protocol.Debugger.setBreakpoint({ const {result: {actualLocation}} = await Protocol.Debugger.setBreakpoint({
location:{scriptId: wasmScript.scriptId, lineNumber: 0, columnNumber: 54}}); location:{scriptId: wasmScript.scriptId, lineNumber: 0, columnNumber: 54}});
InspectorTest.logMessage(actualLocation); InspectorTest.logMessage(actualLocation);
Protocol.Runtime.evaluate({expression: 'instance.exports.main(4)'}); Protocol.Runtime.evaluate({expression: 'instance.exports.main(4)'});
await waitForPauseAndStep('stepInto'); // == stepOver, to call instruction await waitForPauseAndStep('stepInto'); // == stepOver, to call instruction
await waitForPauseAndStep('stepInto'); // into call to wasm_A await waitForPauseAndStep('stepInto'); // into call to wasm_A
await waitForPauseAndStep('stepOver'); // over first nop await waitForPauseAndStep('stepOver'); // over first nop
await waitForPauseAndStep('stepOut'); // out of wasm_A await waitForPauseAndStep('stepOut'); // out of wasm_A
await waitForPauseAndStep('stepOut'); // out of wasm_B, stop on breakpoint again await waitForPauseAndStep('stepOut'); // out of wasm_B, stop on breakpoint again
await waitForPauseAndStep('stepOver'); // to call await waitForPauseAndStep('stepOver'); // to call
await waitForPauseAndStep('stepOver'); // over call await waitForPauseAndStep('stepOver'); // over call
await waitForPauseAndStep('resume'); // to next breakpoint (third iteration) await waitForPauseAndStep('resume'); // to next breakpoint (third iteration)
await waitForPauseAndStep('stepInto'); // to call await waitForPauseAndStep('stepInto'); // to call
await waitForPauseAndStep('stepInto'); // into wasm_A await waitForPauseAndStep('stepInto'); // into wasm_A
await waitForPauseAndStep('stepOut'); // out to wasm_B await waitForPauseAndStep('stepOut'); // out to wasm_B
// Now step 8 times, until we are in wasm_A again. // Now step 8 times, until we are in wasm_A again.
for (let i = 0; i < 8; ++i) await waitForPauseAndStep('stepInto'); for (let i = 0; i < 8; ++i) await waitForPauseAndStep('stepInto');
// 3 more times, back to wasm_B. // 3 more times, back to wasm_B.
for (let i = 0; i < 3; ++i) await waitForPauseAndStep('stepInto'); for (let i = 0; i < 3; ++i) await waitForPauseAndStep('stepInto');
// then just resume. // then just resume.
await waitForPauseAndStep('resume'); await waitForPauseAndStep('resume');
InspectorTest.log('exports.main returned!'); InspectorTest.log('exports.main returned!');
InspectorTest.log('Finished!'); }
InspectorTest.completeTest(); ]);
})();
async function waitForPauseAndStep(stepAction) { async function waitForPauseAndStep(stepAction) {
const {params: {callFrames}} = await Protocol.Debugger.oncePaused(); const {params: {callFrames}} = await Protocol.Debugger.oncePaused();
......
...@@ -54,69 +54,69 @@ let fact = builder.addFunction('fact', kSig_i_i) ...@@ -54,69 +54,69 @@ let fact = builder.addFunction('fact', kSig_i_i)
var module_bytes = builder.toArray(); var module_bytes = builder.toArray();
(async function test() { InspectorTest.runAsyncTestSuite([
for (const action of ['stepInto', 'stepOver', 'stepOut', 'resume']) async function test() {
InspectorTest.logProtocolCommandCalls('Debugger.' + action); for (const action of ['stepInto', 'stepOver', 'stepOut', 'resume'])
InspectorTest.logProtocolCommandCalls('Debugger.' + action);
await Protocol.Debugger.enable();
InspectorTest.log('Setting up global instance variable.'); await Protocol.Debugger.enable();
WasmInspectorTest.instantiate(module_bytes); InspectorTest.log('Setting up global instance variable.');
const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2); WasmInspectorTest.instantiate(module_bytes);
const [, {params: wasmScript}] = await Protocol.Debugger.onceScriptParsed(2);
InspectorTest.log('Got wasm script: ' + wasmScript.url);
InspectorTest.log('Got wasm script: ' + wasmScript.url);
// Set the breakpoint on a non-breakable position. This should resolve to the
// next instruction. // Set the breakpoint on a non-breakable position. This should resolve to the
var offset = func_b.body_offset + 15; // next instruction.
InspectorTest.log( var offset = func_b.body_offset + 15;
`Setting breakpoint on offset ` + offset + ` (should be propagated to ` + InspectorTest.log(
(offset + 1) + `, the offset of the call), url ${wasmScript.url}`); `Setting breakpoint on offset ` + offset + ` (should be propagated to ` +
let bpmsg = await Protocol.Debugger.setBreakpoint({ (offset + 1) + `, the offset of the call), url ${wasmScript.url}`);
location: {scriptId: wasmScript.scriptId, lineNumber: 0, columnNumber: offset} let bpmsg = await Protocol.Debugger.setBreakpoint({
}); location: {scriptId: wasmScript.scriptId, lineNumber: 0, columnNumber: offset}
});
InspectorTest.logMessage(bpmsg.result.actualLocation);
Protocol.Runtime.evaluate({ expression: 'instance.exports.main(4)' }); InspectorTest.logMessage(bpmsg.result.actualLocation);
await waitForPauseAndStep('stepInto'); // into call to wasm_A Protocol.Runtime.evaluate({ expression: 'instance.exports.main(4)' });
await waitForPauseAndStep('stepOver'); // over first nop await waitForPauseAndStep('stepInto'); // into call to wasm_A
await waitForPauseAndStep('stepOut'); // out of wasm_A await waitForPauseAndStep('stepOver'); // over first nop
await waitForPauseAndStep('stepOut'); // out of wasm_B, stop on breakpoint await waitForPauseAndStep('stepOut'); // out of wasm_A
await waitForPauseAndStep('stepOver'); // over call await waitForPauseAndStep('stepOut'); // out of wasm_B, stop on breakpoint
await waitForPauseAndStep('stepInto'); // == stepOver br await waitForPauseAndStep('stepOver'); // over call
await waitForPauseAndStep('resume'); // to next breakpoint (3rd iteration) await waitForPauseAndStep('stepInto'); // == stepOver br
await waitForPauseAndStep('stepInto'); // into wasm_A await waitForPauseAndStep('resume'); // to next breakpoint (3rd iteration)
await waitForPauseAndStep('stepOut'); // out to wasm_B await waitForPauseAndStep('stepInto'); // into wasm_A
// Now step 10 times, until we are in wasm_A again. await waitForPauseAndStep('stepOut'); // out to wasm_B
for (let i = 0; i < 10; ++i) await waitForPauseAndStep('stepInto'); // Now step 10 times, until we are in wasm_A again.
// 3 more times, back to wasm_B. for (let i = 0; i < 10; ++i) await waitForPauseAndStep('stepInto');
for (let i = 0; i < 3; ++i) await waitForPauseAndStep('stepInto'); // 3 more times, back to wasm_B.
// Then just resume. for (let i = 0; i < 3; ++i) await waitForPauseAndStep('stepInto');
await waitForPauseAndStep('resume'); // Then just resume.
InspectorTest.log('exports.main returned!'); await waitForPauseAndStep('resume');
InspectorTest.log('exports.main returned!');
InspectorTest.log('Test stepping over a recursive call');
// Set a breakpoint at the recursive call and run. InspectorTest.log('Test stepping over a recursive call');
offset = fact.body_offset + 9; // Offset of the recursive call instruction. // Set a breakpoint at the recursive call and run.
InspectorTest.log( offset = fact.body_offset + 9; // Offset of the recursive call instruction.
`Setting breakpoint on the recursive call instruction @+` + offset + InspectorTest.log(
`, url ${wasmScript.url}`); `Setting breakpoint on the recursive call instruction @+` + offset +
bpmsg = await Protocol.Debugger.setBreakpoint({ `, url ${wasmScript.url}`);
location: {scriptId: wasmScript.scriptId, lineNumber: 0, columnNumber: offset} bpmsg = await Protocol.Debugger.setBreakpoint({
}); location: {scriptId: wasmScript.scriptId, lineNumber: 0, columnNumber: offset}
actualLocation = bpmsg.result.actualLocation; });
InspectorTest.logMessage(actualLocation); actualLocation = bpmsg.result.actualLocation;
Protocol.Runtime.evaluate({ expression: 'instance.exports.fact(4)' }); InspectorTest.logMessage(actualLocation);
await waitForPause(); Protocol.Runtime.evaluate({ expression: 'instance.exports.fact(4)' });
await waitForPause();
// Remove the breakpoint before stepping over.
InspectorTest.log('Removing breakpoint'); // Remove the breakpoint before stepping over.
let breakpointId = bpmsg.result.breakpointId; InspectorTest.log('Removing breakpoint');
await Protocol.Debugger.removeBreakpoint({breakpointId}); let breakpointId = bpmsg.result.breakpointId;
await Protocol.Debugger.stepOver(); await Protocol.Debugger.removeBreakpoint({breakpointId});
await waitForPauseAndStep('resume'); await Protocol.Debugger.stepOver();
InspectorTest.log('Finished!'); await waitForPauseAndStep('resume');
})().catch(reason => InspectorTest.log(`Failed: ${reason}`)) }
.finally(InspectorTest.completeTest); ]);
async function waitForPauseAndStep(stepAction) { async function waitForPauseAndStep(stepAction) {
await waitForPause(); await waitForPause();
......
Tests unnamed function in wasm scripts Tests unnamed function in wasm scripts
Running test: test
Running testFunction with generated wasm bytes... Running testFunction with generated wasm bytes...
Paused on 'debugger;' Paused on 'debugger;'
Number of frames: 5 Number of frames: 5
...@@ -7,4 +9,3 @@ Number of frames: 5 ...@@ -7,4 +9,3 @@ Number of frames: 5
- [2] main - [2] main
- [3] testFunction - [3] testFunction
- [4] - [4]
Finished!
...@@ -43,16 +43,15 @@ function testFunction(bytes) { ...@@ -43,16 +43,15 @@ function testFunction(bytes) {
contextGroup.addScript(testFunction.toString()); contextGroup.addScript(testFunction.toString());
(async function test() { InspectorTest.runAsyncTestSuite([
await Protocol.Debugger.enable(); async function test() {
Protocol.Debugger.onPaused(handleDebuggerPaused); await Protocol.Debugger.enable();
InspectorTest.log('Running testFunction with generated wasm bytes...'); Protocol.Debugger.onPaused(handleDebuggerPaused);
await Protocol.Runtime.evaluate( InspectorTest.log('Running testFunction with generated wasm bytes...');
{'expression': 'testFunction(' + JSON.stringify(module_bytes) + ')'}); await Protocol.Runtime.evaluate(
{'expression': 'testFunction(' + JSON.stringify(module_bytes) + ')'});
InspectorTest.log('Finished!'); }
InspectorTest.completeTest(); ]);
})();
function logStackTrace(messageObject) { function logStackTrace(messageObject) {
var frames = messageObject.params.callFrames; var frames = messageObject.params.callFrames;
......
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