diff options
author | Michaël Zasso <targos@protonmail.com> | 2021-03-12 08:24:20 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-03-15 15:54:50 +0100 |
commit | 732ad99e47bae5deffa3a22d2ebe5500284106f0 (patch) | |
tree | 759a6b072accf188f03c74a84e8256fe92f1925c /deps/v8/test/inspector | |
parent | 802b3e7cf9a5074a72bec75cf1c46758b81e04b1 (diff) | |
download | node-new-732ad99e47bae5deffa3a22d2ebe5500284106f0.tar.gz |
deps: update V8 to 9.0.257.11
PR-URL: https://github.com/nodejs/node/pull/37587
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/v8/test/inspector')
42 files changed, 1387 insertions, 522 deletions
diff --git a/deps/v8/test/inspector/cpu-profiler/console-profile-asm-js-expected.txt b/deps/v8/test/inspector/cpu-profiler/console-profile-asm-js-expected.txt new file mode 100644 index 0000000000..644bcd76c9 --- /dev/null +++ b/deps/v8/test/inspector/cpu-profiler/console-profile-asm-js-expected.txt @@ -0,0 +1,9 @@ +Test console profiles for asm.js. +testEnableProfilerEarly +Compiling asm.js module with sentinel 0. +testEnableProfilerLate +Compiling asm.js module with sentinel 1. +testEnableProfilerAfterDebugger +Compiling asm.js module with sentinel 2. +testEnableProfilerBeforeDebugger +Compiling asm.js module with sentinel 3. diff --git a/deps/v8/test/inspector/cpu-profiler/console-profile-asm-js.js b/deps/v8/test/inspector/cpu-profiler/console-profile-asm-js.js new file mode 100644 index 0000000000..6d9cb2b174 --- /dev/null +++ b/deps/v8/test/inspector/cpu-profiler/console-profile-asm-js.js @@ -0,0 +1,94 @@ +// Copyright 2021 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. + +let {session, contextGroup, Protocol} = + InspectorTest.start('Test console profiles for asm.js.'); + +function compile(bytes) { + let buffer = new ArrayBuffer(bytes.length); + let view = new Uint8Array(buffer); + for (var i = 0; i < bytes.length; i++) { + view[i] = bytes[i] | 0; + } + let module = new WebAssembly.Module(buffer); + let fib = undefined; + function imp(i) { return fib(i); } + let instance = new WebAssembly.Instance(module, {q: {f: imp}}); + fib = instance.exports.fib; + return instance; +} + +function checkError(message) { + if (!message.error) return; + InspectorTest.log('Error: '); + InspectorTest.logMessage(message); + InspectorTest.completeTest(); +} + +// When build asm.js modules, include a sentinel such that the module will not +// be reused from the cache. +let sentinel = 0; + +function AsmModule(stdlib, foreign, heap) { + "use asm"; + function f() { + return sentinel; + } + return {f: f}; +} + +async function compileAsmJs() { + InspectorTest.log(`Compiling asm.js module with sentinel ${sentinel}.`); + let code = AsmModule.toString().replace('sentinel', sentinel.toString()); + ++sentinel; + checkError(await Protocol.Runtime.evaluate({expression: `(${code})().f()`})); +} + +async function testEnableProfilerEarly() { + InspectorTest.log(arguments.callee.name); + checkError(await Protocol.Profiler.enable()); + checkError(await Protocol.Profiler.start()); + await compileAsmJs(); + checkError(await Protocol.Profiler.disable()); +} + +async function testEnableProfilerLate() { + InspectorTest.log(arguments.callee.name); + await compileAsmJs(); + checkError(await Protocol.Profiler.enable()); + checkError(await Protocol.Profiler.start()); + checkError(await Protocol.Profiler.disable()); +} + +async function testEnableProfilerAfterDebugger() { + InspectorTest.log(arguments.callee.name); + checkError(await Protocol.Debugger.enable()); + await compileAsmJs(); + checkError(await Protocol.Profiler.enable()); + checkError(await Protocol.Profiler.start()); + checkError(await Protocol.Profiler.disable()); + checkError(await Protocol.Debugger.disable()); +} + +async function testEnableProfilerBeforeDebugger() { + InspectorTest.log(arguments.callee.name); + await compileAsmJs(); + await Protocol.Profiler.enable(); + await Protocol.Debugger.enable(); + checkError(await Protocol.Profiler.start()); + await Protocol.Debugger.disable(); + await Protocol.Profiler.disable(); +} + +(async function test() { + try { + await testEnableProfilerEarly(); + await testEnableProfilerLate(); + await testEnableProfilerAfterDebugger(); + await testEnableProfilerBeforeDebugger(); + } catch (e) { + InspectorTest.log('caught: ' + e); + } +})().catch(e => InspectorTest.log('caught: ' + e)) + .finally(InspectorTest.completeTest); diff --git a/deps/v8/test/inspector/cpu-profiler/console-profile-wasm.js b/deps/v8/test/inspector/cpu-profiler/console-profile-wasm.js index e08d644981..76f5c5436f 100644 --- a/deps/v8/test/inspector/cpu-profiler/console-profile-wasm.js +++ b/deps/v8/test/inspector/cpu-profiler/console-profile-wasm.js @@ -3,7 +3,7 @@ // found in the LICENSE file. // TODO(v8:10266): Figure out why this fails on tsan with --always-opt. -// Flags: --no-always-opt +// Flags: --no-always-opt --no-turbo-inline-js-wasm-calls let {session, contextGroup, Protocol} = InspectorTest.start( 'Test that console profiles contain wasm function names.'); diff --git a/deps/v8/test/inspector/debugger/destructuring-expected.txt b/deps/v8/test/inspector/debugger/destructuring-expected.txt new file mode 100644 index 0000000000..47673aefe7 --- /dev/null +++ b/deps/v8/test/inspector/debugger/destructuring-expected.txt @@ -0,0 +1,34 @@ +Tests breakable locations in destructuring. + +Running test: testBreakLocations + +function testFunction() { + function func() { + |_|return [1, 2];|R| + } + + var [|_|a, |_|b] = |C|func(); +|R|} + + +Running test: testSetBreakpoint +Setting breakpoint at test.js:6:0 + + var [a, b] = #func(); +} + +Setting breakpoint at test.js:6:7 + + var [#a, b] = func(); +} + +Setting breakpoint at test.js:6:10 + + var [a, #b] = func(); +} + +Setting breakpoint at test.js:6:15 + + var [a, b] = #func(); +} + diff --git a/deps/v8/test/inspector/debugger/destructuring.js b/deps/v8/test/inspector/debugger/destructuring.js new file mode 100644 index 0000000000..e46e0e4998 --- /dev/null +++ b/deps/v8/test/inspector/debugger/destructuring.js @@ -0,0 +1,47 @@ +// Copyright 2021 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. + +let {session, contextGroup, Protocol} = + InspectorTest.start('Tests breakable locations in destructuring.'); + +let source = ` +function testFunction() { + function func() { + return [1, 2]; + } + + var [a, b] = func(); +} +//# sourceURL=test.js`; + +contextGroup.addScript(source); +session.setupScriptMap(); + +InspectorTest.runAsyncTestSuite([ + async function testBreakLocations() { + Protocol.Debugger.enable(); + let {params:{scriptId}} = await Protocol.Debugger.onceScriptParsed(); + let {result:{locations}} = await Protocol.Debugger.getPossibleBreakpoints({ + start: {lineNumber: 0, columnNumber : 0, scriptId}}); + await session.logBreakLocations(locations); + }, + + async function testSetBreakpoint() { + const SOURCE_LOCATIONS = [ + {lineNumber: 6, columnNumber: 0}, + {lineNumber: 6, columnNumber: 7}, + {lineNumber: 6, columnNumber: 10}, + {lineNumber: 6, columnNumber: 15}, + ]; + for (const {lineNumber, columnNumber} of SOURCE_LOCATIONS) { + const url = 'test.js'; + InspectorTest.log(`Setting breakpoint at ${url}:${lineNumber}:${columnNumber}`); + const {result: {breakpointId, locations}} = await Protocol.Debugger.setBreakpointByUrl({ + lineNumber, columnNumber, url + }); + locations.forEach(location => session.logSourceLocation(location)); + await Protocol.Debugger.removeBreakpoint({breakpointId}); + } + } +]); diff --git a/deps/v8/test/inspector/debugger/for-of-loops-expected.txt b/deps/v8/test/inspector/debugger/for-of-loops-expected.txt index c742413a6b..41d1ca72cb 100644 --- a/deps/v8/test/inspector/debugger/for-of-loops-expected.txt +++ b/deps/v8/test/inspector/debugger/for-of-loops-expected.txt @@ -2,8 +2,6 @@ Tests breakable locations in for-of loops. Running test: testBreakLocations -Running test: testStepInto - function testFunction() { var obj = |_|{a : 1}; var arr = |_|[1]; @@ -33,6 +31,8 @@ function testFunction() { for (let |C|k of |_|iterable) { all.|C|push(k); } |R|} + +Running test: testStepInto (anonymous) (expr.js:0:0) @@ -405,3 +405,25 @@ testFunction (test.js:25:11) if (this.#i < 1) { return { value: this.i++, done: false }; + +Running test: testSetBreakpoint +Setting breakpoint at test.js:25:0 + }; + for (var k of #iterable) { all.push(k); } + iterable.i = 0; + +Setting breakpoint at test.js:25:11 + }; + for (var #k of iterable) { all.push(k); } + iterable.i = 0; + +Setting breakpoint at test.js:25:16 + }; + for (var k of #iterable) { all.push(k); } + iterable.i = 0; + +Setting breakpoint at test.js:25:28 + }; + for (var k of iterable) { all.#push(k); } + iterable.i = 0; + diff --git a/deps/v8/test/inspector/debugger/for-of-loops.js b/deps/v8/test/inspector/debugger/for-of-loops.js index 0fa0a26a77..9579a91a41 100644 --- a/deps/v8/test/inspector/debugger/for-of-loops.js +++ b/deps/v8/test/inspector/debugger/for-of-loops.js @@ -45,7 +45,7 @@ InspectorTest.runAsyncTestSuite([ let {params:{scriptId}} = await Protocol.Debugger.onceScriptParsed(); let {result:{locations}} = await Protocol.Debugger.getPossibleBreakpoints({ start: {lineNumber: 0, columnNumber : 0, scriptId}}); - session.logBreakLocations(locations); + await session.logBreakLocations(locations); }, async function testStepInto() { @@ -65,18 +65,39 @@ InspectorTest.runAsyncTestSuite([ }, async function testStepIntoAfterBreakpoint() { - Protocol.Debugger.setBreakpointByUrl({lineNumber: 25, url: 'test.js'}); + const {result: {breakpointId}} = await Protocol.Debugger.setBreakpointByUrl({ + lineNumber: 25, columnNumber: 11, url: 'test.js' + }); Protocol.Runtime.evaluate({ expression: 'testFunction()//# sourceURL=expr.js'}); await awaitPausedAndDump(); Protocol.Debugger.stepInto(); await awaitPausedAndDump(); await Protocol.Debugger.resume(); + await Protocol.Debugger.removeBreakpoint({breakpointId}); async function awaitPausedAndDump() { let {params:{callFrames}} = await Protocol.Debugger.oncePaused(); session.logCallFrames(callFrames); session.logSourceLocation(callFrames[0].location); } + }, + + async function testSetBreakpoint() { + const SOURCE_LOCATIONS = [ + {lineNumber: 25, columnNumber: 0}, + {lineNumber: 25, columnNumber: 11}, + {lineNumber: 25, columnNumber: 16}, + {lineNumber: 25, columnNumber: 28}, + ]; + for (const {lineNumber, columnNumber} of SOURCE_LOCATIONS) { + const url = 'test.js'; + InspectorTest.log(`Setting breakpoint at ${url}:${lineNumber}:${columnNumber}`); + const {result: {breakpointId, locations}} = await Protocol.Debugger.setBreakpointByUrl({ + lineNumber, columnNumber, url + }); + locations.forEach(location => session.logSourceLocation(location)); + await Protocol.Debugger.removeBreakpoint({breakpointId}); + } } ]); diff --git a/deps/v8/test/inspector/debugger/set-breakpoint-after-gc-expected.txt b/deps/v8/test/inspector/debugger/set-breakpoint-after-gc-expected.txt new file mode 100644 index 0000000000..773f69990e --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-breakpoint-after-gc-expected.txt @@ -0,0 +1,5 @@ +Checks if we keep alive breakpoint information for top-level functions. +Result of setting breakpoint in topLevel.js +[{"scriptId":"3","lineNumber":0,"columnNumber":0}] +Result of setting breakpoint in moduleFunc.js +[{"scriptId":"5","lineNumber":0,"columnNumber":22}]
\ No newline at end of file diff --git a/deps/v8/test/inspector/debugger/set-breakpoint-after-gc.js b/deps/v8/test/inspector/debugger/set-breakpoint-after-gc.js new file mode 100644 index 0000000000..f11b81a32b --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-breakpoint-after-gc.js @@ -0,0 +1,52 @@ +// Copyright 2021 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( + 'Checks if we keep alive breakpoint information for top-level functions.'); + +session.setupScriptMap(); +var executionContextId; + +const callGarbageCollector = ` + %CollectGarbage(""); + %CollectGarbage(""); + %CollectGarbage(""); + %CollectGarbage(""); +`; + +const topLevelFunction = `console.log('This is a top level function')`; +const moduleFunction = + `function testFunc() { console.log('This is a module function') }`; + +Protocol.Debugger.enable().then(onDebuggerEnabled); + +function onDebuggerEnabled() { + Protocol.Runtime.enable(); + Protocol.Runtime.onExecutionContextCreated(onExecutionContextCreated); +} + +async function onExecutionContextCreated(messageObject) { + executionContextId = messageObject.params.context.id; + await testSetBreakpoint(executionContextId, topLevelFunction, 'topLevel.js'); + await testSetBreakpoint(executionContextId, moduleFunction, 'moduleFunc.js'); + InspectorTest.completeTest(); +} + +async function testSetBreakpoint(executionContextId, func, url) { + const obj = await Protocol.Runtime.compileScript({ + expression: func, + sourceURL: url, + persistScript: true, + executionContextId: executionContextId + }); + const scriptId = obj.result.scriptId; + await Protocol.Runtime.runScript({scriptId}); + await Protocol.Runtime.evaluate({expression: `${callGarbageCollector}`}); + const {result: {locations}} = + await Protocol.Debugger.setBreakpointByUrl({lineNumber: 0, url}); + InspectorTest.log(`Result of setting breakpoint in ${url}`); + InspectorTest.log(JSON.stringify(locations)); +} diff --git a/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate-expected.txt b/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate-expected.txt index 6d113861dd..4364308d85 100644 --- a/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate-expected.txt +++ b/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate-expected.txt @@ -1,6 +1,22 @@ Tests side-effect-free evaluation -Paused on 'debugger;' + +Running test: basicTest +Paused on "debugger;" f() returns 1 g() returns 2 f() returns 1 g() throws EvalError + +Running test: testDate +someGlobalDate.setDate(10) : throws +new Date().setDate(10) : ok +someGlobalDate.setFullYear(1991) : throws +new Date().setFullYear(1991) : ok +someGlobalDate.setHours(0) : throws +new Date().setHours(0) : ok +someGlobalDate.getDate() : ok +new Date().getDate() : ok +someGlobalDate.getFullYear() : ok +new Date().getFullYear() : ok +someGlobalDate.getHours() : ok +new Date().getHours() : ok diff --git a/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate.js b/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate.js index a070334980..4a70fd38a2 100644 --- a/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate.js +++ b/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate.js @@ -5,6 +5,7 @@ let {session, contextGroup, Protocol} = InspectorTest.start('Tests side-effect-free evaluation'); contextGroup.addScript(` +var someGlobalDate = new Date(); function testFunction() { var o = 0; @@ -15,43 +16,40 @@ function testFunction() } //# sourceURL=foo.js`); -Protocol.Debugger.enable(); - -Protocol.Debugger.oncePaused().then(debuggerPaused); - -Protocol.Runtime.evaluate({ "expression": "setTimeout(testFunction, 0)" }); - -var topFrameId; - -function debuggerPaused(messageObject) -{ - InspectorTest.log("Paused on 'debugger;'"); - - topFrameId = messageObject.params.callFrames[0].callFrameId; - Protocol.Debugger.evaluateOnCallFrame({ callFrameId: topFrameId, expression: "f()"}).then(evaluatedFirst); -} - -function evaluatedFirst(response) -{ - InspectorTest.log("f() returns " + response.result.result.value); - Protocol.Debugger.evaluateOnCallFrame({ callFrameId: topFrameId, expression: "g()"}).then(evaluatedSecond); -} - -function evaluatedSecond(response) -{ - InspectorTest.log("g() returns " + response.result.result.value); - Protocol.Debugger.evaluateOnCallFrame({ callFrameId: topFrameId, expression: "f()", throwOnSideEffect: true}).then(evaluatedThird); -} - -function evaluatedThird(response) -{ - InspectorTest.log("f() returns " + response.result.result.value); - Protocol.Debugger.evaluateOnCallFrame({ callFrameId: topFrameId, expression: "g()", throwOnSideEffect: true}).then(evaluatedFourth); - InspectorTest.completeTest(); -} - -function evaluatedFourth(response) -{ - InspectorTest.log("g() throws " + response.result.result.className); - InspectorTest.completeTest(); -} +InspectorTest.runAsyncTestSuite([ + async function basicTest() { + Protocol.Debugger.enable(); + Protocol.Runtime.evaluate({ 'expression': 'setTimeout(testFunction, 0)' }); + const {params:{callFrames:[{callFrameId: topFrameId}]}} = await Protocol.Debugger.oncePaused(); + InspectorTest.log('Paused on "debugger;"'); + const {result:{result:{value: fResult}}} = await Protocol.Debugger.evaluateOnCallFrame({ callFrameId: topFrameId, expression: 'f()' }); + InspectorTest.log('f() returns ' + fResult); + const {result:{result:{value: gResult}}} = await Protocol.Debugger.evaluateOnCallFrame({ callFrameId: topFrameId, expression: 'g()' }); + InspectorTest.log('g() returns ' + gResult); + const {result:{result:{value: fResultSideEffect}}} = await Protocol.Debugger.evaluateOnCallFrame({ callFrameId: topFrameId, expression: 'f()', throwOnSideEffect: true}); + InspectorTest.log('f() returns ' + fResultSideEffect); + const {result:{result:{className}}} = await Protocol.Debugger.evaluateOnCallFrame({ callFrameId: topFrameId, expression: 'g()', throwOnSideEffect: true}); + InspectorTest.log('g() throws ' + className); + }, + + async function testDate() { + const check = async (expression) => { + const {result:{exceptionDetails}} = await Protocol.Runtime.evaluate({expression, throwOnSideEffect: true}); + InspectorTest.log(expression + ' : ' + (exceptionDetails ? 'throws' : 'ok')); + }; + // setters are only ok on temporary objects + await check('someGlobalDate.setDate(10)'); + await check('new Date().setDate(10)'); + await check('someGlobalDate.setFullYear(1991)'); + await check('new Date().setFullYear(1991)'); + await check('someGlobalDate.setHours(0)'); + await check('new Date().setHours(0)'); + // getters are ok on any Date + await check('someGlobalDate.getDate()'); + await check('new Date().getDate()'); + await check('someGlobalDate.getFullYear()'); + await check('new Date().getFullYear()'); + await check('someGlobalDate.getHours()'); + await check('new Date().getHours()'); + } +]); diff --git a/deps/v8/test/inspector/debugger/wasm-conditional-breakpoints-expected.txt b/deps/v8/test/inspector/debugger/wasm-conditional-breakpoints-expected.txt new file mode 100644 index 0000000000..f28458c4df --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-conditional-breakpoints-expected.txt @@ -0,0 +1,66 @@ +Test conditional breakpoints in wasm. + +Running test: test +Instantiating. +Waiting for wasm script. +Got wasm script: wasm://wasm/f00dbc56 +Setting breakpoint at offset 34, condition "false" +{ + id : <messageId> + result : { + actualLocation : { + columnNumber : 34 + lineNumber : 0 + scriptId : <scriptId> + } + breakpointId : <breakpointId> + } +} +Setting breakpoint at offset 41, condition "true" +{ + id : <messageId> + result : { + actualLocation : { + columnNumber : 41 + lineNumber : 0 + scriptId : <scriptId> + } + breakpointId : <breakpointId> + } +} +Setting breakpoint at offset 46, condition "$var0.value==3" +{ + id : <messageId> + result : { + actualLocation : { + columnNumber : 46 + lineNumber : 0 + scriptId : <scriptId> + } + breakpointId : <breakpointId> + } +} +Calling fib(5) +Script wasm://wasm/f00dbc56 byte offset 41: Wasm opcode 0x0d (kExprBrIf) +$var0: 5 (i32) +Script wasm://wasm/f00dbc56 byte offset 41: Wasm opcode 0x0d (kExprBrIf) +$var0: 4 (i32) +Script wasm://wasm/f00dbc56 byte offset 41: Wasm opcode 0x0d (kExprBrIf) +$var0: 3 (i32) +Script wasm://wasm/f00dbc56 byte offset 46: Wasm opcode 0x10 (kExprCallFunction) +$var0: 3 (i32) +Script wasm://wasm/f00dbc56 byte offset 41: Wasm opcode 0x0d (kExprBrIf) +$var0: 2 (i32) +Script wasm://wasm/f00dbc56 byte offset 41: Wasm opcode 0x0d (kExprBrIf) +$var0: 1 (i32) +Script wasm://wasm/f00dbc56 byte offset 41: Wasm opcode 0x0d (kExprBrIf) +$var0: 2 (i32) +Script wasm://wasm/f00dbc56 byte offset 41: Wasm opcode 0x0d (kExprBrIf) +$var0: 3 (i32) +Script wasm://wasm/f00dbc56 byte offset 46: Wasm opcode 0x10 (kExprCallFunction) +$var0: 3 (i32) +Script wasm://wasm/f00dbc56 byte offset 41: Wasm opcode 0x0d (kExprBrIf) +$var0: 2 (i32) +Script wasm://wasm/f00dbc56 byte offset 41: Wasm opcode 0x0d (kExprBrIf) +$var0: 1 (i32) +fib returned! diff --git a/deps/v8/test/inspector/debugger/wasm-conditional-breakpoints.js b/deps/v8/test/inspector/debugger/wasm-conditional-breakpoints.js new file mode 100644 index 0000000000..6099a8a70f --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-conditional-breakpoints.js @@ -0,0 +1,75 @@ +// Copyright 2021 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. + +utils.load('test/inspector/wasm-inspector-test.js'); + +const {session, contextGroup, Protocol} = + InspectorTest.start('Test conditional breakpoints in wasm.'); +session.setupScriptMap(); + +const builder = new WasmModuleBuilder(); + +const fib_body = [ + kExprLocalGet, 0, // i (for br_if or i32.sub) + kExprLocalGet, 0, kExprI32Const, 2, kExprI32LeS, // i < 2 ? + kExprBrIf, 0, // --> return i + kExprI32Const, 1, kExprI32Sub, // i - 1 + kExprCallFunction, 0, // fib(i - 1) + kExprLocalGet, 0, kExprI32Const, 2, kExprI32Sub, // i - 2 + kExprCallFunction, 0, // fib(i - 2) + kExprI32Add // add (and return) +]; +const fib = builder.addFunction('fib', kSig_i_i).addBody(fib_body).exportFunc(); + +const module_bytes = builder.toArray(); + +const find_offset = opcode => fib.body_offset + fib_body.indexOf(opcode); + +const breakpoints = [ + {loc: find_offset(kExprLocalGet), cond: 'false'}, + {loc: find_offset(kExprBrIf), cond: 'true'}, + {loc: find_offset(kExprCallFunction), cond: '$var0.value==3'} +]; + +Protocol.Debugger.onPaused(async msg => { + var frames = msg.params.callFrames; + await session.logSourceLocation(frames[0].location); + var frame = msg.params.callFrames[0]; + for (var scope of frame.scopeChain) { + if (scope.type != 'local') continue; + var properties = await Protocol.Runtime.getProperties( + {'objectId': scope.object.objectId}); + for (var {name, value} of properties.result.result) { + value = await WasmInspectorTest.getWasmValue(value); + InspectorTest.log(`${name}: ${value}`); + } + } + Protocol.Debugger.resume(); +}); + +InspectorTest.runAsyncTestSuite([ + async function test() { + await Protocol.Debugger.enable(); + InspectorTest.log('Instantiating.'); + // Spawn asynchronously: + WasmInspectorTest.instantiate(module_bytes); + InspectorTest.log('Waiting for wasm script.'); + const [, {params: wasm_script}] = await Protocol.Debugger.onceScriptParsed(2); + InspectorTest.log(`Got wasm script: ${wasm_script.url}`); + for (let breakpoint of breakpoints) { + InspectorTest.log(`Setting breakpoint at offset ${breakpoint.loc}, condition "${breakpoint.cond}"`); + InspectorTest.logMessage(await Protocol.Debugger.setBreakpoint({ + 'location': { + 'scriptId': wasm_script.scriptId, + 'lineNumber': 0, + 'columnNumber': breakpoint.loc + }, + condition: breakpoint.cond + })); + } + InspectorTest.log('Calling fib(5)'); + await WasmInspectorTest.evalWithUrl('instance.exports.fib(5)', 'runWasm'); + InspectorTest.log('fib returned!'); + } +]); diff --git a/deps/v8/test/inspector/debugger/wasm-evaluate-on-call-frame-expected.txt b/deps/v8/test/inspector/debugger/wasm-evaluate-on-call-frame-expected.txt index 6f47eac211..04bc977dda 100644 --- a/deps/v8/test/inspector/debugger/wasm-evaluate-on-call-frame-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-evaluate-on-call-frame-expected.txt @@ -18,33 +18,33 @@ Debugger paused in main. > globals = Globals > typeof globals = "object" > Object.keys(globals) = Array(2) -> globals[0] = 0 -> globals[1] = 1 -> globals[2] = 2n -> globals[3] = 3n -> globals["$global0"] = 0 -> $global0 = 0 -> globals["$global3"] = 2n -> $global3 = 2n +> globals[0] = i32 {0} +> globals[1] = i32 {1} +> globals[2] = i64 {2n} +> globals[3] = i64 {3n} +> globals["$global0"] = i32 {0} +> $global0 = i32 {0} +> globals["$global3"] = i64 {2n} +> $global3 = i64 {2n} Stepping twice in main. Debugger paused in main. -> globals[0] = 0 -> globals[1] = 1 -> globals[2] = 2n -> globals[3] = 42n -> globals["$global0"] = 0 -> $global0 = 0 -> globals["$global3"] = 2n -> $global3 = 2n +> globals[0] = i32 {0} +> globals[1] = i32 {1} +> globals[2] = i64 {2n} +> globals[3] = i64 {42n} +> globals["$global0"] = i32 {0} +> $global0 = i32 {0} +> globals["$global3"] = i64 {2n} +> $global3 = i64 {2n} Changing global from JavaScript. -> globals[0] = 0 -> globals[1] = 21 -> globals[2] = 2n -> globals[3] = 42n -> globals["$global0"] = 0 -> $global0 = 0 -> globals["$global3"] = 2n -> $global3 = 2n +> globals[0] = i32 {0} +> globals[1] = i32 {21} +> globals[2] = i64 {2n} +> globals[3] = i64 {42n} +> globals["$global0"] = i32 {0} +> $global0 = i32 {0} +> globals["$global3"] = i64 {2n} +> $global3 = i64 {2n} Running test: testFunctions Compile module. @@ -54,17 +54,19 @@ Call main. Debugger paused in main. > functions = Functions > typeof functions = "object" -> Object.keys(functions) = Array(3) +> Object.keys(functions) = Array(4) > functions[0] = function 0() { [native code] } > functions[1] = function 1() { [native code] } > functions[2] = function 2() { [native code] } > functions[3] = function 3() { [native code] } -> functions["$main"] = function 0() { [native code] } -> $main = function 0() { [native code] } -> functions["$func1"] = function 1() { [native code] } -> $func1 = function 1() { [native code] } -> functions["$func3"] = function 3() { [native code] } -> $func3 = function 3() { [native code] } +> functions[4] = function 4() { [native code] } +> functions["$foo.bar"] = function 0() { [native code] } +> functions["$main"] = function 1() { [native code] } +> $main = function 1() { [native code] } +> functions["$func2"] = function 2() { [native code] } +> $func2 = function 2() { [native code] } +> functions["$func4"] = function 4() { [native code] } +> $func4 = function 4() { [native code] } Running test: testLocals Compile module. @@ -75,22 +77,22 @@ Debugger paused in main. > locals = Locals > typeof locals = "object" > Object.keys(locals) = Array(2) -> locals[0] = 3 -> locals[1] = 6 -> locals[2] = 0 -> locals["$x"] = 3 -> $x = 3 -> locals["$var2"] = 0 -> $var2 = 0 +> locals[0] = i32 {3} +> locals[1] = i32 {6} +> locals[2] = i32 {0} +> locals["$x"] = i32 {3} +> $x = i32 {3} +> locals["$var2"] = i32 {0} +> $var2 = i32 {0} Stepping twice in main. Debugger paused in main. -> locals[0] = 3 -> locals[1] = 6 -> locals[2] = 42 -> locals["$x"] = 3 -> $x = 3 -> locals["$var2"] = 42 -> $var2 = 42 +> locals[0] = i32 {3} +> locals[1] = i32 {6} +> locals[2] = i32 {42} +> locals["$x"] = i32 {3} +> $x = i32 {3} +> locals["$var2"] = i32 {42} +> $var2 = i32 {42} Running test: testMemories Compile module. @@ -131,5 +133,5 @@ Stepping twice in main. Debugger paused in main. > stack = Stack > Object.keys(stack) = Array(2) -> stack[0] = 5 -> stack[1] = 42 +> stack[0] = i32 {5} +> stack[1] = i32 {42} diff --git a/deps/v8/test/inspector/debugger/wasm-evaluate-on-call-frame.js b/deps/v8/test/inspector/debugger/wasm-evaluate-on-call-frame.js index 5ee458fc12..375d78d8bd 100644 --- a/deps/v8/test/inspector/debugger/wasm-evaluate-on-call-frame.js +++ b/deps/v8/test/inspector/debugger/wasm-evaluate-on-call-frame.js @@ -21,29 +21,34 @@ async function compileModule(builder) { return [result.result, params.scriptId]; } -async function instantiateModule({objectId}) { +async function instantiateModule({objectId}, importObject) { const {result: {result}} = await Protocol.Runtime.callFunctionOn({ - functionDeclaration: 'function() { return new WebAssembly.Instance(this); }', + arguments: importObject ? [importObject] : [], + functionDeclaration: 'function(importObject) { return new WebAssembly.Instance(this, importObject); }', objectId }); return result; } async function dumpOnCallFrame(callFrameId, expression) { - const {result: {result}} = await Protocol.Debugger.evaluateOnCallFrame({ + const {result: {result: object}} = await Protocol.Debugger.evaluateOnCallFrame({ callFrameId, expression }); - if ('description' in result) { - InspectorTest.log(`> ${expression} = ${result.description}`); + if (object.type === 'object' && object.subtype === 'wasmvalue') { + const {result: {result: properties}} = await Protocol.Runtime.getProperties({objectId: object.objectId, ownProperties: true}) + const valueProperty = properties.find(p => p.name === 'value'); + InspectorTest.log(`> ${expression} = ${object.description} {${valueProperty.value.description}}`); + } else if ('description' in object) { + InspectorTest.log(`> ${expression} = ${object.description}`); } else { - InspectorTest.log(`> ${expression} = ${JSON.stringify(result.value)}`); + InspectorTest.log(`> ${expression} = ${JSON.stringify(object.value)}`); } } async function dumpKeysOnCallFrame(callFrameId, object, keys) { for (const key of keys) { await dumpOnCallFrame(callFrameId, `${object}[${JSON.stringify(key)}]`); - if (typeof key === 'string') { + if (typeof key === 'string' && key.indexOf('.') < 0) { await dumpOnCallFrame(callFrameId, `${key}`); } } @@ -150,23 +155,24 @@ InspectorTest.runAsyncTestSuite([ async function testFunctions() { const builder = new WasmModuleBuilder(); + builder.addImport('foo', 'bar', kSig_v_v); const main = builder.addFunction('main', kSig_i_v) .addBody([ kExprI32Const, 0, ]).exportFunc(); - builder.addFunction('func1', kSig_i_v) + builder.addFunction('func2', kSig_i_v) .addBody([ kExprI32Const, 1, ]); builder.addFunction(undefined, kSig_i_v) .addBody([ kExprI32Const, 2, - ]).exportAs('func1'); + ]).exportAs('func2'); builder.addFunction(undefined, kSig_i_v) .addBody([ kExprI32Const, 3, ]); - const KEYS = [0, 1, 2, 3, '$main', '$func1', '$func3']; + const KEYS = [0, 1, 2, 3, 4, '$foo.bar', '$main', '$func2', '$func4']; InspectorTest.log('Compile module.'); const [module, scriptId] = await compileModule(builder); @@ -177,7 +183,10 @@ InspectorTest.runAsyncTestSuite([ }); InspectorTest.log('Instantiate module.'); - const instance = await instantiateModule(module); + const {result: { result: importObject }} = await Protocol.Runtime.evaluate({ + expression: `({foo: {bar() { }}})` + }); + const instance = await instantiateModule(module, importObject); InspectorTest.log('Call main.'); const callMainPromise = Protocol.Runtime.callFunctionOn({ diff --git a/deps/v8/test/inspector/debugger/wasm-inspect-many-registers-expected.txt b/deps/v8/test/inspector/debugger/wasm-inspect-many-registers-expected.txt index 2c05e3c1a3..8bc226412d 100644 --- a/deps/v8/test/inspector/debugger/wasm-inspect-many-registers-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-inspect-many-registers-expected.txt @@ -5,99 +5,99 @@ Testing i32. Waiting for wasm script. Setting 20 breakpoints. Calling main. -Paused at offset 48; wasm-expression-stack: []; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 50; wasm-expression-stack: [0]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 52; wasm-expression-stack: [0, 1]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 54; wasm-expression-stack: [0, 1, 2]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 56; wasm-expression-stack: [0, 1, 2, 3]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 58; wasm-expression-stack: [0, 1, 2, 3, 4]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 60; wasm-expression-stack: [0, 1, 2, 3, 4, 5]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 62; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 64; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 66; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 68; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 69; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 17]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 70; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 24]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 71; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 30]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 72; wasm-expression-stack: [0, 1, 2, 3, 4, 35]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 73; wasm-expression-stack: [0, 1, 2, 3, 39]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 74; wasm-expression-stack: [0, 1, 2, 42]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 75; wasm-expression-stack: [0, 1, 44]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -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] +Paused at offset 48; wasm-expression-stack: []; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 50; wasm-expression-stack: [0 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 52; wasm-expression-stack: [0 (i32), 1 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 54; wasm-expression-stack: [0 (i32), 1 (i32), 2 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 56; wasm-expression-stack: [0 (i32), 1 (i32), 2 (i32), 3 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 58; wasm-expression-stack: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 60; wasm-expression-stack: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 62; wasm-expression-stack: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 64; wasm-expression-stack: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 66; wasm-expression-stack: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 68; wasm-expression-stack: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 69; wasm-expression-stack: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 17 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 70; wasm-expression-stack: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 24 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 71; wasm-expression-stack: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 30 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 72; wasm-expression-stack: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 35 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 73; wasm-expression-stack: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 39 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 74; wasm-expression-stack: [0 (i32), 1 (i32), 2 (i32), 42 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 75; wasm-expression-stack: [0 (i32), 1 (i32), 44 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 76; wasm-expression-stack: [0 (i32), 45 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] +Paused at offset 77; wasm-expression-stack: [45 (i32)]; local: [0 (i32), 1 (i32), 2 (i32), 3 (i32), 4 (i32), 5 (i32), 6 (i32), 7 (i32), 8 (i32), 9 (i32)] main returned. Testing i64. Waiting for wasm script. Setting 20 breakpoints. Calling main. -Paused at offset 48; wasm-expression-stack: []; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 50; wasm-expression-stack: [0n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 52; wasm-expression-stack: [0n, 1n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 54; wasm-expression-stack: [0n, 1n, 2n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 56; wasm-expression-stack: [0n, 1n, 2n, 3n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 58; wasm-expression-stack: [0n, 1n, 2n, 3n, 4n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 60; wasm-expression-stack: [0n, 1n, 2n, 3n, 4n, 5n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 62; wasm-expression-stack: [0n, 1n, 2n, 3n, 4n, 5n, 6n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 64; wasm-expression-stack: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 66; wasm-expression-stack: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 68; wasm-expression-stack: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 69; wasm-expression-stack: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 17n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 70; wasm-expression-stack: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 24n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 71; wasm-expression-stack: [0n, 1n, 2n, 3n, 4n, 5n, 30n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 72; wasm-expression-stack: [0n, 1n, 2n, 3n, 4n, 35n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 73; wasm-expression-stack: [0n, 1n, 2n, 3n, 39n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 74; wasm-expression-stack: [0n, 1n, 2n, 42n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 75; wasm-expression-stack: [0n, 1n, 44n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 76; wasm-expression-stack: [0n, 45n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] -Paused at offset 77; wasm-expression-stack: [45n]; local: [0n, 1n, 2n, 3n, 4n, 5n, 6n, 7n, 8n, 9n] +Paused at offset 48; wasm-expression-stack: []; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 50; wasm-expression-stack: [0n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 52; wasm-expression-stack: [0n (i64), 1n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 54; wasm-expression-stack: [0n (i64), 1n (i64), 2n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 56; wasm-expression-stack: [0n (i64), 1n (i64), 2n (i64), 3n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 58; wasm-expression-stack: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 60; wasm-expression-stack: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 62; wasm-expression-stack: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 64; wasm-expression-stack: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 66; wasm-expression-stack: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 68; wasm-expression-stack: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 69; wasm-expression-stack: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 17n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 70; wasm-expression-stack: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 24n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 71; wasm-expression-stack: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 30n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 72; wasm-expression-stack: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 35n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 73; wasm-expression-stack: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 39n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 74; wasm-expression-stack: [0n (i64), 1n (i64), 2n (i64), 42n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 75; wasm-expression-stack: [0n (i64), 1n (i64), 44n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 76; wasm-expression-stack: [0n (i64), 45n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] +Paused at offset 77; wasm-expression-stack: [45n (i64)]; local: [0n (i64), 1n (i64), 2n (i64), 3n (i64), 4n (i64), 5n (i64), 6n (i64), 7n (i64), 8n (i64), 9n (i64)] main returned. Testing f32. Waiting for wasm script. Setting 20 breakpoints. Calling main. -Paused at offset 48; wasm-expression-stack: []; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 50; wasm-expression-stack: [0]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 52; wasm-expression-stack: [0, 1]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 54; wasm-expression-stack: [0, 1, 2]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 56; wasm-expression-stack: [0, 1, 2, 3]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 58; wasm-expression-stack: [0, 1, 2, 3, 4]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 60; wasm-expression-stack: [0, 1, 2, 3, 4, 5]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 62; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 64; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 66; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 68; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 69; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 17]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 70; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 24]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 71; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 30]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 72; wasm-expression-stack: [0, 1, 2, 3, 4, 35]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 73; wasm-expression-stack: [0, 1, 2, 3, 39]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 74; wasm-expression-stack: [0, 1, 2, 42]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 75; wasm-expression-stack: [0, 1, 44]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -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] +Paused at offset 48; wasm-expression-stack: []; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 50; wasm-expression-stack: [0 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 52; wasm-expression-stack: [0 (f32), 1 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 54; wasm-expression-stack: [0 (f32), 1 (f32), 2 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 56; wasm-expression-stack: [0 (f32), 1 (f32), 2 (f32), 3 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 58; wasm-expression-stack: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 60; wasm-expression-stack: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 62; wasm-expression-stack: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 64; wasm-expression-stack: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 66; wasm-expression-stack: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 68; wasm-expression-stack: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 69; wasm-expression-stack: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 17 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 70; wasm-expression-stack: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 24 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 71; wasm-expression-stack: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 30 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 72; wasm-expression-stack: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 35 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 73; wasm-expression-stack: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 39 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 74; wasm-expression-stack: [0 (f32), 1 (f32), 2 (f32), 42 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 75; wasm-expression-stack: [0 (f32), 1 (f32), 44 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 76; wasm-expression-stack: [0 (f32), 45 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] +Paused at offset 77; wasm-expression-stack: [45 (f32)]; local: [0 (f32), 1 (f32), 2 (f32), 3 (f32), 4 (f32), 5 (f32), 6 (f32), 7 (f32), 8 (f32), 9 (f32)] main returned. Testing f64. Waiting for wasm script. Setting 20 breakpoints. Calling main. -Paused at offset 48; wasm-expression-stack: []; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 50; wasm-expression-stack: [0]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 52; wasm-expression-stack: [0, 1]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 54; wasm-expression-stack: [0, 1, 2]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 56; wasm-expression-stack: [0, 1, 2, 3]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 58; wasm-expression-stack: [0, 1, 2, 3, 4]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 60; wasm-expression-stack: [0, 1, 2, 3, 4, 5]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 62; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 64; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 66; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 68; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 69; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 7, 17]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 70; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 6, 24]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 71; wasm-expression-stack: [0, 1, 2, 3, 4, 5, 30]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 72; wasm-expression-stack: [0, 1, 2, 3, 4, 35]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 73; wasm-expression-stack: [0, 1, 2, 3, 39]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 74; wasm-expression-stack: [0, 1, 2, 42]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -Paused at offset 75; wasm-expression-stack: [0, 1, 44]; local: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -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] +Paused at offset 48; wasm-expression-stack: []; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 50; wasm-expression-stack: [0 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 52; wasm-expression-stack: [0 (f64), 1 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 54; wasm-expression-stack: [0 (f64), 1 (f64), 2 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 56; wasm-expression-stack: [0 (f64), 1 (f64), 2 (f64), 3 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 58; wasm-expression-stack: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 60; wasm-expression-stack: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 62; wasm-expression-stack: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 64; wasm-expression-stack: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 66; wasm-expression-stack: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 68; wasm-expression-stack: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 69; wasm-expression-stack: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 17 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 70; wasm-expression-stack: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 24 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 71; wasm-expression-stack: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 30 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 72; wasm-expression-stack: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 35 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 73; wasm-expression-stack: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 39 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 74; wasm-expression-stack: [0 (f64), 1 (f64), 2 (f64), 42 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 75; wasm-expression-stack: [0 (f64), 1 (f64), 44 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 76; wasm-expression-stack: [0 (f64), 45 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] +Paused at offset 77; wasm-expression-stack: [45 (f64)]; local: [0 (f64), 1 (f64), 2 (f64), 3 (f64), 4 (f64), 5 (f64), 6 (f64), 7 (f64), 8 (f64), 9 (f64)] main returned. diff --git a/deps/v8/test/inspector/debugger/wasm-inspect-many-registers.js b/deps/v8/test/inspector/debugger/wasm-inspect-many-registers.js index 0737de8899..b3e3c38c58 100644 --- a/deps/v8/test/inspector/debugger/wasm-inspect-many-registers.js +++ b/deps/v8/test/inspector/debugger/wasm-inspect-many-registers.js @@ -24,8 +24,9 @@ Protocol.Debugger.onPaused(async msg => { if (scope.type == 'module') continue; var scope_properties = await Protocol.Runtime.getProperties({objectId: scope.object.objectId}); - let str = scope_properties.result.result.map( - elem => WasmInspectorTest.getWasmValue(elem.value)).join(', '); + let str = (await Promise.all(scope_properties.result.result.map( + elem => WasmInspectorTest.getWasmValue(elem.value)))) + .join(', '); line.push(`${scope.type}: [${str}]`); } InspectorTest.log(line.join('; ')); diff --git a/deps/v8/test/inspector/debugger/wasm-instrumentation-breakpoint-expected.txt b/deps/v8/test/inspector/debugger/wasm-instrumentation-breakpoint-expected.txt new file mode 100644 index 0000000000..fd79e43626 --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-instrumentation-breakpoint-expected.txt @@ -0,0 +1,37 @@ +Test instrumentation breakpoints in wasm. + +Running test: testBreakInStartFunction +Setting instrumentation breakpoint +{ + id : <messageId> + result : { + breakpointId : <breakpointId> + } +} +Compiling wasm module. +Paused at v8://test/compile_module with reason "instrumentation". +Instantiating module. +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) +Instantiating a second time (should trigger no breakpoint). +Paused at v8://test/instantiate2 with reason "instrumentation". +Done. + +Running test: testBreakInStartFunctionCompileTwice +Setting instrumentation breakpoint +{ + id : <messageId> + result : { + breakpointId : <breakpointId> + } +} +Instantiating module. +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) +Instantiating a second time (should trigger another breakpoint). +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. diff --git a/deps/v8/test/inspector/debugger/wasm-instrumentation-breakpoint.js b/deps/v8/test/inspector/debugger/wasm-instrumentation-breakpoint.js new file mode 100644 index 0000000000..feeff65999 --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-instrumentation-breakpoint.js @@ -0,0 +1,68 @@ +// Copyright 2021 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. + +utils.load('test/inspector/wasm-inspector-test.js'); + +const {session, contextGroup, Protocol} = + InspectorTest.start('Test instrumentation breakpoints in wasm.'); +session.setupScriptMap(); + +Protocol.Debugger.onPaused(async msg => { + let top_frame = msg.params.callFrames[0]; + let reason = msg.params.reason; + InspectorTest.log(`Paused at ${top_frame.url} with reason "${reason}".`); + if (!top_frame.url.startsWith('v8://test/')) { + await session.logSourceLocation(top_frame.location); + } + Protocol.Debugger.resume(); +}); + +// TODO(clemensb): Add test for 'beforeScriptWithSourceMapExecution'. +// TODO(clemensb): Add test for module without start function. + +InspectorTest.runAsyncTestSuite([ + async function testBreakInStartFunction() { + const builder = new WasmModuleBuilder(); + const start_fn = builder.addFunction('start', kSig_v_v).addBody([kExprNop]); + builder.addStart(start_fn.index); + + await Protocol.Debugger.enable(); + InspectorTest.log('Setting instrumentation breakpoint'); + InspectorTest.logMessage( + await Protocol.Debugger.setInstrumentationBreakpoint( + {instrumentation: 'beforeScriptExecution'})); + InspectorTest.log('Compiling wasm module.'); + await WasmInspectorTest.compile(builder.toArray()); + InspectorTest.log('Instantiating module.'); + await WasmInspectorTest.evalWithUrl( + 'new WebAssembly.Instance(module)', 'instantiate'); + InspectorTest.log( + 'Instantiating a second time (should trigger no breakpoint).'); + await WasmInspectorTest.evalWithUrl( + 'new WebAssembly.Instance(module)', 'instantiate2'); + InspectorTest.log('Done.'); + await Protocol.Debugger.disable(); + }, + + // If we compile twice, we get two instrumentation breakpoints (which might or + // might not be expected, but it's the current behaviour). + async function testBreakInStartFunctionCompileTwice() { + const builder = new WasmModuleBuilder(); + const start_fn = builder.addFunction('start', kSig_v_v).addBody([kExprNop]); + builder.addStart(start_fn.index); + + await Protocol.Debugger.enable(); + InspectorTest.log('Setting instrumentation breakpoint'); + InspectorTest.logMessage( + await Protocol.Debugger.setInstrumentationBreakpoint( + {instrumentation: 'beforeScriptExecution'})); + InspectorTest.log('Instantiating module.'); + await WasmInspectorTest.instantiate(builder.toArray()); + InspectorTest.log( + 'Instantiating a second time (should trigger another breakpoint).'); + await WasmInspectorTest.instantiate(builder.toArray()); + InspectorTest.log('Done.'); + await Protocol.Debugger.disable(); + } +]); diff --git a/deps/v8/test/inspector/debugger/wasm-memory-names.js b/deps/v8/test/inspector/debugger/wasm-memory-names.js index de622a2e95..160e6e83d3 100644 --- a/deps/v8/test/inspector/debugger/wasm-memory-names.js +++ b/deps/v8/test/inspector/debugger/wasm-memory-names.js @@ -50,24 +50,6 @@ function createInstance(moduleBytes) { new WebAssembly.Instance(module, {module_name: {imported_mem: memory}}); } -async function logMemoryName(msg, Protocol) { - let callFrames = msg.params.callFrames; - InspectorTest.log('Paused in debugger.'); - - let scopeChain = callFrames[0].scopeChain; - for (let scope of scopeChain) { - if (scope.type != 'module') continue; - let moduleObjectProps = (await Protocol.Runtime.getProperties({ - 'objectId': scope.object.objectId - })).result.result; - - for (let prop of moduleObjectProps) { - if (prop.name === 'instance' || prop.name === 'module') continue; - InspectorTest.log(`name: ${prop.name}`); - } - } -} - async function check(moduleBytes) { Protocol.Runtime.evaluate({ expression: ` @@ -91,8 +73,17 @@ async function check(moduleBytes) { InspectorTest.log('Running main.'); Protocol.Runtime.evaluate({expression: 'instance.exports.main()'}); - let msg = await Protocol.Debugger.oncePaused(); - await logMemoryName(msg, Protocol); + const {params: {callFrames: [{callFrameId}]}} = + await Protocol.Debugger.oncePaused(); + InspectorTest.log('Paused in debugger.'); + const {result: {result: {objectId}}} = + await Protocol.Debugger.evaluateOnCallFrame( + {callFrameId, expression: `memories`}); + const {result: {result: properties}} = + await Protocol.Runtime.getProperties({objectId}); + for (const {name} of properties) { + InspectorTest.log(`name: ${name}`); + } await Protocol.Debugger.resume(); InspectorTest.log('Finished.'); diff --git a/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt b/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt index 4fdec85b8d..a7c8d9eedb 100644 --- a/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt @@ -16,39 +16,45 @@ Scope: at C (interpreted) (0:169): - scope (wasm-expression-stack): - scope (local): - $i32_arg: 42 (number) - $i32_local: 0 (number) - $var2: 0 (number) + $i32_arg: 42 (i32) + $i32_local: 0 (i32) + $var2: 0 (f32) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 0 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 0 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at B (liftoff) (0:158): - scope (wasm-expression-stack): - 0: 42 (number) - 1: 3 (number) + 0: 42 (i32) + 1: 3 (i32) - scope (local): - $i32_arg: 42 (number) - $i32_local: 0 (number) - $f32_local: 7.199999809265137 (number) - $0: 0 (number) - $var5: 0 (number) - $v128_local: Uint8Array(16) + $i32_arg: 42 (i32) + $i32_local: 0 (i32) + $f32_local: 7.199999809265137 (f32) + $0: 0 (f32) + $var5: 0 (f32) + $v128_local: i32x4 0x00000017 0x00000017 0x00000017 0x00000017 (v128) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 0 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 0 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at A (liftoff) (0:128): - scope (wasm-expression-stack): - scope (local): - $var0: 42 (number) + $var0: 42 (i32) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 0 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 0 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -58,41 +64,47 @@ Script wasm://wasm/e33badc2 byte offset 171: Wasm opcode 0x24 (kExprGlobalSet) Scope: at C (interpreted) (0:171): - scope (wasm-expression-stack): - 0: 42 (number) + 0: 42 (i32) - scope (local): - $i32_arg: 42 (number) - $i32_local: 0 (number) - $var2: 0 (number) + $i32_arg: 42 (i32) + $i32_local: 0 (i32) + $var2: 0 (f32) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 0 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 0 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at B (liftoff) (0:158): - scope (wasm-expression-stack): - 0: 42 (number) - 1: 3 (number) + 0: 42 (i32) + 1: 3 (i32) - scope (local): - $i32_arg: 42 (number) - $i32_local: 0 (number) - $f32_local: 7.199999809265137 (number) - $0: 0 (number) - $var5: 0 (number) - $v128_local: Uint8Array(16) + $i32_arg: 42 (i32) + $i32_local: 0 (i32) + $f32_local: 7.199999809265137 (f32) + $0: 0 (f32) + $var5: 0 (f32) + $v128_local: i32x4 0x00000017 0x00000017 0x00000017 0x00000017 (v128) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 0 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 0 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at A (liftoff) (0:128): - scope (wasm-expression-stack): - scope (local): - $var0: 42 (number) + $var0: 42 (i32) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 0 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 0 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -103,39 +115,45 @@ Scope: at C (interpreted) (0:173): - scope (wasm-expression-stack): - scope (local): - $i32_arg: 42 (number) - $i32_local: 0 (number) - $var2: 0 (number) + $i32_arg: 42 (i32) + $i32_local: 0 (i32) + $var2: 0 (f32) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at B (liftoff) (0:158): - scope (wasm-expression-stack): - 0: 42 (number) - 1: 3 (number) + 0: 42 (i32) + 1: 3 (i32) - scope (local): - $i32_arg: 42 (number) - $i32_local: 0 (number) - $f32_local: 7.199999809265137 (number) - $0: 0 (number) - $var5: 0 (number) - $v128_local: Uint8Array(16) + $i32_arg: 42 (i32) + $i32_local: 0 (i32) + $f32_local: 7.199999809265137 (f32) + $0: 0 (f32) + $var5: 0 (f32) + $v128_local: i32x4 0x00000017 0x00000017 0x00000017 0x00000017 (v128) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at A (liftoff) (0:128): - scope (wasm-expression-stack): - scope (local): - $var0: 42 (number) + $var0: 42 (i32) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -145,41 +163,47 @@ Script wasm://wasm/e33badc2 byte offset 175: Wasm opcode 0x21 (kExprLocalSet) Scope: at C (interpreted) (0:175): - scope (wasm-expression-stack): - 0: 47 (number) + 0: 47 (i32) - scope (local): - $i32_arg: 42 (number) - $i32_local: 0 (number) - $var2: 0 (number) + $i32_arg: 42 (i32) + $i32_local: 0 (i32) + $var2: 0 (f32) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at B (liftoff) (0:158): - scope (wasm-expression-stack): - 0: 42 (number) - 1: 3 (number) + 0: 42 (i32) + 1: 3 (i32) - scope (local): - $i32_arg: 42 (number) - $i32_local: 0 (number) - $f32_local: 7.199999809265137 (number) - $0: 0 (number) - $var5: 0 (number) - $v128_local: Uint8Array(16) + $i32_arg: 42 (i32) + $i32_local: 0 (i32) + $f32_local: 7.199999809265137 (f32) + $0: 0 (f32) + $var5: 0 (f32) + $v128_local: i32x4 0x00000017 0x00000017 0x00000017 0x00000017 (v128) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at A (liftoff) (0:128): - scope (wasm-expression-stack): - scope (local): - $var0: 42 (number) + $var0: 42 (i32) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -190,39 +214,45 @@ Scope: at C (interpreted) (0:177): - scope (wasm-expression-stack): - scope (local): - $i32_arg: 42 (number) - $i32_local: 47 (number) - $var2: 0 (number) + $i32_arg: 42 (i32) + $i32_local: 47 (i32) + $var2: 0 (f32) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at B (liftoff) (0:158): - scope (wasm-expression-stack): - 0: 42 (number) - 1: 3 (number) + 0: 42 (i32) + 1: 3 (i32) - scope (local): - $i32_arg: 42 (number) - $i32_local: 0 (number) - $f32_local: 7.199999809265137 (number) - $0: 0 (number) - $var5: 0 (number) - $v128_local: Uint8Array(16) + $i32_arg: 42 (i32) + $i32_local: 0 (i32) + $f32_local: 7.199999809265137 (f32) + $0: 0 (f32) + $var5: 0 (f32) + $v128_local: i32x4 0x00000017 0x00000017 0x00000017 0x00000017 (v128) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at A (liftoff) (0:128): - scope (wasm-expression-stack): - scope (local): - $var0: 42 (number) + $var0: 42 (i32) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -232,29 +262,33 @@ Script wasm://wasm/e33badc2 byte offset 160: Wasm opcode 0x1a (kExprDrop) Scope: at B (liftoff) (0:160): - scope (wasm-expression-stack): - 0: 42 (number) - 1: 3 (number) + 0: 42 (i32) + 1: 3 (i32) - scope (local): - $i32_arg: 42 (number) - $i32_local: 0 (number) - $f32_local: 7.199999809265137 (number) - $0: 0 (number) - $var5: 0 (number) - $v128_local: Uint8Array(16) + $i32_arg: 42 (i32) + $i32_local: 0 (i32) + $f32_local: 7.199999809265137 (f32) + $0: 0 (f32) + $var5: 0 (f32) + $v128_local: i32x4 0x00000017 0x00000017 0x00000017 0x00000017 (v128) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at A (liftoff) (0:128): - scope (wasm-expression-stack): - scope (local): - $var0: 42 (number) + $var0: 42 (i32) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -264,28 +298,32 @@ Script wasm://wasm/e33badc2 byte offset 161: Wasm opcode 0x1a (kExprDrop) Scope: at B (liftoff) (0:161): - scope (wasm-expression-stack): - 0: 42 (number) + 0: 42 (i32) - scope (local): - $i32_arg: 42 (number) - $i32_local: 0 (number) - $f32_local: 7.199999809265137 (number) - $0: 0 (number) - $var5: 0 (number) - $v128_local: Uint8Array(16) + $i32_arg: 42 (i32) + $i32_local: 0 (i32) + $f32_local: 7.199999809265137 (f32) + $0: 0 (f32) + $var5: 0 (f32) + $v128_local: i32x4 0x00000017 0x00000017 0x00000017 0x00000017 (v128) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at A (liftoff) (0:128): - scope (wasm-expression-stack): - scope (local): - $var0: 42 (number) + $var0: 42 (i32) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -296,26 +334,30 @@ Scope: at B (liftoff) (0:162): - scope (wasm-expression-stack): - scope (local): - $i32_arg: 42 (number) - $i32_local: 0 (number) - $f32_local: 7.199999809265137 (number) - $0: 0 (number) - $var5: 0 (number) - $v128_local: Uint8Array(16) + $i32_arg: 42 (i32) + $i32_local: 0 (i32) + $f32_local: 7.199999809265137 (f32) + $0: 0 (f32) + $var5: 0 (f32) + $v128_local: i32x4 0x00000017 0x00000017 0x00000017 0x00000017 (v128) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at A (liftoff) (0:128): - scope (wasm-expression-stack): - scope (local): - $var0: 42 (number) + $var0: 42 (i32) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at (anonymous) (0:17): - scope (global): -- skipped globals @@ -326,12 +368,14 @@ Scope: at A (liftoff) (0:130): - scope (wasm-expression-stack): - scope (local): - $var0: 42 (number) + $var0: 42 (i32) - scope (module): instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function) module: Module - $exported_memory: Memory(1) - globals: "$exported_global": 42 (number) + functions: "$A (liftoff)": (Function), "$B (liftoff)": (Function), "$C (interpreted)": (Function) + globals: "$exported_global": 42 (i32) + memories: "$exported_memory": (Memory) + tables: "$exported_table": (Table) at (anonymous) (0:17): - scope (global): -- skipped globals diff --git a/deps/v8/test/inspector/debugger/wasm-set-breakpoint-expected.txt b/deps/v8/test/inspector/debugger/wasm-set-breakpoint-expected.txt index e3f47f8a2e..9ab6c323bf 100644 --- a/deps/v8/test/inspector/debugger/wasm-set-breakpoint-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-set-breakpoint-expected.txt @@ -14,13 +14,15 @@ at wasm_A (0:38): - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at wasm_B (0:56): - scope (wasm-expression-stack): - scope (local): - $var0: 3 (number) + $var0: 3 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Setting breakpoint at offset 39 on script v8://test/runWasm @@ -41,13 +43,15 @@ at wasm_A (0:39): - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at wasm_B (0:56): - scope (wasm-expression-stack): - scope (local): - $var0: 3 (number) + $var0: 3 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -56,10 +60,11 @@ Scope: at wasm_B (0:45): - scope (wasm-expression-stack): - scope (local): - $var0: 3 (number) + $var0: 3 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -67,12 +72,13 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf) Scope: at wasm_B (0:47): - scope (wasm-expression-stack): - 0: 3 (number) + 0: 3 (i32) - scope (local): - $var0: 3 (number) + $var0: 3 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -81,10 +87,11 @@ Scope: at wasm_B (0:49): - scope (wasm-expression-stack): - scope (local): - $var0: 3 (number) + $var0: 3 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -92,12 +99,13 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 (kExprI32Const) Scope: at wasm_B (0:51): - scope (wasm-expression-stack): - 0: 3 (number) + 0: 3 (i32) - scope (local): - $var0: 3 (number) + $var0: 3 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -105,13 +113,14 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b (kExprI32Sub) Scope: at wasm_B (0:53): - scope (wasm-expression-stack): - 0: 3 (number) - 1: 1 (number) + 0: 3 (i32) + 1: 1 (i32) - scope (local): - $var0: 3 (number) + $var0: 3 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -119,12 +128,13 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 (kExprLocalSet) Scope: at wasm_B (0:54): - scope (wasm-expression-stack): - 0: 2 (number) + 0: 2 (i32) - scope (local): - $var0: 3 (number) + $var0: 3 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -136,13 +146,15 @@ at wasm_A (0:38): - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at wasm_B (0:56): - scope (wasm-expression-stack): - scope (local): - $var0: 2 (number) + $var0: 2 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -154,13 +166,15 @@ at wasm_A (0:39): - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at wasm_B (0:56): - scope (wasm-expression-stack): - scope (local): - $var0: 2 (number) + $var0: 2 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -169,10 +183,11 @@ Scope: at wasm_B (0:45): - scope (wasm-expression-stack): - scope (local): - $var0: 2 (number) + $var0: 2 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -180,12 +195,13 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf) Scope: at wasm_B (0:47): - scope (wasm-expression-stack): - 0: 2 (number) + 0: 2 (i32) - scope (local): - $var0: 2 (number) + $var0: 2 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -194,10 +210,11 @@ Scope: at wasm_B (0:49): - scope (wasm-expression-stack): - scope (local): - $var0: 2 (number) + $var0: 2 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -205,12 +222,13 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 (kExprI32Const) Scope: at wasm_B (0:51): - scope (wasm-expression-stack): - 0: 2 (number) + 0: 2 (i32) - scope (local): - $var0: 2 (number) + $var0: 2 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -218,13 +236,14 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b (kExprI32Sub) Scope: at wasm_B (0:53): - scope (wasm-expression-stack): - 0: 2 (number) - 1: 1 (number) + 0: 2 (i32) + 1: 1 (i32) - scope (local): - $var0: 2 (number) + $var0: 2 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -232,12 +251,13 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 (kExprLocalSet) Scope: at wasm_B (0:54): - scope (wasm-expression-stack): - 0: 1 (number) + 0: 1 (i32) - scope (local): - $var0: 2 (number) + $var0: 2 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -249,13 +269,15 @@ at wasm_A (0:38): - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at wasm_B (0:56): - scope (wasm-expression-stack): - scope (local): - $var0: 1 (number) + $var0: 1 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -267,13 +289,15 @@ at wasm_A (0:39): - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at wasm_B (0:56): - scope (wasm-expression-stack): - scope (local): - $var0: 1 (number) + $var0: 1 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -282,10 +306,11 @@ Scope: at wasm_B (0:45): - scope (wasm-expression-stack): - scope (local): - $var0: 1 (number) + $var0: 1 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -293,12 +318,13 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf) Scope: at wasm_B (0:47): - scope (wasm-expression-stack): - 0: 1 (number) + 0: 1 (i32) - scope (local): - $var0: 1 (number) + $var0: 1 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -307,10 +333,11 @@ Scope: at wasm_B (0:49): - scope (wasm-expression-stack): - scope (local): - $var0: 1 (number) + $var0: 1 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -318,12 +345,13 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 (kExprI32Const) Scope: at wasm_B (0:51): - scope (wasm-expression-stack): - 0: 1 (number) + 0: 1 (i32) - scope (local): - $var0: 1 (number) + $var0: 1 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -331,13 +359,14 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b (kExprI32Sub) Scope: at wasm_B (0:53): - scope (wasm-expression-stack): - 0: 1 (number) - 1: 1 (number) + 0: 1 (i32) + 1: 1 (i32) - scope (local): - $var0: 1 (number) + $var0: 1 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -345,12 +374,13 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 (kExprLocalSet) Scope: at wasm_B (0:54): - scope (wasm-expression-stack): - 0: 0 (number) + 0: 0 (i32) - scope (local): - $var0: 1 (number) + $var0: 1 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -362,13 +392,15 @@ at wasm_A (0:38): - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at wasm_B (0:56): - scope (wasm-expression-stack): - scope (local): - $var0: 0 (number) + $var0: 0 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -380,13 +412,15 @@ at wasm_A (0:39): - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at wasm_B (0:56): - scope (wasm-expression-stack): - scope (local): - $var0: 0 (number) + $var0: 0 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -395,10 +429,11 @@ Scope: at wasm_B (0:45): - scope (wasm-expression-stack): - scope (local): - $var0: 0 (number) + $var0: 0 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -406,12 +441,13 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf) Scope: at wasm_B (0:47): - scope (wasm-expression-stack): - 0: 0 (number) + 0: 0 (i32) - scope (local): - $var0: 0 (number) + $var0: 0 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped Paused: @@ -420,10 +456,11 @@ Scope: at wasm_B (0:61): - scope (wasm-expression-stack): - scope (local): - $var0: 0 (number) + $var0: 0 (i32) - scope (module): instance: exports: "main" (Function) module: Module + functions: "$wasm_A": (Function), "$wasm_B": (Function) at (anonymous) (0:17): -- skipped exports.main returned! diff --git a/deps/v8/test/inspector/debugger/wasm-stack-check-expected.txt b/deps/v8/test/inspector/debugger/wasm-stack-check-expected.txt index 08cfb12c06..caf32e07b5 100644 --- a/deps/v8/test/inspector/debugger/wasm-stack-check-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-stack-check-expected.txt @@ -6,8 +6,8 @@ Wait for script Got wasm script: wasm://wasm/c84b7cde Run Expecting to pause at 61 -Paused at offset 61; wasm-expression-stack: []; local: [12] -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] +Paused at offset 61; wasm-expression-stack: []; local: [12 (i32)] +Paused at offset 62; wasm-expression-stack: []; local: [12 (i32)] +Paused at offset 64; wasm-expression-stack: [12 (i32)]; local: [12 (i32)] +Paused at offset 66; wasm-expression-stack: [12 (i32), 1 (i32)]; local: [12 (i32)] +Paused at offset 67; wasm-expression-stack: [13 (i32)]; local: [12 (i32)] diff --git a/deps/v8/test/inspector/debugger/wasm-stack-check.js b/deps/v8/test/inspector/debugger/wasm-stack-check.js index 13f78446ea..4189abd3e1 100644 --- a/deps/v8/test/inspector/debugger/wasm-stack-check.js +++ b/deps/v8/test/inspector/debugger/wasm-stack-check.js @@ -70,8 +70,9 @@ async function inspect(frame) { if (scope.type == 'module') continue; var scope_properties = await Protocol.Runtime.getProperties({objectId: scope.object.objectId}); - let str = scope_properties.result.result.map( - elem => WasmInspectorTest.getWasmValue(elem.value)).join(', '); + let str = (await Promise.all(scope_properties.result.result.map( + elem => WasmInspectorTest.getWasmValue(elem.value)))) + .join(', '); line.push(`${scope.type}: [${str}]`); } InspectorTest.log(line.join('; ')); diff --git a/deps/v8/test/inspector/debugger/wasm-step-a-lot-expected.txt b/deps/v8/test/inspector/debugger/wasm-step-a-lot-expected.txt new file mode 100644 index 0000000000..4750954f06 --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-step-a-lot-expected.txt @@ -0,0 +1,28 @@ +Tests repeated stepping through a large function (should not OOM) + +Running test: test +Setting up global instance variable. +Got wasm script: wasm://wasm/8f70f0e2 +Setting breakpoint +Paused 50 and running... +Paused 100 and running... +Paused 150 and running... +Paused 200 and running... +Paused 250 and running... +Paused 300 and running... +Paused 350 and running... +Paused 400 and running... +Paused 450 and running... +Paused 500 and running... +Paused 550 and running... +Paused 600 and running... +Paused 650 and running... +Paused 700 and running... +Paused 750 and running... +Paused 800 and running... +Paused 850 and running... +Paused 900 and running... +Paused 950 and running... +Paused 1000 and running... +test function returned. +Paused 1003 times. diff --git a/deps/v8/test/inspector/debugger/wasm-step-a-lot.js b/deps/v8/test/inspector/debugger/wasm-step-a-lot.js new file mode 100644 index 0000000000..df0e983d53 --- /dev/null +++ b/deps/v8/test/inspector/debugger/wasm-step-a-lot.js @@ -0,0 +1,56 @@ +// Copyright 2021 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. + +// Lower the maximum code space size to detect missed garbage collection +// earlier. +// Flags: --wasm-max-code-space=2 + +utils.load('test/inspector/wasm-inspector-test.js'); + +const {session, contextGroup, Protocol} = InspectorTest.start( + 'Tests repeated stepping through a large function (should not OOM)'); +session.setupScriptMap(); + +const builder = new WasmModuleBuilder(); + +const body = [kExprLocalGet, 0]; +// Stepping through a long function will repeatedly recreate stepping code, with +// corresponding side tables. This should not run OOM +// (https://crbug.com/1168564). +// We use calls such that stack checks are executed reliably. +for (let i = 0; i < 500; ++i) body.push(...wasmI32Const(i), kExprI32Add); +const func_test = + builder.addFunction('test', kSig_i_i).addBody(body).exportFunc(); +const module_bytes = builder.toArray(); + +let paused = 0; +Protocol.Debugger.onPaused(msg => { + ++paused; + if (paused % 50 == 0) InspectorTest.log(`Paused ${paused} and running...`); + Protocol.Debugger.stepOver(); +}); + +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); + + InspectorTest.log('Got wasm script: ' + wasmScript.url); + + InspectorTest.log('Setting breakpoint'); + await Protocol.Debugger.setBreakpoint({ + location: { + scriptId: wasmScript.scriptId, + lineNumber: 0, + columnNumber: func_test.body_offset + } + }); + + await Protocol.Runtime.evaluate({ expression: 'instance.exports.test()' }); + InspectorTest.log('test function returned.'); + InspectorTest.log(`Paused ${paused} times.`); + } +]); diff --git a/deps/v8/test/inspector/debugger/wasm-step-after-trap-expected.txt b/deps/v8/test/inspector/debugger/wasm-step-after-trap-expected.txt index 3424b6987a..45d0d74e8d 100644 --- a/deps/v8/test/inspector/debugger/wasm-step-after-trap-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-step-after-trap-expected.txt @@ -7,11 +7,11 @@ Paused at: --- 0 --- Script wasm://wasm/a9a86c5e byte offset 46: Wasm opcode 0x6d (kExprI32DivS) scope at div (0:46): - $a: 1 - $b: 0 - $unused: 4711 - $local_zero: 0 - $local_const_11: 11 + $a: 1 (i32) + $b: 0 (i32) + $unused: 4711 (i32) + $local_zero: 0 (i32) + $local_const_11: 11 (i32) --- 1 --- try { instance.exports.#div(1, 0, 4711); // traps (div by zero) @@ -37,11 +37,11 @@ Paused at: --- 0 --- Script wasm://wasm/a9a86c5e byte offset 46: Wasm opcode 0x6d (kExprI32DivS) scope at div (0:46): - $a: -2147483648 - $b: -1 - $unused: 4711 - $local_zero: 0 - $local_const_11: 11 + $a: -2147483648 (i32) + $b: -1 (i32) + $unused: 4711 (i32) + $local_zero: 0 (i32) + $local_const_11: 11 (i32) --- 1 --- try { instance.exports.#div(0x80000000, -1, 4711); // traps (unrepresentable) diff --git a/deps/v8/test/inspector/debugger/wasm-step-after-trap.js b/deps/v8/test/inspector/debugger/wasm-step-after-trap.js index 6ccf83df58..fec9555ce8 100644 --- a/deps/v8/test/inspector/debugger/wasm-step-after-trap.js +++ b/deps/v8/test/inspector/debugger/wasm-step-after-trap.js @@ -80,8 +80,9 @@ async function printLocalScope(frame) { if (scope.type != 'local') continue; let properties = await Protocol.Runtime.getProperties( {'objectId': scope.object.objectId}); - for (let value of properties.result.result) { - InspectorTest.log(` ${value.name}: ${value.value.value}`); + for (let {name, value} of properties.result.result) { + value = await WasmInspectorTest.getWasmValue(value); + InspectorTest.log(` ${name}: ${value}`); } } } diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-no-opcode-merging-expected.txt b/deps/v8/test/inspector/debugger/wasm-stepping-no-opcode-merging-expected.txt index 066f5c354e..314f68db9a 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-no-opcode-merging-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-stepping-no-opcode-merging-expected.txt @@ -2,14 +2,14 @@ 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] -Paused at offset 36: [0, 1] -Paused at offset 33: [-1] -Paused at offset 35: [-1, -1] -Paused at offset 36: [-1, 0] -Paused at offset 38: [-1] -Paused at offset 33: [13] -Paused at offset 35: [13, 13] -Paused at offset 36: [13, 0] -Paused at offset 38: [13] +Paused at offset 33: [0 (i32)] +Paused at offset 35: [0 (i32), 0 (i32)] +Paused at offset 36: [0 (i32), 1 (i32)] +Paused at offset 33: [-1 (i32)] +Paused at offset 35: [-1 (i32), -1 (i32)] +Paused at offset 36: [-1 (i32), 0 (i32)] +Paused at offset 38: [-1 (i32)] +Paused at offset 33: [13 (i32)] +Paused at offset 35: [13 (i32), 13 (i32)] +Paused at offset 36: [13 (i32), 0 (i32)] +Paused at offset 38: [13 (i32)] diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-no-opcode-merging.js b/deps/v8/test/inspector/debugger/wasm-stepping-no-opcode-merging.js index 2522386f2a..4e4135a306 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-no-opcode-merging.js +++ b/deps/v8/test/inspector/debugger/wasm-stepping-no-opcode-merging.js @@ -56,8 +56,8 @@ async function printPauseLocationAndStep(msg) { if (scope.type == 'module') continue; let scope_properties = await Protocol.Runtime.getProperties({objectId: scope.object.objectId}); - scopes[scope.type] = scope_properties.result.result.map( - elem => WasmInspectorTest.getWasmValue(elem.value)); + scopes[scope.type] = await Promise.all(scope_properties.result.result.map( + elem => WasmInspectorTest.getWasmValue(elem.value))); } let values = scopes['local'].concat(scopes['wasm-expression-stack']).join(', '); InspectorTest.log(`Paused at offset ${loc.columnNumber}: [${values}]`); diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map-expected.txt b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map-expected.txt index 12865dec50..f9890d5a3a 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map-expected.txt @@ -14,9 +14,9 @@ Setting breakpoint on offset 54 (on the setlocal before the call), url wasm://wa Script wasm://wasm/9b4bf87e byte offset 54: Wasm opcode 0x21 (kExprLocalSet) at wasm_B (0:54): - scope (wasm-expression-stack): - {"0":3} + 0: 3 (i32) - scope (local): - {"$var0":4} + $var0: 4 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -26,9 +26,8 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 56: Wasm opcode 0x10 (kExprCallFunction) at wasm_B (0:56): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":3} + $var0: 3 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -38,16 +37,13 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 38: Wasm opcode 0x01 (kExprNop) at wasm_A (0:38): - scope (wasm-expression-stack): - {} - scope (local): - {} - scope (module): -- skipped at wasm_B (0:56): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":3} + $var0: 3 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -57,16 +53,13 @@ Debugger.stepOver called Script wasm://wasm/9b4bf87e byte offset 39: Wasm opcode 0x01 (kExprNop) at wasm_A (0:39): - scope (wasm-expression-stack): - {} - scope (local): - {} - scope (module): -- skipped at wasm_B (0:56): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":3} + $var0: 3 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -76,9 +69,8 @@ Debugger.stepOut called Script wasm://wasm/9b4bf87e byte offset 58: Wasm opcode 0x0c (kExprBr) at wasm_B (0:58): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":3} + $var0: 3 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -88,9 +80,9 @@ Debugger.stepOut called Script wasm://wasm/9b4bf87e byte offset 54: Wasm opcode 0x21 (kExprLocalSet) at wasm_B (0:54): - scope (wasm-expression-stack): - {"0":2} + 0: 2 (i32) - scope (local): - {"$var0":3} + $var0: 3 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -100,9 +92,8 @@ Debugger.stepOver called Script wasm://wasm/9b4bf87e byte offset 56: Wasm opcode 0x10 (kExprCallFunction) at wasm_B (0:56): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":2} + $var0: 2 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -112,9 +103,8 @@ Debugger.stepOver called Script wasm://wasm/9b4bf87e byte offset 58: Wasm opcode 0x0c (kExprBr) at wasm_B (0:58): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":2} + $var0: 2 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -124,9 +114,9 @@ Debugger.resume called Script wasm://wasm/9b4bf87e byte offset 54: Wasm opcode 0x21 (kExprLocalSet) at wasm_B (0:54): - scope (wasm-expression-stack): - {"0":1} + 0: 1 (i32) - scope (local): - {"$var0":2} + $var0: 2 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -136,9 +126,8 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 56: Wasm opcode 0x10 (kExprCallFunction) at wasm_B (0:56): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":1} + $var0: 1 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -148,16 +137,13 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 38: Wasm opcode 0x01 (kExprNop) at wasm_A (0:38): - scope (wasm-expression-stack): - {} - scope (local): - {} - scope (module): -- skipped at wasm_B (0:56): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":1} + $var0: 1 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -167,9 +153,8 @@ Debugger.stepOut called Script wasm://wasm/9b4bf87e byte offset 58: Wasm opcode 0x0c (kExprBr) at wasm_B (0:58): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":1} + $var0: 1 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -179,9 +164,8 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 45: Wasm opcode 0x20 (kExprLocalGet) at wasm_B (0:45): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":1} + $var0: 1 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -191,9 +175,9 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 47: Wasm opcode 0x04 (kExprIf) at wasm_B (0:47): - scope (wasm-expression-stack): - {"0":1} + 0: 1 (i32) - scope (local): - {"$var0":1} + $var0: 1 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -203,9 +187,8 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 49: Wasm opcode 0x20 (kExprLocalGet) at wasm_B (0:49): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":1} + $var0: 1 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -215,9 +198,9 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 51: Wasm opcode 0x41 (kExprI32Const) at wasm_B (0:51): - scope (wasm-expression-stack): - {"0":1} + 0: 1 (i32) - scope (local): - {"$var0":1} + $var0: 1 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -227,9 +210,10 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 53: Wasm opcode 0x6b (kExprI32Sub) at wasm_B (0:53): - scope (wasm-expression-stack): - {"0":1,"1":1} + 0: 1 (i32) + 1: 1 (i32) - scope (local): - {"$var0":1} + $var0: 1 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -239,9 +223,9 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 54: Wasm opcode 0x21 (kExprLocalSet) at wasm_B (0:54): - scope (wasm-expression-stack): - {"0":0} + 0: 0 (i32) - scope (local): - {"$var0":1} + $var0: 1 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -251,9 +235,8 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 56: Wasm opcode 0x10 (kExprCallFunction) at wasm_B (0:56): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":0} + $var0: 0 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -263,16 +246,13 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 38: Wasm opcode 0x01 (kExprNop) at wasm_A (0:38): - scope (wasm-expression-stack): - {} - scope (local): - {} - scope (module): -- skipped at wasm_B (0:56): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":0} + $var0: 0 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -282,16 +262,13 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 39: Wasm opcode 0x01 (kExprNop) at wasm_A (0:39): - scope (wasm-expression-stack): - {} - scope (local): - {} - scope (module): -- skipped at wasm_B (0:56): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":0} + $var0: 0 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -301,16 +278,13 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 40: Wasm opcode 0x0b (kExprEnd) at wasm_A (0:40): - scope (wasm-expression-stack): - {} - scope (local): - {} - scope (module): -- skipped at wasm_B (0:56): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":0} + $var0: 0 (i32) - scope (module): -- skipped at (anonymous) (0:17): @@ -320,9 +294,8 @@ Debugger.stepInto called Script wasm://wasm/9b4bf87e byte offset 58: Wasm opcode 0x0c (kExprBr) at wasm_B (0:58): - scope (wasm-expression-stack): - {} - scope (local): - {"$var0":0} + $var0: 0 (i32) - scope (module): -- skipped at (anonymous) (0:17): diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js index 18766b89e8..6cece203ae 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js +++ b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js @@ -91,15 +91,12 @@ async function waitForPauseAndStep(stepAction) { if (scope.type === 'global' || scope.type === 'module') { InspectorTest.logObject(' -- skipped'); } else { - const object = {}; - const {result: {result: properties}} = - await Protocol.Runtime.getProperties({ - objectId: scope.object.objectId - }); - for (const {name, value: {value}} of properties) { - object[name] = value; + let properties = await Protocol.Runtime.getProperties( + {objectId: scope.object.objectId}); + for (let {name, value} of properties.result.result) { + value = await WasmInspectorTest.getWasmValue(value); + InspectorTest.log(` ${name}: ${value}`); } - InspectorTest.log(` ${JSON.stringify(object)}`); } } } diff --git a/deps/v8/test/inspector/inspector.status b/deps/v8/test/inspector/inspector.status index ede16a957d..a98df5e010 100644 --- a/deps/v8/test/inspector/inspector.status +++ b/deps/v8/test/inspector/inspector.status @@ -19,6 +19,14 @@ # This test worked in the wasm interpreter, but fails when using Liftoff for # debugging. 'debugger/wasm-externref-global': [FAIL], + + # https://crbug.com/1080638 + # The initial CL only fixed the crash. The test still causes an endless + # loop instead of properly reporting a RangeError for a stack overflow. + 'regress/regress-crbug-1080638': [SKIP], + + # https://crbug.com/v8/11338 + 'runtime-call-stats/enable-disable': [PASS, ['verify_csa', SKIP]], }], # ALWAYS ############################################################################## @@ -47,6 +55,17 @@ }], # variant != default ############################################################################## +# TODO(v8:7777): Change this once wasm is supported in jitless mode. +['not has_webassembly or variant == jitless', { + 'debugger/asm-js-stack': [SKIP], + 'debugger/asm-js-breakpoint-before-exec': [SKIP], + 'debugger/asm-js-breakpoint-during-exec': [SKIP], + 'debugger/wasm-*': [SKIP], + 'cpu-profiler/console-profile-wasm': [SKIP], + 'runtime/get-properties': [SKIP], +}], # not has_webassembly or variant == jitless + +############################################################################## ['lite_mode or variant == jitless', { # Lite mode does not allocate feedback vector. 'type-profiler/type-profile-start-stop': [SKIP], @@ -54,13 +73,6 @@ 'type-profiler/type-profile-with-to-string-tag': [SKIP], 'type-profiler/type-profile-with-classes': [SKIP], 'type-profiler/type-profile-disable': [SKIP], - - # TODO(v8:7777): Re-enable once wasm is supported in jitless mode. - 'debugger/asm-js-stack': [SKIP], - 'debugger/asm-js-breakpoint-before-exec': [SKIP], - 'debugger/asm-js-breakpoint-during-exec': [SKIP], - 'debugger/wasm-*': [SKIP], - 'cpu-profiler/console-profile-wasm': [SKIP], }], # 'lite_mode or variant == jitless' ############################################################################## @@ -108,6 +120,12 @@ 'debugger/wasm-scope-info*': [SKIP], }], # '(arch == mipsel or arch == mips64el) and not simd_mips' +############################################################################## +['arch == riscv64', { + # SIMD support is still in progress. + 'debugger/wasm-scope-info*': [SKIP], +}], # 'arch == riscv64' + ################################################################################ ['variant == stress_snapshot', { '*': [SKIP], # only relevant for mjsunit tests. @@ -122,6 +140,10 @@ ['tsan == True', { # TSan handles SIGPROF incorrectly (https://crbug.com/v8/9869). 'cpu-profiler/console-profile-wasm': [SKIP], + + # This test is just slow on TSan, and TSan coverage is not needed to test + # that we do not run OOM. Thus skip it on TSan. + 'debugger/wasm-step-a-lot': [SKIP], }], # 'tsan == True' ############################################################################## diff --git a/deps/v8/test/inspector/isolate-data.cc b/deps/v8/test/inspector/isolate-data.cc index 3bd225ea1d..52eb76eabb 100644 --- a/deps/v8/test/inspector/isolate-data.cc +++ b/deps/v8/test/inspector/isolate-data.cc @@ -429,8 +429,8 @@ void IsolateData::installAdditionalCommandLineAPI( CHECK(context->GetIsolate() == isolate()); v8::HandleScope handle_scope(isolate()); v8::Context::Scope context_scope(context); - v8::ScriptOrigin origin( - v8::String::NewFromUtf8Literal(isolate(), "internal-console-api")); + v8::ScriptOrigin origin(isolate(), v8::String::NewFromUtf8Literal( + isolate(), "internal-console-api")); v8::ScriptCompiler::Source scriptSource( additional_console_api_.Get(isolate()), origin); v8::MaybeLocal<v8::Script> script = diff --git a/deps/v8/test/inspector/regress/regress-crbug-1080638-expected.txt b/deps/v8/test/inspector/regress/regress-crbug-1080638-expected.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/deps/v8/test/inspector/regress/regress-crbug-1080638-expected.txt diff --git a/deps/v8/test/inspector/regress/regress-crbug-1080638.js b/deps/v8/test/inspector/regress/regress-crbug-1080638.js new file mode 100644 index 0000000000..8ae7707d74 --- /dev/null +++ b/deps/v8/test/inspector/regress/regress-crbug-1080638.js @@ -0,0 +1,28 @@ +// Copyright 2020 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. + +const {Protocol} = InspectorTest.start('Recursive proxy prototype does not crash inspector crbug.com/1080638'); + +const reproductionCode = ` +const t = { id: 1 } +const p = new Proxy(t, { + get(target, prop, receiver) { + console.log(receiver); + return Reflect.get(target, prop); + } +}); + +const q = Object.create(p); +console.log(q.id); +`; + +(async function logPropertyWithProxyPrototype() { + await Protocol.Runtime.enable(); + const response = await Protocol.Runtime.evaluate({ + expression: reproductionCode, + replMode: true, + }); + InspectorTest.logMessage(response); + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/runtime/console-message-omit-data-urls-expected.txt b/deps/v8/test/inspector/runtime/console-message-omit-data-urls-expected.txt new file mode 100644 index 0000000000..b54aae3197 --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-message-omit-data-urls-expected.txt @@ -0,0 +1,6 @@ +Checks that we only send along non-data urls. +Test log with data uri. +console api called: Hello World! + callFrame: function test (url: ) + callFrame: function (url: test.js) +exception details: Uncaught ReferenceError: Exception is not defined (url: )
\ No newline at end of file diff --git a/deps/v8/test/inspector/runtime/console-message-omit-data-urls.js b/deps/v8/test/inspector/runtime/console-message-omit-data-urls.js new file mode 100644 index 0000000000..3400c692fa --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-message-omit-data-urls.js @@ -0,0 +1,63 @@ +// Copyright 2021 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. + +let {session, contextGroup, Protocol} = InspectorTest.start('Checks that we only send along non-data urls.'); + +var expectedMessages = 2; +var messages = []; + +Protocol.Runtime.enable(); +Protocol.Console.enable(); + +Protocol.Runtime.onConsoleAPICalled(consoleAPICalled); +Protocol.Runtime.onExceptionThrown(exceptionThrown); + +contextGroup.addScript(` +async function test() { + console.log("Hello World!"); + throw new Exception("Exception thrown"); +} +//# sourceURL=data:,pseudoDataUrl`); + +function consoleAPICalled(result) +{ + const msgText = result.params.args[0].value; + const callFrames = result.params.stackTrace.callFrames; + let messageParts = []; + messageParts.push(`console api called: ${msgText}`); + for (frame of callFrames) { + messageParts.push(` callFrame: function ${frame.functionName} (url: ${frame.url})`); + } + messages.push(messageParts.join("\n")); + + if (!(--expectedMessages)) { + done(); + } +} + +function exceptionThrown(result) +{ + const exceptionDetails = result.params.exceptionDetails; + const url = exceptionDetails.url; + const text = exceptionDetails.text; + messages.push(`exception details: ${text} (url: ${url ? url : ""})`) + + if (!(--expectedMessages)) { + done(); + } +} + +function done() +{ + messages.sort(); + for (var message of messages) { + InspectorTest.log(message); + } + InspectorTest.completeTest(); +} + +(async function test() { + InspectorTest.log('Test log with data uri.'); + await Protocol.Runtime.evaluate({ expression: `test()//# sourceURL=test.js`}); +})(); diff --git a/deps/v8/test/inspector/runtime/get-properties-expected.txt b/deps/v8/test/inspector/runtime/get-properties-expected.txt index 8a764d0b0c..33521c8281 100644 --- a/deps/v8/test/inspector/runtime/get-properties-expected.txt +++ b/deps/v8/test/inspector/runtime/get-properties-expected.txt @@ -105,6 +105,16 @@ Running test: testArrayBuffer [[ArrayBufferByteLength]] [[ArrayBufferData]] +Running test: testArrayBufferFromWebAssemblyMemory +[[Int8Array]] +[[Uint8Array]] +[[Int16Array]] +[[Int32Array]] +[[ArrayBufferByteLength]] +[[ArrayBufferData]] +[[WebAssemblyMemory]] + __proto__ own object undefined + Running test: testDetachedArrayBuffer [[IsDetached]] true diff --git a/deps/v8/test/inspector/runtime/get-properties.js b/deps/v8/test/inspector/runtime/get-properties.js index 737616ef4c..bc3ea8799f 100644 --- a/deps/v8/test/inspector/runtime/get-properties.js +++ b/deps/v8/test/inspector/runtime/get-properties.js @@ -57,6 +57,25 @@ InspectorTest.runAsyncTestSuite([ } }, + async function testArrayBufferFromWebAssemblyMemory() { + let objectId = await evaluateToObjectId('new WebAssembly.Memory({initial: 1}).buffer'); + let props = await Protocol.Runtime.getProperties({ objectId, ownProperties: true }); + for (let prop of props.result.result) { + if (prop.name === '__proto__') + continue; + InspectorTest.log(prop.name); + await logGetPropertiesResult(prop.value.objectId); + } + for (let prop of props.result.internalProperties) { + InspectorTest.log(prop.name); + // Skip printing the values of the virtual typed arrays. + if (/\[\[.*Array\]\]/.test(prop.name)) + continue; + if (prop.value.objectId) + await logGetPropertiesResult(prop.value.objectId); + } + }, + async function testDetachedArrayBuffer() { await Protocol.Runtime.evaluate({ expression: 'var a = new ArrayBuffer(16)' }); await Protocol.Runtime.evaluate({ expression: 'var b = new Uint32Array(a)' }); diff --git a/deps/v8/test/inspector/tasks.cc b/deps/v8/test/inspector/tasks.cc index 08c829e761..79f40c0e27 100644 --- a/deps/v8/test/inspector/tasks.cc +++ b/deps/v8/test/inspector/tasks.cc @@ -20,8 +20,8 @@ void ExecuteStringTask::Run(IsolateData* data) { v8::HandleScope handle_scope(data->isolate()); v8::Local<v8::Context> context = data->GetDefaultContext(context_group_id_); v8::Context::Scope context_scope(context); - v8::ScriptOrigin origin(ToV8String(data->isolate(), name_), line_offset_, - column_offset_, + v8::ScriptOrigin origin(data->isolate(), ToV8String(data->isolate(), name_), + line_offset_, column_offset_, /* resource_is_shared_cross_origin */ false, /* script_id */ -1, /* source_map_url */ v8::Local<v8::Value>(), diff --git a/deps/v8/test/inspector/wasm-inspector-test.js b/deps/v8/test/inspector/wasm-inspector-test.js index 67333dcbb6..47d8419055 100644 --- a/deps/v8/test/inspector/wasm-inspector-test.js +++ b/deps/v8/test/inspector/wasm-inspector-test.js @@ -7,25 +7,40 @@ utils.load('test/mjsunit/wasm/wasm-module-builder.js'); WasmInspectorTest = {} InspectorTest.getWasmOpcodeName = getOpcodeName; -WasmInspectorTest.evalWithUrl = (code, url) => - Protocol.Runtime - .evaluate({'expression': code + '\n//# sourceURL=v8://test/' + url}) - .then(printIfFailure); +WasmInspectorTest.evalWithUrl = async function(code, url) { + return await Protocol.Runtime + .evaluate({'expression': code + '\n//# sourceURL=v8://test/' + url}) + .then(printIfFailure); +}; -WasmInspectorTest.instantiateFromBuffer = function(bytes, imports) { +WasmInspectorTest.compileFromBuffer = (function(bytes) { var buffer = new ArrayBuffer(bytes.length); var view = new Uint8Array(buffer); for (var i = 0; i < bytes.length; ++i) { view[i] = bytes[i] | 0; } - const module = new WebAssembly.Module(buffer); - return new WebAssembly.Instance(module, imports); -} + return new WebAssembly.Module(buffer); +}).toString(); + +WasmInspectorTest.instantiateFromBuffer = + (function(bytes, imports) { + return new WebAssembly.Instance(compileFromBuffer(bytes), imports); + }) + .toString() + .replace('compileFromBuffer', WasmInspectorTest.compileFromBuffer); -WasmInspectorTest.instantiate = async function(bytes, instance_name = 'instance') { - const instantiate_code = `var ${instance_name} = (${WasmInspectorTest.instantiateFromBuffer})(${JSON.stringify(bytes)});`; +WasmInspectorTest.compile = async function(bytes, module_name = 'module') { + const compile_code = `var ${module_name} = (${ + WasmInspectorTest.compileFromBuffer})(${JSON.stringify(bytes)});`; + await WasmInspectorTest.evalWithUrl(compile_code, 'compile_module'); +}; + +WasmInspectorTest.instantiate = + async function(bytes, instance_name = 'instance') { + const instantiate_code = `var ${instance_name} = (${ + WasmInspectorTest.instantiateFromBuffer})(${JSON.stringify(bytes)});`; await WasmInspectorTest.evalWithUrl(instantiate_code, 'instantiate'); -} +}; WasmInspectorTest.dumpScopeProperties = async function(message) { printIfFailure(message); @@ -33,11 +48,17 @@ WasmInspectorTest.dumpScopeProperties = async function(message) { var value_str = await getScopeValues(value.name, value.value); InspectorTest.log(' ' + value.name + ': ' + value_str); } -} +}; -WasmInspectorTest.getWasmValue = value => { - return value.unserializableValue ?? value.value; -} +WasmInspectorTest.getWasmValue = async function(value) { + let msg = await Protocol.Runtime.getProperties({objectId: value.objectId}); + printIfFailure(msg); + const value_type = msg.result.result.find(({name}) => name === 'type'); + const value_value = msg.result.result.find(({name}) => name === 'value'); + return `${ + value_value.value.unserializableValue ?? + value_value.value.value} (${value_type.value.value})`; +}; function printIfFailure(message) { if (!message.result) { @@ -47,19 +68,29 @@ function printIfFailure(message) { } async function getScopeValues(name, value) { - if (value.type == 'object') { - if (value.subtype === 'typedarray' || value.subtype == 'webassemblymemory') return value.description; + async function printValue(value) { + if (value.type === 'object' && value.subtype === 'wasmvalue') { + return await WasmInspectorTest.getWasmValue(value); + } else if ('className' in value) { + return `(${value.className})`; + } + return `${value.unserializableValue ?? value.value} (${ + value.subtype ?? value.type})`; + } + if (value.type === 'object' && value.subtype !== 'wasmvalue') { + if (value.subtype === 'typedarray' || value.subtype == 'webassemblymemory') + return value.description; if (name === 'instance') return dumpInstanceProperties(value); if (name === 'module') return value.description; let msg = await Protocol.Runtime.getProperties({objectId: value.objectId}); printIfFailure(msg); - const printProperty = function({name, value}) { - return `"${name}": ${WasmInspectorTest.getWasmValue(value)} (${value.subtype ?? value.type})`; + async function printProperty({name, value}) { + return `"${name}": ${await printValue(value)}`; } - return msg.result.result.map(printProperty).join(', '); + return (await Promise.all(msg.result.result.map(printProperty))).join(', '); } - return `${WasmInspectorTest.getWasmValue(value)} (${value.subtype ?? value.type})`; + return await printValue(value); } function recursiveGetPropertiesWrapper(value, depth) { @@ -68,10 +99,12 @@ function recursiveGetPropertiesWrapper(value, depth) { async function recursiveGetProperties(value, depth) { if (depth > 0) { - const properties = await Promise.all(value.result.result.map( - x => {return Protocol.Runtime.getProperties({objectId: x.value.objectId});})); - const recursiveProperties = await Promise.all(properties.map( - x => {return recursiveGetProperties(x, depth - 1);})); + const properties = await Promise.all(value.result.result.map(x => { + return Protocol.Runtime.getProperties({objectId: x.value.objectId}); + })); + const recursiveProperties = await Promise.all(properties.map(x => { + return recursiveGetProperties(x, depth - 1); + })); return recursiveProperties.flat(); } return value; @@ -83,17 +116,17 @@ async function dumpInstanceProperties(instanceObj) { } const exportsName = 'exports'; - let exportsObj = await Protocol.Runtime.callFunctionOn( - {objectId: instanceObj.objectId, - functionDeclaration: invokeGetter.toString(), - arguments: [{value: JSON.stringify(exportsName)}] - }); + let exportsObj = await Protocol.Runtime.callFunctionOn({ + objectId: instanceObj.objectId, + functionDeclaration: invokeGetter.toString(), + arguments: [{value: JSON.stringify(exportsName)}] + }); printIfFailure(exportsObj); let exports = await Protocol.Runtime.getProperties( {objectId: exportsObj.result.result.objectId}); printIfFailure(exports); - const printExports = function(value) { + function printExports(value) { return `"${value.name}" (${value.value.className})`; } const formattedExports = exports.result.result.map(printExports).join(', '); |