v8/test/inspector/debugger/wasm-clone-module.js
Eric Leese a4e162f761 Remove fake wasm scripts from V8 backend
Inspector will no longer report per-function wasm scripts or
provide wasm disassembly. Locations in wasm are now consistently
reported through the inspector API as lineNumber=0
columnNumber=byte offset in module.

Bug: chromium:1013527, chromium:1003022
Change-Id: Ide85bbaa85ad75f29248ff82a3e7f3e40688d377
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1991481
Commit-Queue: Eric Leese <leese@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65660}
2020-01-09 13:21:01 +00:00

41 lines
1.2 KiB
JavaScript

// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
let {session, contextGroup, Protocol} =
InspectorTest.start('Tests that cloning a module notifies the debugger');
utils.load('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();
builder.addFunction('f', kSig_v_v).addBody([]).exportAs('f');
let moduleBytes = JSON.stringify(builder.toArray());
contextGroup.addScript(`
function test(moduleBytes) {
let wireBytes = new Uint8Array(moduleBytes);
let module = new WebAssembly.Module(wireBytes.buffer);
let serialized = %SerializeWasmModule(module);
let module2 = %DeserializeWasmModule(serialized, wireBytes);
let module3 = %CloneWasmModule(module);
}
`);
let scriptsSeen = 0;
Protocol.Debugger.onScriptParsed(msg => {
let url = msg.params.url;
if (url.startsWith('wasm://')) {
InspectorTest.log(`Got URL: ${url}`);
if (++scriptsSeen == 3) {
InspectorTest.log('Done!');
InspectorTest.completeTest();
}
}
});
Protocol.Debugger.enable();
Protocol.Runtime.evaluate({expression: `test(${moduleBytes});`});