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