Commit 49c33100 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm][debug] Test instrumentation breakpoints w/o start function

Add a test for a module without a start function; in that case, we want
to break when first calling into the module (via an exported function).

R=bmeurer@chromium.org

Bug: chromium:1151211
Change-Id: Id14978b5feff4dcd64cff828951f2a00b73c9736
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2763880Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73440}
parent 6dc2dbbb
......@@ -35,3 +35,21 @@ Paused at v8://test/instantiate with reason "instrumentation".
Paused at wasm://wasm/20da547a with reason "instrumentation".
Script wasm://wasm/20da547a byte offset 26: Wasm opcode 0x01 (kExprNop)
Done.
Running test: testBreakInExportedFunction
Setting instrumentation breakpoint
{
id : <messageId>
result : {
breakpointId : <breakpointId>
}
}
Instantiating wasm module.
Paused at v8://test/instantiate with reason "instrumentation".
Calling exported function 'func' (should trigger a breakpoint).
Paused at v8://test/call_func with reason "instrumentation".
Paused at wasm://wasm/8c388106 with reason "instrumentation".
Script wasm://wasm/8c388106 byte offset 33: Wasm opcode 0x01 (kExprNop)
Calling exported function 'func' a second time (should trigger no breakpoint).
Paused at v8://test/call_func with reason "instrumentation".
Done.
......@@ -19,7 +19,6 @@ Protocol.Debugger.onPaused(async msg => {
});
// TODO(clemensb): Add test for 'beforeScriptWithSourceMapExecution'.
// TODO(clemensb): Add test for module without start function.
InspectorTest.runAsyncTestSuite([
async function testBreakInStartFunction() {
......@@ -64,5 +63,29 @@ InspectorTest.runAsyncTestSuite([
await WasmInspectorTest.instantiate(builder.toArray());
InspectorTest.log('Done.');
await Protocol.Debugger.disable();
}
},
async function testBreakInExportedFunction() {
const builder = new WasmModuleBuilder();
const func =
builder.addFunction('func', kSig_v_v).addBody([kExprNop]).exportFunc();
await Protocol.Debugger.enable();
InspectorTest.log('Setting instrumentation breakpoint');
InspectorTest.logMessage(
await Protocol.Debugger.setInstrumentationBreakpoint(
{instrumentation: 'beforeScriptExecution'}));
InspectorTest.log('Instantiating wasm module.');
await WasmInspectorTest.instantiate(builder.toArray());
InspectorTest.log(
'Calling exported function \'func\' (should trigger a breakpoint).');
await WasmInspectorTest.evalWithUrl('instance.exports.func()', 'call_func');
InspectorTest.log(
'Calling exported function \'func\' a second time ' +
'(should trigger no breakpoint).');
await WasmInspectorTest.evalWithUrl('instance.exports.func()', 'call_func');
InspectorTest.log('Done.');
await Protocol.Debugger.disable();
},
]);
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