2018-11-06 21:42:48 +00:00
|
|
|
// Copyright 2018 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.
|
|
|
|
|
2020-06-16 05:11:11 +00:00
|
|
|
utils.load('test/inspector/wasm-inspector-test.js');
|
2018-11-06 21:42:48 +00:00
|
|
|
|
2020-06-16 05:11:11 +00:00
|
|
|
InspectorTest.log('Checks resetting context group with wasm.');
|
2018-11-06 21:42:48 +00:00
|
|
|
|
|
|
|
var builder = new WasmModuleBuilder();
|
|
|
|
|
|
|
|
// wasm_B calls wasm_A <param0> times.
|
|
|
|
builder.addFunction('wasm_func', kSig_i_i)
|
|
|
|
.addBody([
|
|
|
|
// clang-format off
|
2019-10-08 12:38:48 +00:00
|
|
|
kExprLocalGet, 0,
|
2018-11-06 21:42:48 +00:00
|
|
|
kExprI32Const, 1,
|
|
|
|
kExprI32Sub,
|
|
|
|
// clang-format on
|
|
|
|
])
|
|
|
|
.exportAs('main');
|
|
|
|
|
|
|
|
|
|
|
|
var module_bytes = builder.toArray();
|
|
|
|
|
|
|
|
var contextGroup1 = new InspectorTest.ContextGroup();
|
|
|
|
var session1 = contextGroup1.connect();
|
|
|
|
session1.setupScriptMap();
|
|
|
|
|
|
|
|
let contextGroup2 = new InspectorTest.ContextGroup();
|
|
|
|
let session2 = contextGroup2.connect();
|
|
|
|
session2.setupScriptMap();
|
|
|
|
|
2021-01-05 05:51:52 +00:00
|
|
|
InspectorTest.runAsyncTestSuite([
|
|
|
|
async function test() {
|
|
|
|
await session1.Protocol.Debugger.enable();
|
|
|
|
await session2.Protocol.Debugger.enable();
|
2018-11-06 21:42:48 +00:00
|
|
|
|
2021-01-05 05:51:52 +00:00
|
|
|
session1.Protocol.Runtime.evaluate({
|
|
|
|
expression: `var instance = (${WasmInspectorTest.instantiateFromBuffer})(${JSON.stringify(module_bytes)})`});
|
2018-11-06 21:42:48 +00:00
|
|
|
|
2021-01-05 05:51:52 +00:00
|
|
|
session2.Protocol.Runtime.evaluate({
|
|
|
|
expression: `var instance = (${WasmInspectorTest.instantiateFromBuffer})(${JSON.stringify(module_bytes)})`});
|
2018-11-06 21:42:48 +00:00
|
|
|
|
2021-01-05 05:51:52 +00:00
|
|
|
contextGroup2.reset();
|
2018-11-06 21:42:48 +00:00
|
|
|
|
2021-01-05 05:51:52 +00:00
|
|
|
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)'}));
|
|
|
|
}
|
|
|
|
]);
|