diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-11-08 15:39:11 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-11-08 15:46:25 +0100 |
commit | 6ca81ad72a3c6fdf16c683335be748f22aaa9a0d (patch) | |
tree | 33c8ee75f729aed76c2c0b89c63f9bf1b4dd66aa /deps/v8/test/inspector | |
parent | 1eee0b8bf8bba39b600fb16a9223e545e3bac2bc (diff) | |
download | node-new-6ca81ad72a3c6fdf16c683335be748f22aaa9a0d.tar.gz |
deps: update V8 to 7.9.317.20
PR-URL: https://github.com/nodejs/node/pull/30020
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'deps/v8/test/inspector')
31 files changed, 506 insertions, 450 deletions
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 dc96406d4a..0541ce02bb 100644 --- a/deps/v8/test/inspector/cpu-profiler/console-profile-wasm.js +++ b/deps/v8/test/inspector/cpu-profiler/console-profile-wasm.js @@ -11,14 +11,14 @@ utils.load('test/mjsunit/wasm/wasm-module-builder.js'); var builder = new WasmModuleBuilder(); builder.addFunction('fib', kSig_i_i) .addBody([ - kExprGetLocal, 0, - kExprGetLocal, 0, + kExprLocalGet, 0, + kExprLocalGet, 0, kExprI32Const, 2, kExprI32LeS, // i < 2 ? kExprBrIf, 0, // --> return i kExprI32Const, 1, kExprI32Sub, // i - 1 kExprCallFunction, 0, // fib(i - 1) - kExprGetLocal, 0, kExprI32Const, 2, kExprI32Sub, // i - 2 + kExprLocalGet, 0, kExprI32Const, 2, kExprI32Sub, // i - 2 kExprCallFunction, 0, // fib(i - 2) kExprI32Add ]) diff --git a/deps/v8/test/inspector/debugger/class-fields-scopes-expected.txt b/deps/v8/test/inspector/debugger/class-fields-scopes-expected.txt index 4be4e96efe..28708d7950 100644 --- a/deps/v8/test/inspector/debugger/class-fields-scopes-expected.txt +++ b/deps/v8/test/inspector/debugger/class-fields-scopes-expected.txt @@ -110,26 +110,6 @@ Running test: testScopesPaused } [1] : { endLocation : { - columnNumber : 3 - lineNumber : 15 - scriptId : <scriptId> - } - name : run - object : { - className : Object - description : Object - objectId : <objectId> - type : object - } - startLocation : { - columnNumber : 9 - lineNumber : 11 - scriptId : <scriptId> - } - type : block - } - [2] : { - endLocation : { columnNumber : 1 lineNumber : 19 scriptId : <scriptId> @@ -148,7 +128,7 @@ Running test: testScopesPaused } type : local } - [3] : { + [2] : { object : { className : global description : global diff --git a/deps/v8/test/inspector/debugger/pause-on-async-call-expected.txt b/deps/v8/test/inspector/debugger/pause-on-async-call-expected.txt index 012ab4b0b9..4fb08f6319 100644 --- a/deps/v8/test/inspector/debugger/pause-on-async-call-expected.txt +++ b/deps/v8/test/inspector/debugger/pause-on-async-call-expected.txt @@ -30,13 +30,6 @@ paused at: paused at: debugger; - Promise.resolve().#then(v => v * 2); -} - -asyncCallStackTraceId is set - -paused at: - debugger; Promise.resolve().then(v => v #* 2); } @@ -54,13 +47,6 @@ paused at: paused at: debugger; - p.#then(v => v * 2); - resolveCallback(); - -asyncCallStackTraceId is set - -paused at: - debugger; p.then(v => v #* 2); resolveCallback(); @@ -78,13 +64,6 @@ paused at: paused at: debugger; - Promise.resolve().#then(v => v * 2); - Promise.resolve().then(v => v * 4); - -asyncCallStackTraceId is set - -paused at: - debugger; Promise.resolve().then(v => v #* 2); Promise.resolve().then(v => v * 4); @@ -107,13 +86,6 @@ paused at: paused at: Promise.resolve().then(v => v * 2); - Promise.resolve().#then(v => v * 4); -} - -asyncCallStackTraceId is set - -paused at: - Promise.resolve().then(v => v * 2); Promise.resolve().then(v => v #* 4); } @@ -130,13 +102,6 @@ paused at: debugger; paused at: - debugger; - Promise.resolve().#then(v => v * 2); - debugger; - -asyncCallStackTraceId is set - -paused at: Promise.resolve().then(v => v * 2); #debugger; Promise.resolve().then(v => v * 4); @@ -148,13 +113,6 @@ paused at: paused at: debugger; - Promise.resolve().#then(v => v * 4); -} - -asyncCallStackTraceId is set - -paused at: - debugger; Promise.resolve().then(v => v #* 4); } @@ -172,13 +130,6 @@ paused at: paused at: debugger; - Promise.all([ Promise.resolve(), Promise.resolve() ]).#then(v => v * 2); -} - -asyncCallStackTraceId is set - -paused at: - debugger; Promise.all([ Promise.resolve(), Promise.resolve() ]).then(v => v #* 2); } @@ -196,13 +147,6 @@ paused at: paused at: debugger; - createPromise().#then(v => v * 2); -} - -asyncCallStackTraceId is set - -paused at: - debugger; createPromise().then(v => v #* 2); } @@ -220,13 +164,6 @@ paused at: paused at: debugger; - createPromise().#then(v => v * 2); -} - -asyncCallStackTraceId is set - -paused at: - debugger; createPromise().then(v => v #* 2); } @@ -273,13 +210,6 @@ paused at: paused at: - await foo(); - foo().#then(boo); - - -asyncCallStackTraceId is set - -paused at: function boo() { #} } diff --git a/deps/v8/test/inspector/debugger/pause-on-async-call-set-timeout.js b/deps/v8/test/inspector/debugger/pause-on-async-call-set-timeout.js index be26bc11de..716d860f08 100644 --- a/deps/v8/test/inspector/debugger/pause-on-async-call-set-timeout.js +++ b/deps/v8/test/inspector/debugger/pause-on-async-call-set-timeout.js @@ -12,9 +12,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -26,9 +23,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - await Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); @@ -43,9 +37,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); await InspectorTest.waitForPendingTasks(); @@ -57,9 +48,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -69,20 +57,14 @@ InspectorTest.runAsyncTestSuite([ Protocol.Runtime.evaluate({expression: 'setTimeout(() => 42, 0)'}); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); } ]); async function waitPauseAndDumpLocation() { - var {params: {callFrames, asyncCallStackTraceId}} = + var {params: {callFrames}} = await Protocol.Debugger.oncePaused(); - if (!asyncCallStackTraceId) { - InspectorTest.log('paused at:'); - await session.logSourceLocation(callFrames[0].location); - } - return asyncCallStackTraceId; + InspectorTest.log('paused at:'); + await session.logSourceLocation(callFrames[0].location); } diff --git a/deps/v8/test/inspector/debugger/pause-on-async-call.js b/deps/v8/test/inspector/debugger/pause-on-async-call.js index 24e7fc6647..c6104a1ae2 100644 --- a/deps/v8/test/inspector/debugger/pause-on-async-call.js +++ b/deps/v8/test/inspector/debugger/pause-on-async-call.js @@ -90,9 +90,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -103,9 +100,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -116,9 +110,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepInto(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -131,9 +122,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -144,16 +132,10 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -164,9 +146,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -178,9 +157,6 @@ InspectorTest.runAsyncTestSuite([ await waitPauseAndDumpLocation(); await Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js'] }); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -192,9 +168,6 @@ InspectorTest.runAsyncTestSuite([ await waitPauseAndDumpLocation(); await Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']}); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); }, @@ -205,17 +178,11 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let parentStackTraceId = await waitPauseAndDumpLocation(); - if (parentStackTraceId) - InspectorTest.log( - 'ERROR: we should not report parent stack trace id on async call'); + await waitPauseAndDumpLocation(); Protocol.Debugger.stepOut(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - parentStackTraceId = await waitPauseAndDumpLocation(); - if (parentStackTraceId) - InspectorTest.log( - 'ERROR: we should not report parent stack trace id on async call'); + await waitPauseAndDumpLocation(); Protocol.Debugger.stepOut(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); @@ -223,9 +190,6 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOut(); await waitPauseAndDumpLocation(); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - parentStackTraceId = await waitPauseAndDumpLocation(); - Protocol.Debugger.pauseOnAsyncCall({parentStackTraceId}); - Protocol.Debugger.resume(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); @@ -233,12 +197,8 @@ InspectorTest.runAsyncTestSuite([ ]); async function waitPauseAndDumpLocation() { - var {params: {callFrames, asyncCallStackTraceId}} = + var {params: {callFrames}} = await Protocol.Debugger.oncePaused(); InspectorTest.log('paused at:'); await session.logSourceLocation(callFrames[0].location); - if (asyncCallStackTraceId) { - InspectorTest.log('asyncCallStackTraceId is set\n'); - } - return asyncCallStackTraceId; } diff --git a/deps/v8/test/inspector/debugger/step-into-break-on-async-call-expected.txt b/deps/v8/test/inspector/debugger/step-into-break-on-async-call-expected.txt index 5f61c89c1a..72f896567f 100644 --- a/deps/v8/test/inspector/debugger/step-into-break-on-async-call-expected.txt +++ b/deps/v8/test/inspector/debugger/step-into-break-on-async-call-expected.txt @@ -1,13 +1,7 @@ Test for Debugger.stepInto with breakOnAsyncCall. Running test: testSetTimeout -(anonymous) (test.js:0:0) -asyncCallStackTraceId is set (anonymous) (test.js:0:17) -asyncCallStackTraceId is empty Running test: testPromiseThen -(anonymous) (test.js:0:2) -asyncCallStackTraceId is set (anonymous) (test.js:0:13) -asyncCallStackTraceId is empty diff --git a/deps/v8/test/inspector/debugger/step-into-break-on-async-call.js b/deps/v8/test/inspector/debugger/step-into-break-on-async-call.js index d47df9f7eb..417f4a3936 100644 --- a/deps/v8/test/inspector/debugger/step-into-break-on-async-call.js +++ b/deps/v8/test/inspector/debugger/step-into-break-on-async-call.js @@ -17,21 +17,8 @@ InspectorTest.runAsyncTestSuite([ }); await pausedPromise; Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let {params: {callFrames, asyncCallStackTraceId}} = - await Protocol.Debugger.oncePaused(); + let {params: {callFrames}} = await Protocol.Debugger.oncePaused(); session.logCallFrames(callFrames); - if (asyncCallStackTraceId) { - InspectorTest.log('asyncCallStackTraceId is set'); - } - Protocol.Debugger.pauseOnAsyncCall( - {parentStackTraceId: asyncCallStackTraceId}); - pausedPromise = Protocol.Debugger.oncePaused(); - Protocol.Debugger.resume(); - ({params: {callFrames, asyncCallStackTraceId}} = await pausedPromise); - session.logCallFrames(callFrames); - if (!asyncCallStackTraceId) { - InspectorTest.log('asyncCallStackTraceId is empty'); - } await Protocol.Debugger.disable(); }, @@ -45,21 +32,8 @@ InspectorTest.runAsyncTestSuite([ Protocol.Runtime.evaluate({expression: 'p.then(() => 42)//# sourceURL=test.js'}); await pausedPromise; Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let {params: {callFrames, asyncCallStackTraceId}} = - await Protocol.Debugger.oncePaused(); - session.logCallFrames(callFrames); - if (asyncCallStackTraceId) { - InspectorTest.log('asyncCallStackTraceId is set'); - } - Protocol.Debugger.pauseOnAsyncCall( - {parentStackTraceId: asyncCallStackTraceId}); - pausedPromise = Protocol.Debugger.oncePaused(); - Protocol.Debugger.resume(); - ({params: {callFrames, asyncCallStackTraceId}} = await pausedPromise); + let {params: {callFrames}} = await Protocol.Debugger.oncePaused(); session.logCallFrames(callFrames); - if (!asyncCallStackTraceId) { - InspectorTest.log('asyncCallStackTraceId is empty'); - } await Protocol.Debugger.disable(); } ]); diff --git a/deps/v8/test/inspector/debugger/step-into-external-async-task-expected.txt b/deps/v8/test/inspector/debugger/step-into-external-async-task-expected.txt index 8bf702b355..ce82054f06 100644 --- a/deps/v8/test/inspector/debugger/step-into-external-async-task-expected.txt +++ b/deps/v8/test/inspector/debugger/step-into-external-async-task-expected.txt @@ -2,7 +2,6 @@ Test for step-into remote async task Setup debugger agents.. Pause before stack trace is captured.. Run stepInto with breakOnAsyncCall flag -Call pauseOnAsyncCall Trigger external async task on another context group Dump stack trace boo (target.js:1:22) diff --git a/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context-expected.txt b/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context-expected.txt index 4b2fba9856..ba93facf00 100644 --- a/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context-expected.txt +++ b/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context-expected.txt @@ -2,7 +2,6 @@ Test for step-into remote async task. Setup debugger agents.. Pause before stack trace is captured.. Run stepInto with breakOnAsyncCall flag -Call pauseOnAsyncCall Trigger external async task on another context group Dump stack trace boo (target.js:1:22) diff --git a/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context.js b/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context.js index fec786422e..132c0690f1 100644 --- a/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context.js +++ b/deps/v8/test/inspector/debugger/step-into-external-async-task-same-context.js @@ -42,13 +42,6 @@ session.setupScriptMap(); InspectorTest.log('Run stepInto with breakOnAsyncCall flag'); Protocol.Debugger.stepInto({breakOnAsyncCall: true}); - let {params: {asyncCallStackTraceId}} = await Protocol.Debugger.oncePaused(); - - InspectorTest.log('Call pauseOnAsyncCall'); - Protocol.Debugger.pauseOnAsyncCall({ - parentStackTraceId: asyncCallStackTraceId, - }); - Protocol.Debugger.resume(); InspectorTest.log('Trigger external async task on another context group'); let stackTraceId = (await evaluatePromise).result.result.value; diff --git a/deps/v8/test/inspector/debugger/step-into-external-async-task.js b/deps/v8/test/inspector/debugger/step-into-external-async-task.js index b0d55c950d..59b78c1630 100644 --- a/deps/v8/test/inspector/debugger/step-into-external-async-task.js +++ b/deps/v8/test/inspector/debugger/step-into-external-async-task.js @@ -62,13 +62,6 @@ session2.setupScriptMap(); InspectorTest.log('Run stepInto with breakOnAsyncCall flag'); Protocol1.Debugger.stepInto({breakOnAsyncCall: true}); - let {params: {asyncCallStackTraceId}} = await Protocol1.Debugger.oncePaused(); - - InspectorTest.log('Call pauseOnAsyncCall'); - Protocol2.Debugger.pauseOnAsyncCall({ - parentStackTraceId: asyncCallStackTraceId, - }); - Protocol1.Debugger.resume(); InspectorTest.log('Trigger external async task on another context group'); let stackTraceId = (await evaluatePromise).result.result.value; diff --git a/deps/v8/test/inspector/debugger/wasm-anyref-global.js b/deps/v8/test/inspector/debugger/wasm-anyref-global.js index d4c88ac694..d9f63d2d20 100644 --- a/deps/v8/test/inspector/debugger/wasm-anyref-global.js +++ b/deps/v8/test/inspector/debugger/wasm-anyref-global.js @@ -15,7 +15,7 @@ let {session, contextGroup, Protocol} = builder.addImportedGlobal('m', 'global', kWasmAnyRef, false); builder.addFunction('func', kSig_v_v) .addBody([ - kExprGetGlobal, 0, // + kExprGlobalGet, 0, // kExprDrop, // ]) .exportAs('main'); diff --git a/deps/v8/test/inspector/debugger/wasm-clone-module-expected.txt b/deps/v8/test/inspector/debugger/wasm-clone-module-expected.txt index fba9bb4cf2..d07f035f78 100644 --- a/deps/v8/test/inspector/debugger/wasm-clone-module-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-clone-module-expected.txt @@ -1,5 +1,5 @@ Tests that cloning a module notifies the debugger -Got URL: wasm://wasm/wasm-cae8f226/wasm-cae8f226-0 -Got URL: wasm://wasm/wasm-cae8f226/wasm-cae8f226-0 -Got URL: wasm://wasm/wasm-cae8f226/wasm-cae8f226-0 +Got URL: wasm://wasm/wasm-95d1e44e/wasm-95d1e44e-0 +Got URL: wasm://wasm/wasm-95d1e44e/wasm-95d1e44e-0 +Got URL: wasm://wasm/wasm-95d1e44e/wasm-95d1e44e-0 Done! diff --git a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-expected.txt b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-expected.txt index 8fec6bc2df..519d77911b 100644 --- a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-expected.txt @@ -2,9 +2,9 @@ Tests breakable locations in wasm Running testFunction... Script nr 0 parsed. URL: v8://test/setup Script nr 1 parsed. URL: v8://test/runTestFunction -Script nr 2 parsed. URL: wasm://wasm/wasm-354ada0e/wasm-354ada0e-0 +Script nr 2 parsed. URL: wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0 This is a wasm script (nr 0). -Script nr 3 parsed. URL: wasm://wasm/wasm-354ada0e/wasm-354ada0e-1 +Script nr 3 parsed. URL: wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1 This is a wasm script (nr 1). Querying breakable locations for all wasm scripts now... Requesting all breakable locations in wasm script 0 @@ -38,51 +38,51 @@ Requesting breakable locations in lines [4,6) [0] 4:6 || >call 0 [1] 5:4 || >end Setting a breakpoint on each breakable location... -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:2:2 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:2:2 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:3:2 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:3:2 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:4:2 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:4:2 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:5:0 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:5:0 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:1:2 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:1:2 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:2:2 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:2:2 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:3:4 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:3:4 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:4:6 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:4:6 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:5:4 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:5:4 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:6:2 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:6:2 Success! -Setting at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:7:0 +Setting at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:7:0 Success! Running wasm code... Missing breakpoints: 11 Script nr 4 parsed. URL: v8://test/runWasm -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:1:2 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:1:2 Missing breakpoints: 10 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:2:2 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:2:2 Missing breakpoints: 9 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:3:4 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:3:4 Missing breakpoints: 8 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:4:6 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:4:6 Missing breakpoints: 7 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:2:2 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:2:2 Missing breakpoints: 6 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:3:2 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:3:2 Missing breakpoints: 5 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:4:2 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:4:2 Missing breakpoints: 4 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-0:5:0 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-0:5:0 Missing breakpoints: 3 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:5:4 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:5:4 Missing breakpoints: 2 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:6:2 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:6:2 Missing breakpoints: 1 -Stopped at wasm://wasm/wasm-354ada0e/wasm-354ada0e-1:7:0 +Stopped at wasm://wasm/wasm-6a95b41e/wasm-6a95b41e-1:7:0 Missing breakpoints: 0 Finished! diff --git a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js index f0c20b3955..62f50749f3 100644 --- a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js +++ b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js @@ -16,12 +16,12 @@ var func_idx = builder.addFunction('helper', kSig_v_v) .addBody([ kExprNop, kExprI32Const, 12, - kExprSetLocal, 0, + kExprLocalSet, 0, ]).index; builder.addFunction('main', kSig_v_i) .addBody([ - kExprGetLocal, 0, + kExprLocalGet, 0, kExprIf, kWasmStmt, kExprBlock, kWasmStmt, kExprCallFunction, func_idx, diff --git a/deps/v8/test/inspector/debugger/wasm-reset-context-group.js b/deps/v8/test/inspector/debugger/wasm-reset-context-group.js index c1353da86b..a9a096d65b 100644 --- a/deps/v8/test/inspector/debugger/wasm-reset-context-group.js +++ b/deps/v8/test/inspector/debugger/wasm-reset-context-group.js @@ -12,7 +12,7 @@ var builder = new WasmModuleBuilder(); builder.addFunction('wasm_func', kSig_i_i) .addBody([ // clang-format off - kExprGetLocal, 0, + kExprLocalGet, 0, kExprI32Const, 1, kExprI32Sub, // clang-format on diff --git a/deps/v8/test/inspector/debugger/wasm-scope-info.js b/deps/v8/test/inspector/debugger/wasm-scope-info.js index 116b0ce146..2a5e2961ac 100644 --- a/deps/v8/test/inspector/debugger/wasm-scope-info.js +++ b/deps/v8/test/inspector/debugger/wasm-scope-info.js @@ -41,21 +41,21 @@ async function instantiateWasm() { ['i32Arg', undefined, 'i64_local', 'unicode☼f64']) .addBody([ // Set param 0 to 11. - kExprI32Const, 11, kExprSetLocal, 0, + kExprI32Const, 11, kExprLocalSet, 0, // Set local 1 to 47. - kExprI32Const, 47, kExprSetLocal, 1, + kExprI32Const, 47, kExprLocalSet, 1, // Set local 2 to 0x7FFFFFFFFFFFFFFF (max i64). kExprI64Const, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, - kExprSetLocal, 2, + kExprLocalSet, 2, // Set local 2 to 0x8000000000000000 (min i64). kExprI64Const, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x7f, - kExprSetLocal, 2, + kExprLocalSet, 2, // Set local 3 to 1/7. kExprI32Const, 1, kExprF64UConvertI32, kExprI32Const, 7, - kExprF64UConvertI32, kExprF64Div, kExprSetLocal, 3, + kExprF64UConvertI32, kExprF64Div, kExprLocalSet, 3, // Set global 0 to 15 - kExprI32Const, 15, kExprSetGlobal, 0, + kExprI32Const, 15, kExprGlobalSet, 0, ]) .exportAs('main'); diff --git a/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt b/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt index 0afcc861c4..210292c858 100644 --- a/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt @@ -1,16 +1,23 @@ Tests how wasm scripts are reported -Check that inspector gets two wasm scripts at module creation time. -Script #0 parsed. URL: v8://test/testFunction -Script #1 parsed. URL: -Script #2 parsed. URL: v8://test/runTestRunction -Script #3 parsed. URL: wasm://wasm/wasm-7b04570e/wasm-7b04570e-0 -Script #4 parsed. URL: wasm://wasm/wasm-7b04570e/wasm-7b04570e-1 -Source for wasm://wasm/wasm-7b04570e/wasm-7b04570e-0: +Check that each inspector gets two wasm scripts at module creation time. +Session #1: Script #0 parsed. URL: wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-0. Source map URL: +Session #1: Script #1 parsed. URL: wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-1. Source map URL: +Session #2: Script #0 parsed. URL: wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-0. Source map URL: +Session #2: Script #1 parsed. URL: wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-1. Source map URL: +Session #1: Script #2 parsed. URL: wasm://wasm/wasm-74f86b7e. Source map URL: wasm://dwarf +Session #2: Script #2 parsed. URL: wasm://wasm/wasm-74f86b7e. Source map URL: wasm://dwarf +Session #1: Script #3 parsed. URL: wasm://wasm/wasm-3754e3fe. Source map URL: abc +Session #2: Script #3 parsed. URL: wasm://wasm/wasm-3754e3fe. Source map URL: abc +Session #1: Script #4 parsed. URL: wasm://wasm/wasm-2bd2e40e. Source map URL: abc +Session #2: Script #4 parsed. URL: wasm://wasm/wasm-2bd2e40e. Source map URL: abc +Session #1: Script #5 parsed. URL: wasm://wasm/wasm-f568e726. Source map URL: abc +Session #2: Script #5 parsed. URL: wasm://wasm/wasm-f568e726. Source map URL: abc +Session #1: Source for wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-0: func $nopFunction nop end -Source for wasm://wasm/wasm-7b04570e/wasm-7b04570e-1: +Session #1: Source for wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-1: func $main block i32.const 2 @@ -18,3 +25,48 @@ func $main end end +Session #2: Source for wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-0: +func $nopFunction + nop +end + +Session #2: Source for wasm://wasm/wasm-f608ae1e/wasm-f608ae1e-1: +func $main + block + i32.const 2 + drop + end +end + +Session #1: Source for wasm://wasm/wasm-74f86b7e: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] +Session #2: Source for wasm://wasm/wasm-74f86b7e: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] +Session #1: Source for wasm://wasm/wasm-3754e3fe: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] +Session #2: Source for wasm://wasm/wasm-3754e3fe: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] +Session #1: Source for wasm://wasm/wasm-2bd2e40e: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] +Session #2: Source for wasm://wasm/wasm-2bd2e40e: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] +Session #1: Source for wasm://wasm/wasm-f568e726: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] +Session #2: Source for wasm://wasm/wasm-f568e726: +Raw: 00 61 73 6d 01 00 00 00 01 07 02 60 00 00 60 00 00 03 03 02 00 01 07 08 01 04 6d 61 69 6e 00 01 0a 0e 02 03 00 01 0b 08 00 02 40 41 02 1a 0b 0b 00 15 10 73 6f 75 72 63 65 4d 61 70 70 69 6e 67 55 52 4c 03 61 62 63 00 11 0b 2e 64 65 62 75 67 5f 69 6e 66 6f 01 02 03 04 05 00 1b 04 6e 61 6d 65 01 14 02 00 0b 6e 6f 70 46 75 6e 63 74 69 6f 6e 01 04 6d 61 69 6e +Imports: [] +Exports: [main: function] diff --git a/deps/v8/test/inspector/debugger/wasm-scripts.js b/deps/v8/test/inspector/debugger/wasm-scripts.js index 04e5ec88c1..72d886b0e5 100644 --- a/deps/v8/test/inspector/debugger/wasm-scripts.js +++ b/deps/v8/test/inspector/debugger/wasm-scripts.js @@ -4,68 +4,140 @@ // Flags: --expose-wasm -let {session, contextGroup, Protocol} = InspectorTest.start('Tests how wasm scripts are reported'); +InspectorTest.log("Tests how wasm scripts are reported"); -utils.load('test/mjsunit/wasm/wasm-module-builder.js'); +let contextGroup = new InspectorTest.ContextGroup(); +let sessions = [ + // Main session. + trackScripts(), + // Extra session to verify that all inspectors get same messages. + // See https://bugs.chromium.org/p/v8/issues/detail?id=9725. + trackScripts(), +]; -// Add two empty functions. Both should be registered as individual scripts at -// module creation time. -var builder = new WasmModuleBuilder(); -builder.addFunction('nopFunction', kSig_v_v).addBody([kExprNop]); -builder.addFunction('main', kSig_v_v) - .addBody([kExprBlock, kWasmStmt, kExprI32Const, 2, kExprDrop, kExprEnd]) - .exportAs('main'); -var module_bytes = builder.toArray(); +utils.load('test/mjsunit/wasm/wasm-module-builder.js'); -function testFunction(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; +// Create module with given custom sections. +function createModule(...customSections) { + var builder = new WasmModuleBuilder(); + builder.addFunction('nopFunction', kSig_v_v).addBody([kExprNop]); + builder.addFunction('main', kSig_v_v) + .addBody([kExprBlock, kWasmStmt, kExprI32Const, 2, kExprDrop, kExprEnd]) + .exportAs('main'); + for (var { name, value } of customSections) { + builder.addCustomSection(name, value); } + return builder.toArray(); +} +function testFunction(bytes) { // Compilation triggers registration of wasm scripts. - new WebAssembly.Module(buffer); + new WebAssembly.Module(new Uint8Array(bytes)); } contextGroup.addScript(testFunction.toString(), 0, 0, 'v8://test/testFunction'); -contextGroup.addScript('var module_bytes = ' + JSON.stringify(module_bytes)); -Protocol.Debugger.enable(); -Protocol.Debugger.onScriptParsed(handleScriptParsed); InspectorTest.log( - 'Check that inspector gets two wasm scripts at module creation time.'); -Protocol.Runtime + 'Check that each inspector gets two wasm scripts at module creation time.'); + +// Sample .debug_info section. +// Content doesn't matter, as we don't try to parse it in V8, +// but should be non-empty to check that we're skipping it correctly. +const dwarfSection = { name: '.debug_info', value: [1, 2, 3, 4, 5] }; + +// Sample sourceMappingURL section set to "abc". +const sourceMapSection = { name: 'sourceMappingURL', value: [3, 97, 98, 99] }; + +sessions[0].Protocol.Runtime .evaluate({ - 'expression': '//# sourceURL=v8://test/runTestRunction\n' + - 'testFunction(module_bytes)' + 'expression': `//# sourceURL=v8://test/runTestRunction + + // no debug info + testFunction([${createModule()}]); + + // DWARF + testFunction([${createModule(dwarfSection)}]); + + // Source map + testFunction([${createModule(sourceMapSection)}]); + + // DWARF + source map + testFunction([${createModule(dwarfSection, sourceMapSection)}]); + + // Source map + DWARF (different order) + testFunction([${createModule(sourceMapSection, dwarfSection)}]); + ` }) - .then(checkFinished); + .then(() => ( + // At this point all scripts were parsed. + // Stop tracking and wait for script sources in each session. + Promise.all(sessions.map(session => session.getScripts())) + )) + .catch(err => { + InspectorTest.log(err.stack); + }) + .then(() => InspectorTest.completeTest()); + +function decodeBase64(base64) { + const LOOKUP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + + const paddingLength = base64.match(/=*$/)[0].length; + const bytesLength = base64.length * 0.75 - paddingLength; -var num_scripts = 0; -var missing_sources = 0; + let bytes = new Uint8Array(bytesLength); + + for (let i = 0, p = 0; i < base64.length; i += 4, p += 3) { + let bits = 0; + for (let j = 0; j < 4; j++) { + bits <<= 6; + const c = base64[i + j]; + if (c !== '=') bits |= LOOKUP.indexOf(c); + } + for (let j = p + 2; j >= p; j--) { + if (j < bytesLength) bytes[j] = bits; + bits >>= 8; + } + } -function checkFinished() { - if (missing_sources == 0) - InspectorTest.completeTest(); + return bytes; } -function handleScriptParsed(messageObject) -{ - var url = messageObject.params.url; - InspectorTest.log("Script #" + num_scripts + " parsed. URL: " + url); - ++num_scripts; - - if (url.startsWith("wasm://")) { - ++missing_sources; - function dumpScriptSource(message) { - InspectorTest.log("Source for " + url + ":"); - InspectorTest.log(message.result.scriptSource); - --missing_sources; +function trackScripts(debuggerParams) { + let {id: sessionId, Protocol} = contextGroup.connect(); + let scripts = []; + + Protocol.Debugger.enable(debuggerParams); + Protocol.Debugger.onScriptParsed(handleScriptParsed); + + async function loadScript({url, scriptId, sourceMapURL}) { + InspectorTest.log(`Session #${sessionId}: Script #${scripts.length} parsed. URL: ${url}. Source map URL: ${sourceMapURL}`); + let scriptSource; + if (sourceMapURL) { + let {result: {bytecode}} = await Protocol.Debugger.getWasmBytecode({scriptId}); + // Binary value is represented as base64 in JSON, decode it. + bytecode = decodeBase64(bytecode); + // Check that it can be parsed back to a WebAssembly module. + let module = new WebAssembly.Module(bytecode); + scriptSource = ` +Raw: ${Array.from(bytecode, b => ('0' + b.toString(16)).slice(-2)).join(' ')} +Imports: [${WebAssembly.Module.imports(module).map(i => `${i.name}: ${i.kind} from "${i.module}"`).join(', ')}] +Exports: [${WebAssembly.Module.exports(module).map(e => `${e.name}: ${e.kind}`).join(', ')}] + `.trim(); + } else { + ({result: {scriptSource}} = await Protocol.Debugger.getScriptSource({scriptId})); } + InspectorTest.log(`Session #${sessionId}: Source for ${url}:`); + InspectorTest.log(scriptSource); + } - Protocol.Debugger.getScriptSource({scriptId: messageObject.params.scriptId}) - .then(dumpScriptSource.bind(null)) - .then(checkFinished); + function handleScriptParsed({params}) { + if (params.url.startsWith("wasm://")) { + scripts.push(loadScript(params)); + } } + + return { + Protocol, + getScripts: () => Promise.all(scripts), + }; } 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 406d39dd95..29ee78c65a 100644 --- a/deps/v8/test/inspector/debugger/wasm-set-breakpoint-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-set-breakpoint-expected.txt @@ -1,13 +1,13 @@ Tests stepping through wasm scripts. Instantiating. Waiting for two wasm scripts (ignoring first non-wasm script). -Source of script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0: +Source of script wasm://wasm/wasm-18214bfe/wasm-18214bfe-0: 1: func $wasm_A 2: nop 3: nop 4: end -Source of script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1: +Source of script wasm://wasm/wasm-18214bfe/wasm-18214bfe-1: 1: func $wasm_B (param i32) 2: loop 3: local.get 0 @@ -22,12 +22,12 @@ Source of script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1: 12: end 13: end -Setting breakpoint on line 8 on script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 -Setting breakpoint on line 7 on script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 -Setting breakpoint on line 6 on script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 -Setting breakpoint on line 5 on script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 -Setting breakpoint on line 3 on script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 -Setting breakpoint on line 4 on script wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 +Setting breakpoint on line 8 on script wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 +Setting breakpoint on line 7 on script wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 +Setting breakpoint on line 6 on script wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 +Setting breakpoint on line 5 on script wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 +Setting breakpoint on line 3 on script wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 +Setting breakpoint on line 4 on script wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 Calling main(4) Breaking on line 3 Breaking on line 4 diff --git a/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js b/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js index a9b676f8a7..1696a0f59c 100644 --- a/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js +++ b/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js @@ -17,12 +17,12 @@ builder.addFunction('wasm_B', kSig_v_i) .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprCallFunction, func_a_idx, // - kExprBr, 1, // continue kExprEnd, // - diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt b/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt index c951dce4ba..4a1fd58f2b 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt @@ -3,10 +3,10 @@ Installing code an global variable. Calling instantiate function. Waiting for two wasm scripts to be parsed. Ignoring script with url v8://test/callInstantiate -Got wasm script: wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0 -Requesting source for wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0... -Got wasm script: wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 -Requesting source for wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1... +Got wasm script: wasm://wasm/wasm-18214bfe/wasm-18214bfe-0 +Requesting source for wasm://wasm/wasm-18214bfe/wasm-18214bfe-0... +Got wasm script: wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 +Requesting source for wasm://wasm/wasm-18214bfe/wasm-18214bfe-1... func $wasm_A nop nop @@ -26,13 +26,13 @@ func $wasm_B (param i32) end end -Setting breakpoint on line 7 (on the setlocal before the call), url wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1 +Setting breakpoint on line 7 (on the setlocal before the call), url wasm://wasm/wasm-18214bfe/wasm-18214bfe-1 { columnNumber : 6 lineNumber : 7 scriptId : <scriptId> } -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:7:6: >local.set 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:7:6: >local.set 0 at wasm_B (7:6): - scope (global): -- skipped @@ -43,7 +43,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:8:6: >call 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:8:6: >call 0 at wasm_B (8:6): - scope (global): -- skipped @@ -54,7 +54,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:1:2: >nop +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-0:1:2: >nop at wasm_A (1:2): - scope (global): -- skipped @@ -70,7 +70,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOver called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:2:2: >nop +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-0:2:2: >nop at wasm_A (2:2): - scope (global): -- skipped @@ -86,7 +86,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOut called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:9:6: >br 1 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:9:6: >br 1 at wasm_B (9:6): - scope (global): -- skipped @@ -97,7 +97,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOut called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:7:6: >local.set 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:7:6: >local.set 0 at wasm_B (7:6): - scope (global): -- skipped @@ -108,7 +108,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOver called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:8:6: >call 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:8:6: >call 0 at wasm_B (8:6): - scope (global): -- skipped @@ -119,7 +119,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOver called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:9:6: >br 1 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:9:6: >br 1 at wasm_B (9:6): - scope (global): -- skipped @@ -130,7 +130,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.resume called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:7:6: >local.set 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:7:6: >local.set 0 at wasm_B (7:6): - scope (global): -- skipped @@ -141,7 +141,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:8:6: >call 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:8:6: >call 0 at wasm_B (8:6): - scope (global): -- skipped @@ -152,7 +152,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:1:2: >nop +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-0:1:2: >nop at wasm_A (1:2): - scope (global): -- skipped @@ -168,7 +168,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOut called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:9:6: >br 1 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:9:6: >br 1 at wasm_B (9:6): - scope (global): -- skipped @@ -179,7 +179,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:1:2: >loop +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:1:2: >loop at wasm_B (1:2): - scope (global): -- skipped @@ -190,7 +190,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:2:4: >local.get 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:2:4: >local.get 0 at wasm_B (2:4): - scope (global): -- skipped @@ -201,7 +201,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:3:4: >if +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:3:4: >if at wasm_B (3:4): - scope (global): -- skipped @@ -212,7 +212,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:4:6: >local.get 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:4:6: >local.get 0 at wasm_B (4:6): - scope (global): -- skipped @@ -223,7 +223,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:5:6: >i32.const 1 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:5:6: >i32.const 1 at wasm_B (5:6): - scope (global): -- skipped @@ -234,7 +234,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:6:6: >i32.sub +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:6:6: >i32.sub at wasm_B (6:6): - scope (global): -- skipped @@ -245,7 +245,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:7:6: >local.set 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:7:6: >local.set 0 at wasm_B (7:6): - scope (global): -- skipped @@ -256,7 +256,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:8:6: >call 0 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:8:6: >call 0 at wasm_B (8:6): - scope (global): -- skipped @@ -267,7 +267,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:1:2: >nop +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-0:1:2: >nop at wasm_A (1:2): - scope (global): -- skipped @@ -283,7 +283,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:2:2: >nop +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-0:2:2: >nop at wasm_A (2:2): - scope (global): -- skipped @@ -299,7 +299,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:3:0: >end +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-0:3:0: >end at wasm_A (3:0): - scope (global): -- skipped @@ -315,7 +315,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:9:6: >br 1 +Paused at wasm://wasm/wasm-18214bfe/wasm-18214bfe-1:9:6: >br 1 at wasm_B (9:6): - scope (global): -- skipped 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 34f9cf1df9..325049fffb 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 @@ -1,16 +1,16 @@ Tests stepping through wasm scripts with source maps Installing code an global variable and instantiate. -Got wasm script: wasm-9b4bf87e +Got wasm script: wasm://wasm/wasm-3697f0fe Script sourceMapURL: abc -Requesting source for wasm-9b4bf87e... +Requesting source for wasm://wasm/wasm-3697f0fe... Source retrieved without error: true -Setting breakpoint on offset 54 (on the setlocal before the call), url wasm-9b4bf87e +Setting breakpoint on offset 54 (on the setlocal before the call), url wasm://wasm/wasm-3697f0fe { columnNumber : 54 lineNumber : 0 scriptId : <scriptId> } -Paused at wasm-9b4bf87e:0:54 +Paused at wasm://wasm/wasm-3697f0fe:0:54 at wasm_B (0:54): - scope (global): -- skipped @@ -21,7 +21,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:56 +Paused at wasm://wasm/wasm-3697f0fe:0:56 at wasm_B (0:56): - scope (global): -- skipped @@ -32,7 +32,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:38 +Paused at wasm://wasm/wasm-3697f0fe:0:38 at wasm_A (0:38): - scope (global): -- skipped @@ -48,7 +48,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOver called -Paused at wasm-9b4bf87e:0:39 +Paused at wasm://wasm/wasm-3697f0fe:0:39 at wasm_A (0:39): - scope (global): -- skipped @@ -64,7 +64,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOut called -Paused at wasm-9b4bf87e:0:58 +Paused at wasm://wasm/wasm-3697f0fe:0:58 at wasm_B (0:58): - scope (global): -- skipped @@ -75,7 +75,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOut called -Paused at wasm-9b4bf87e:0:54 +Paused at wasm://wasm/wasm-3697f0fe:0:54 at wasm_B (0:54): - scope (global): -- skipped @@ -86,7 +86,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOver called -Paused at wasm-9b4bf87e:0:56 +Paused at wasm://wasm/wasm-3697f0fe:0:56 at wasm_B (0:56): - scope (global): -- skipped @@ -97,7 +97,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOver called -Paused at wasm-9b4bf87e:0:58 +Paused at wasm://wasm/wasm-3697f0fe:0:58 at wasm_B (0:58): - scope (global): -- skipped @@ -108,7 +108,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.resume called -Paused at wasm-9b4bf87e:0:54 +Paused at wasm://wasm/wasm-3697f0fe:0:54 at wasm_B (0:54): - scope (global): -- skipped @@ -119,7 +119,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:56 +Paused at wasm://wasm/wasm-3697f0fe:0:56 at wasm_B (0:56): - scope (global): -- skipped @@ -130,7 +130,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:38 +Paused at wasm://wasm/wasm-3697f0fe:0:38 at wasm_A (0:38): - scope (global): -- skipped @@ -146,7 +146,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepOut called -Paused at wasm-9b4bf87e:0:58 +Paused at wasm://wasm/wasm-3697f0fe:0:58 at wasm_B (0:58): - scope (global): -- skipped @@ -157,7 +157,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:43 +Paused at wasm://wasm/wasm-3697f0fe:0:43 at wasm_B (0:43): - scope (global): -- skipped @@ -168,7 +168,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:45 +Paused at wasm://wasm/wasm-3697f0fe:0:45 at wasm_B (0:45): - scope (global): -- skipped @@ -179,7 +179,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:47 +Paused at wasm://wasm/wasm-3697f0fe:0:47 at wasm_B (0:47): - scope (global): -- skipped @@ -190,7 +190,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:49 +Paused at wasm://wasm/wasm-3697f0fe:0:49 at wasm_B (0:49): - scope (global): -- skipped @@ -201,7 +201,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:51 +Paused at wasm://wasm/wasm-3697f0fe:0:51 at wasm_B (0:51): - scope (global): -- skipped @@ -212,7 +212,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:53 +Paused at wasm://wasm/wasm-3697f0fe:0:53 at wasm_B (0:53): - scope (global): -- skipped @@ -223,7 +223,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:54 +Paused at wasm://wasm/wasm-3697f0fe:0:54 at wasm_B (0:54): - scope (global): -- skipped @@ -234,7 +234,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:56 +Paused at wasm://wasm/wasm-3697f0fe:0:56 at wasm_B (0:56): - scope (global): -- skipped @@ -245,7 +245,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:38 +Paused at wasm://wasm/wasm-3697f0fe:0:38 at wasm_A (0:38): - scope (global): -- skipped @@ -261,7 +261,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:39 +Paused at wasm://wasm/wasm-3697f0fe:0:39 at wasm_A (0:39): - scope (global): -- skipped @@ -277,7 +277,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:40 +Paused at wasm://wasm/wasm-3697f0fe:0:40 at wasm_A (0:40): - scope (global): -- skipped @@ -293,7 +293,7 @@ at (anonymous) (0:17): - scope (global): -- skipped Debugger.stepInto called -Paused at wasm-9b4bf87e:0:58 +Paused at wasm://wasm/wasm-3697f0fe:0:58 at wasm_B (0:58): - scope (global): -- skipped 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 1c9ec95577..57b2fd581c 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 @@ -17,12 +17,12 @@ builder.addFunction('wasm_B', kSig_v_i) .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprCallFunction, func_a_idx, // - kExprBr, 1, // continue kExprEnd, // - diff --git a/deps/v8/test/inspector/debugger/wasm-stepping.js b/deps/v8/test/inspector/debugger/wasm-stepping.js index 0fda6b73be..01d83b6696 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping.js +++ b/deps/v8/test/inspector/debugger/wasm-stepping.js @@ -6,9 +6,9 @@ let {session, contextGroup, Protocol} = InspectorTest.start('Tests stepping thro utils.load('test/mjsunit/wasm/wasm-module-builder.js'); -var builder = new WasmModuleBuilder(); +let builder = new WasmModuleBuilder(); -var func_a_idx = +let func_a_idx = builder.addFunction('wasm_A', kSig_v_v).addBody([kExprNop, kExprNop]).index; // wasm_B calls wasm_A <param0> times. @@ -16,12 +16,12 @@ builder.addFunction('wasm_B', kSig_v_i) .addBody([ // clang-format off kExprLoop, kWasmStmt, // while - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprIf, kWasmStmt, // if <param0> != 0 - kExprGetLocal, 0, // - + kExprLocalGet, 0, // - kExprI32Const, 1, // - kExprI32Sub, // - - kExprSetLocal, 0, // decrease <param0> + kExprLocalSet, 0, // decrease <param0> kExprCallFunction, func_a_idx, // - kExprBr, 1, // continue kExprEnd, // - @@ -30,26 +30,26 @@ builder.addFunction('wasm_B', kSig_v_i) ]) .exportAs('main'); -var module_bytes = builder.toArray(); +let module_bytes = builder.toArray(); function instantiate(bytes) { - var buffer = new ArrayBuffer(bytes.length); - var view = new Uint8Array(buffer); - for (var i = 0; i < bytes.length; ++i) { + let buffer = new ArrayBuffer(bytes.length); + let view = new Uint8Array(buffer); + for (let i = 0; i < bytes.length; ++i) { view[i] = bytes[i] | 0; } - var module = new WebAssembly.Module(buffer); + let module = new WebAssembly.Module(buffer); // Set global variable. instance = new WebAssembly.Instance(module); } -var evalWithUrl = (code, url) => Protocol.Runtime.evaluate( +let evalWithUrl = (code, url) => Protocol.Runtime.evaluate( {'expression': code + '\n//# sourceURL=v8://test/' + url}); Protocol.Debugger.onPaused(handlePaused); -var wasm_B_scriptId; -var step_actions = [ +let wasm_B_scriptId; +let step_actions = [ 'stepInto', // == stepOver, to call instruction 'stepInto', // into call to wasm_A 'stepOver', // over first nop @@ -69,38 +69,33 @@ var step_actions = [ // then just resume. 'resume' ]; -for (var action of step_actions) { +for (let action of step_actions) { InspectorTest.logProtocolCommandCalls('Debugger.' + action) } -var sources = {}; -var urls = {}; -var afterTwoSourcesCallback; - -Protocol.Debugger.enable() - .then(() => InspectorTest.log('Installing code an global variable.')) - .then( - () => evalWithUrl('var instance;\n' + instantiate.toString(), 'setup')) - .then(() => InspectorTest.log('Calling instantiate function.')) - .then( - () => - (evalWithUrl( - 'instantiate(' + JSON.stringify(module_bytes) + ')', - 'callInstantiate'), - 0)) - .then(waitForTwoWasmScripts) - .then( - () => InspectorTest.log( - 'Setting breakpoint on line 7 (on the setlocal before the call), url ' + - urls[wasm_B_scriptId])) - .then( - () => Protocol.Debugger.setBreakpoint( - {'location': {'scriptId': wasm_B_scriptId, 'lineNumber': 7}})) - .then(printFailure) - .then(msg => InspectorTest.logMessage(msg.result.actualLocation)) - .then(() => evalWithUrl('instance.exports.main(4)', 'runWasm')) - .then(() => InspectorTest.log('exports.main returned!')) - .then(() => InspectorTest.log('Finished!')) - .then(InspectorTest.completeTest); +let sources = {}; +let urls = {}; +let afterTwoSourcesCallback; + +(async function Test() { + await Protocol.Debugger.enable(); + InspectorTest.log('Installing code an global variable.'); + await evalWithUrl('var instance;\n' + instantiate.toString(), 'setup'); + InspectorTest.log('Calling instantiate function.'); + evalWithUrl( + 'instantiate(' + JSON.stringify(module_bytes) + ')', 'callInstantiate'); + await waitForTwoWasmScripts(); + InspectorTest.log( + 'Setting breakpoint on line 7 (on the setlocal before the call), url ' + + urls[wasm_B_scriptId]); + let msg = await Protocol.Debugger.setBreakpoint( + {'location': {'scriptId': wasm_B_scriptId, 'lineNumber': 7}}); + printFailure(msg); + InspectorTest.logMessage(msg.result.actualLocation); + await evalWithUrl('instance.exports.main(4)', 'runWasm'); + InspectorTest.log('exports.main returned!'); + InspectorTest.log('Finished!'); + InspectorTest.completeTest(); +})(); function printFailure(message) { if (!message.result) { @@ -109,41 +104,37 @@ function printFailure(message) { return message; } -function waitForTwoWasmScripts() { - var num = 0; +async function waitForTwoWasmScripts() { + let num = 0; InspectorTest.log('Waiting for two wasm scripts to be parsed.'); - var promise = new Promise(fulfill => gotBothSources = fulfill); - function waitForMore() { - if (num == 2) return promise; - Protocol.Debugger.onceScriptParsed() - .then(handleNewScript) - .then(waitForMore); + let source_promises = []; + async function getWasmSource(scriptId) { + let msg = await Protocol.Debugger.getScriptSource({scriptId: scriptId}); + printFailure(msg); + InspectorTest.log(msg.result.scriptSource); + sources[scriptId] = msg.result.scriptSource; } - function handleNewScript(msg) { - var url = msg.params.url; + while (num < 2) { + let msg = await Protocol.Debugger.onceScriptParsed(); + let url = msg.params.url; if (!url.startsWith('wasm://')) { InspectorTest.log('Ignoring script with url ' + url); - return; + continue; } num += 1; - var scriptId = msg.params.scriptId; + let scriptId = msg.params.scriptId; urls[scriptId] = url; InspectorTest.log('Got wasm script: ' + url); if (url.substr(-2) == '-1') wasm_B_scriptId = scriptId; InspectorTest.log('Requesting source for ' + url + '...'); - Protocol.Debugger.getScriptSource({scriptId: scriptId}) - .then(printFailure) - .then(msg => sources[scriptId] = msg.result.scriptSource) - .then(InspectorTest.log) - .then(() => Object.keys(sources).length == 2 ? gotBothSources() : 0); + source_promises.push(getWasmSource(scriptId)); } - waitForMore(); - return promise; + await Promise.all(source_promises); } function printPauseLocation(scriptId, lineNr, columnNr) { - var lines = sources[scriptId].split('\n'); - var line = '<illegal line number>'; + let lines = sources[scriptId].split('\n'); + let line = '<illegal line number>'; if (lineNr < lines.length) { line = lines[lineNr]; if (columnNr < line.length) { @@ -157,7 +148,7 @@ function printPauseLocation(scriptId, lineNr, columnNr) { async function getValueString(value) { if (value.type == 'object') { - var msg = await Protocol.Runtime.callFunctionOn({ + let msg = await Protocol.Runtime.callFunctionOn({ objectId: value.objectId, functionDeclaration: 'function () { return JSON.stringify(this); }' }); @@ -169,24 +160,24 @@ async function getValueString(value) { async function dumpProperties(message) { printFailure(message); - for (var value of message.result.result) { - var value_str = await getValueString(value.value); + for (let value of message.result.result) { + let value_str = await getValueString(value.value); InspectorTest.log(' ' + value.name + ': ' + value_str); } } async function dumpScopeChainsOnPause(message) { - for (var frame of message.params.callFrames) { - var functionName = frame.functionName || '(anonymous)'; - var lineNumber = frame.location ? frame.location.lineNumber : frame.lineNumber; - var columnNumber = frame.location ? frame.location.columnNumber : frame.columnNumber; + for (let frame of message.params.callFrames) { + let functionName = frame.functionName || '(anonymous)'; + let lineNumber = frame.location ? frame.location.lineNumber : frame.lineNumber; + let columnNumber = frame.location ? frame.location.columnNumber : frame.columnNumber; InspectorTest.log(`at ${functionName} (${lineNumber}:${columnNumber}):`); - for (var scope of frame.scopeChain) { + for (let scope of frame.scopeChain) { InspectorTest.logObject(' - scope (' + scope.type + '):'); if (scope.type == 'global') { InspectorTest.logObject(' -- skipped'); } else { - var properties = await Protocol.Runtime.getProperties( + let properties = await Protocol.Runtime.getProperties( {'objectId': scope.object.objectId}); await dumpProperties(properties); } @@ -194,9 +185,10 @@ async function dumpScopeChainsOnPause(message) { } } -function handlePaused(msg) { - var loc = msg.params.callFrames[0].location; +async function handlePaused(msg) { + let loc = msg.params.callFrames[0].location; printPauseLocation(loc.scriptId, loc.lineNumber, loc.columnNumber); - dumpScopeChainsOnPause(msg) - .then(Protocol.Debugger[step_actions.shift() || 'resume']); + await dumpScopeChainsOnPause(msg); + let action = step_actions.shift() || 'resume'; + await Protocol.Debugger[action](); } diff --git a/deps/v8/test/inspector/inspector-test.cc b/deps/v8/test/inspector/inspector-test.cc index 0a4cd48e92..0f39bc9417 100644 --- a/deps/v8/test/inspector/inspector-test.cc +++ b/deps/v8/test/inspector/inspector-test.cc @@ -968,8 +968,8 @@ class InspectorExtension : public IsolateData::SetupGlobalTask { data->StoreCurrentStackTrace(description_view); v8::Local<v8::ArrayBuffer> buffer = v8::ArrayBuffer::New(isolate, sizeof(id)); - *static_cast<v8_inspector::V8StackTraceId*>(buffer->GetContents().Data()) = - id; + *static_cast<v8_inspector::V8StackTraceId*>( + buffer->GetBackingStore()->Data()) = id; args.GetReturnValue().Set(buffer); } @@ -983,7 +983,7 @@ class InspectorExtension : public IsolateData::SetupGlobalTask { IsolateData* data = IsolateData::FromContext(context); v8_inspector::V8StackTraceId* id = static_cast<v8_inspector::V8StackTraceId*>( - args[0].As<v8::ArrayBuffer>()->GetContents().Data()); + args[0].As<v8::ArrayBuffer>()->GetBackingStore()->Data()); data->ExternalAsyncTaskStarted(*id); } @@ -997,7 +997,7 @@ class InspectorExtension : public IsolateData::SetupGlobalTask { IsolateData* data = IsolateData::FromContext(context); v8_inspector::V8StackTraceId* id = static_cast<v8_inspector::V8StackTraceId*>( - args[0].As<v8::ArrayBuffer>()->GetContents().Data()); + args[0].As<v8::ArrayBuffer>()->GetBackingStore()->Data()); data->ExternalAsyncTaskFinished(*id); } diff --git a/deps/v8/test/inspector/isolate-data.cc b/deps/v8/test/inspector/isolate-data.cc index ae41264072..8011007e34 100644 --- a/deps/v8/test/inspector/isolate-data.cc +++ b/deps/v8/test/inspector/isolate-data.cc @@ -61,8 +61,9 @@ IsolateData::IsolateData(TaskRunner* task_runner, : task_runner_(task_runner), setup_global_tasks_(std::move(setup_global_tasks)) { v8::Isolate::CreateParams params; - params.array_buffer_allocator = - v8::ArrayBuffer::Allocator::NewDefaultAllocator(); + array_buffer_allocator_.reset( + v8::ArrayBuffer::Allocator::NewDefaultAllocator()); + params.array_buffer_allocator = array_buffer_allocator_.get(); params.snapshot_blob = startup_data; params.only_terminate_in_safe_scope = true; isolate_.reset(v8::Isolate::New(params)); diff --git a/deps/v8/test/inspector/isolate-data.h b/deps/v8/test/inspector/isolate-data.h index d569ab11e0..fc15c3b5f3 100644 --- a/deps/v8/test/inspector/isolate-data.h +++ b/deps/v8/test/inspector/isolate-data.h @@ -6,6 +6,7 @@ #define V8_TEST_INSPECTOR_PROTOCOL_ISOLATE_DATA_H_ #include <map> +#include <memory> #include "include/v8-inspector.h" #include "include/v8-platform.h" @@ -129,6 +130,7 @@ class IsolateData : public v8_inspector::V8InspectorClient { TaskRunner* task_runner_; SetupGlobalTasks setup_global_tasks_; + std::unique_ptr<v8::ArrayBuffer::Allocator> array_buffer_allocator_; std::unique_ptr<v8::Isolate, IsolateDeleter> isolate_; std::unique_ptr<v8_inspector::V8Inspector> inspector_; int last_context_group_id_ = 0; diff --git a/deps/v8/test/inspector/runtime/evaluate-with-disable-breaks-expected.txt b/deps/v8/test/inspector/runtime/evaluate-with-disable-breaks-expected.txt new file mode 100644 index 0000000000..a6be5b9121 --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-with-disable-breaks-expected.txt @@ -0,0 +1,72 @@ +Tests that Runtime.evaluate can run with breaks disabled. +Test disableBreaks: false +paused +{ + id : <messageId> + result : { + result : { + type : undefined + } + } +} +Test disableBreaks: true +{ + id : <messageId> + result : { + result : { + type : undefined + } + } +} +Test calling out with disableBreaks: false +paused +{ + id : <messageId> + result : { + result : { + type : undefined + } + } +} +Test calling out with disableBreaks: true +{ + id : <messageId> + result : { + result : { + type : undefined + } + } +} +Test Debugger.pause with disableBreaks: false +{ + id : <messageId> + result : { + } +} +paused +{ + id : <messageId> + result : { + result : { + description : 1 + type : number + value : 1 + } + } +} +Test Debugger.pause with disableBreaks: true +{ + id : <messageId> + result : { + } +} +{ + id : <messageId> + result : { + result : { + description : 1 + type : number + value : 1 + } + } +} diff --git a/deps/v8/test/inspector/runtime/evaluate-with-disable-breaks.js b/deps/v8/test/inspector/runtime/evaluate-with-disable-breaks.js new file mode 100644 index 0000000000..43ddc5278c --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-with-disable-breaks.js @@ -0,0 +1,60 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let {session, contextGroup, Protocol} = InspectorTest.start("Tests that Runtime.evaluate can run with breaks disabled."); + +session.setupScriptMap(); +contextGroup.addScript(` + function f() { + debugger; + } //# sourceURL=test.js`); +Protocol.Runtime.enable(); +Protocol.Debugger.enable(); + +Protocol.Debugger.onPaused(message => { + InspectorTest.log("paused"); + Protocol.Debugger.resume(); +}); + +(async function() { + InspectorTest.log("Test disableBreaks: false"); + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ + expression: "debugger;", + disableBreaks: false + })); + + InspectorTest.log("Test disableBreaks: true"); + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ + expression: "debugger;", + disableBreaks: true + })); + + InspectorTest.log("Test calling out with disableBreaks: false"); + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ + expression: "f();", + disableBreaks: false + })); + + InspectorTest.log("Test calling out with disableBreaks: true"); + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ + expression: "f();", + disableBreaks: true + })); + + InspectorTest.log("Test Debugger.pause with disableBreaks: false"); + InspectorTest.logMessage(await Protocol.Debugger.pause()); + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ + expression: "1", + disableBreaks: false + })); + + InspectorTest.log("Test Debugger.pause with disableBreaks: true"); + InspectorTest.logMessage(await Protocol.Debugger.pause()); + InspectorTest.logMessage(await Protocol.Runtime.evaluate({ + expression: "1", + disableBreaks: true + })); + + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/task-runner.h b/deps/v8/test/inspector/task-runner.h index 41a5729571..afc3c39ab2 100644 --- a/deps/v8/test/inspector/task-runner.h +++ b/deps/v8/test/inspector/task-runner.h @@ -6,6 +6,7 @@ #define V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ #include <map> +#include <memory> #include "include/v8-inspector.h" #include "include/v8-platform.h" |