Commit 17af2b71 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm][debug] Test instrumentation breakpoint with source map

This tests the 'beforeScriptWithSourceMapExecution' mode of
setInstrumentationBreakpoint for wasm.

R=bmeurer@chromium.org

Bug: chromium:1151211
Change-Id: I3020ab3e67e090407e2641a105c513e7614aa305
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2764342
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73490}
parent 5bf07566
......@@ -53,3 +53,19 @@ 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.
Running test: testBreakOnlyWithSourceMap
Setting instrumentation breakpoint for source maps only
{
id : <messageId>
result : {
breakpointId : <breakpointId>
}
}
Instantiating wasm module without source map.
Calling exported function 'func' (should trigger no breakpoint).
Instantiating wasm module with source map.
Calling exported function 'func' (should trigger a breakpoint).
Paused at wasm://wasm/c8e3a856 with reason "instrumentation".
Script wasm://wasm/c8e3a856 byte offset 33: Wasm opcode 0x01 (kExprNop)
Done.
......@@ -18,8 +18,6 @@ Protocol.Debugger.onPaused(async msg => {
Protocol.Debugger.resume();
});
// TODO(clemensb): Add test for 'beforeScriptWithSourceMapExecution'.
InspectorTest.runAsyncTestSuite([
async function testBreakInStartFunction() {
const builder = new WasmModuleBuilder();
......@@ -88,4 +86,34 @@ InspectorTest.runAsyncTestSuite([
await Protocol.Debugger.disable();
},
async function testBreakOnlyWithSourceMap() {
const builder = new WasmModuleBuilder();
const func =
builder.addFunction('func', kSig_v_v).addBody([kExprNop]).exportFunc();
const bytes_no_source_map = builder.toArray();
builder.addCustomSection('sourceMappingURL', [3, 97, 98, 99]);
const bytes_with_source_map = builder.toArray();
await Protocol.Debugger.enable();
InspectorTest.log(
'Setting instrumentation breakpoint for source maps only');
InspectorTest.logMessage(
await Protocol.Debugger.setInstrumentationBreakpoint(
{instrumentation: 'beforeScriptWithSourceMapExecution'}));
InspectorTest.log('Instantiating wasm module without source map.');
await WasmInspectorTest.instantiate(bytes_no_source_map);
InspectorTest.log(
'Calling exported function \'func\' (should trigger no breakpoint).');
await WasmInspectorTest.evalWithUrl('instance.exports.func()', 'call_func');
InspectorTest.log('Instantiating wasm module with source map.');
await WasmInspectorTest.instantiate(bytes_with_source_map);
InspectorTest.log(
'Calling exported function \'func\' (should trigger a 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