Commit a0b09281 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[inspector] Expose "stack" as proper scope property.

This is the V8 side change for https://crrev.com/c/2744048, which an
explicit "stack" property into the (renamed) "Expression" scope to align
the behavior and appearance of that scope with the other scopes.

Fixed: chromium:1159310
Bug: chromium:1071432, chromium:1159307
Change-Id: Ic070c50b674d8c1cff4a93538f708cc431c3f2cb
Screenshot: https://imgur.com/a/ryFiOGA.png
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2748591
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarPhilip Pfaffe <pfaffe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73321}
parent f86e6c15
......@@ -732,7 +732,10 @@ class DebugWasmScopeIterator final : public debug::ScopeIterator {
return Utils::ToLocal(LocalsProxy::Create(frame_));
}
case debug::ScopeIterator::ScopeTypeWasmExpressionStack: {
return Utils::ToLocal(StackProxy::Create(frame_));
auto object = isolate->factory()->NewJSObjectWithNullProto();
auto stack = StackProxy::Create(frame_);
JSObject::AddProperty(isolate, object, "stack", stack, FROZEN);
return Utils::ToLocal(object);
}
default:
UNREACHABLE();
......
......@@ -165,8 +165,15 @@ Protocol.Debugger.onPaused(async msg => {
}
for (var scope of frame.scopeChain) {
InspectorTest.logObject(' - scope (' + scope.type + '):');
var properties = await Protocol.Runtime.getProperties(
{'objectId': scope.object.objectId});
var { objectId } = scope.object;
if (scope.type == 'wasm-expression-stack') {
objectId = (await Protocol.Runtime.callFunctionOn({
functionDeclaration: 'function() { return this.stack }',
objectId
})).result.result.objectId;
}
var properties =
await Protocol.Runtime.getProperties({objectId});
await WasmInspectorTest.dumpScopeProperties(properties);
if (scope.type === 'wasm-expression-stack' || scope.type === 'local') {
for (var value of properties.result.result) {
......
......@@ -22,8 +22,15 @@ Protocol.Debugger.onPaused(async msg => {
var frame = msg.params.callFrames[0];
for (var scope of frame.scopeChain) {
if (scope.type == 'module') continue;
var { objectId } = scope.object;
if (scope.type == 'wasm-expression-stack') {
objectId = (await Protocol.Runtime.callFunctionOn({
functionDeclaration: 'function() { return this.stack }',
objectId
})).result.result.objectId;
}
var scope_properties =
await Protocol.Runtime.getProperties({objectId: scope.object.objectId});
await Protocol.Runtime.getProperties({objectId});
let str = (await Promise.all(scope_properties.result.result.map(
elem => WasmInspectorTest.getWasmValue(elem.value))))
.join(', ');
......
......@@ -15,6 +15,7 @@ Script wasm://wasm/e33badc2 byte offset 169: Wasm opcode 0x20 (kExprLocalGet)
Scope:
at C (interpreted) (0:169):
- scope (wasm-expression-stack):
stack:
- scope (local):
$i32_arg: 42 (i32)
$i32_local: 0 (i32)
......@@ -28,8 +29,7 @@ at C (interpreted) (0:169):
tables: "$exported_table": (Table)
at B (liftoff) (0:158):
- scope (wasm-expression-stack):
0: 42 (i32)
1: 3 (i32)
stack: "0": 42 (i32), "1": 3 (i32)
- scope (local):
$i32_arg: 42 (i32)
$i32_local: 0 (i32)
......@@ -46,6 +46,7 @@ at B (liftoff) (0:158):
tables: "$exported_table": (Table)
at A (liftoff) (0:128):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 42 (i32)
- scope (module):
......@@ -64,7 +65,7 @@ Script wasm://wasm/e33badc2 byte offset 171: Wasm opcode 0x24 (kExprGlobalSet)
Scope:
at C (interpreted) (0:171):
- scope (wasm-expression-stack):
0: 42 (i32)
stack: "0": 42 (i32)
- scope (local):
$i32_arg: 42 (i32)
$i32_local: 0 (i32)
......@@ -78,8 +79,7 @@ at C (interpreted) (0:171):
tables: "$exported_table": (Table)
at B (liftoff) (0:158):
- scope (wasm-expression-stack):
0: 42 (i32)
1: 3 (i32)
stack: "0": 42 (i32), "1": 3 (i32)
- scope (local):
$i32_arg: 42 (i32)
$i32_local: 0 (i32)
......@@ -96,6 +96,7 @@ at B (liftoff) (0:158):
tables: "$exported_table": (Table)
at A (liftoff) (0:128):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 42 (i32)
- scope (module):
......@@ -114,6 +115,7 @@ Script wasm://wasm/e33badc2 byte offset 173: Wasm opcode 0x41 (kExprI32Const)
Scope:
at C (interpreted) (0:173):
- scope (wasm-expression-stack):
stack:
- scope (local):
$i32_arg: 42 (i32)
$i32_local: 0 (i32)
......@@ -127,8 +129,7 @@ at C (interpreted) (0:173):
tables: "$exported_table": (Table)
at B (liftoff) (0:158):
- scope (wasm-expression-stack):
0: 42 (i32)
1: 3 (i32)
stack: "0": 42 (i32), "1": 3 (i32)
- scope (local):
$i32_arg: 42 (i32)
$i32_local: 0 (i32)
......@@ -145,6 +146,7 @@ at B (liftoff) (0:158):
tables: "$exported_table": (Table)
at A (liftoff) (0:128):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 42 (i32)
- scope (module):
......@@ -163,7 +165,7 @@ Script wasm://wasm/e33badc2 byte offset 175: Wasm opcode 0x21 (kExprLocalSet)
Scope:
at C (interpreted) (0:175):
- scope (wasm-expression-stack):
0: 47 (i32)
stack: "0": 47 (i32)
- scope (local):
$i32_arg: 42 (i32)
$i32_local: 0 (i32)
......@@ -177,8 +179,7 @@ at C (interpreted) (0:175):
tables: "$exported_table": (Table)
at B (liftoff) (0:158):
- scope (wasm-expression-stack):
0: 42 (i32)
1: 3 (i32)
stack: "0": 42 (i32), "1": 3 (i32)
- scope (local):
$i32_arg: 42 (i32)
$i32_local: 0 (i32)
......@@ -195,6 +196,7 @@ at B (liftoff) (0:158):
tables: "$exported_table": (Table)
at A (liftoff) (0:128):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 42 (i32)
- scope (module):
......@@ -213,6 +215,7 @@ Script wasm://wasm/e33badc2 byte offset 177: Wasm opcode 0x0b (kExprEnd)
Scope:
at C (interpreted) (0:177):
- scope (wasm-expression-stack):
stack:
- scope (local):
$i32_arg: 42 (i32)
$i32_local: 47 (i32)
......@@ -226,8 +229,7 @@ at C (interpreted) (0:177):
tables: "$exported_table": (Table)
at B (liftoff) (0:158):
- scope (wasm-expression-stack):
0: 42 (i32)
1: 3 (i32)
stack: "0": 42 (i32), "1": 3 (i32)
- scope (local):
$i32_arg: 42 (i32)
$i32_local: 0 (i32)
......@@ -244,6 +246,7 @@ at B (liftoff) (0:158):
tables: "$exported_table": (Table)
at A (liftoff) (0:128):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 42 (i32)
- scope (module):
......@@ -262,8 +265,7 @@ Script wasm://wasm/e33badc2 byte offset 160: Wasm opcode 0x1a (kExprDrop)
Scope:
at B (liftoff) (0:160):
- scope (wasm-expression-stack):
0: 42 (i32)
1: 3 (i32)
stack: "0": 42 (i32), "1": 3 (i32)
- scope (local):
$i32_arg: 42 (i32)
$i32_local: 0 (i32)
......@@ -280,6 +282,7 @@ at B (liftoff) (0:160):
tables: "$exported_table": (Table)
at A (liftoff) (0:128):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 42 (i32)
- scope (module):
......@@ -298,7 +301,7 @@ Script wasm://wasm/e33badc2 byte offset 161: Wasm opcode 0x1a (kExprDrop)
Scope:
at B (liftoff) (0:161):
- scope (wasm-expression-stack):
0: 42 (i32)
stack: "0": 42 (i32)
- scope (local):
$i32_arg: 42 (i32)
$i32_local: 0 (i32)
......@@ -315,6 +318,7 @@ at B (liftoff) (0:161):
tables: "$exported_table": (Table)
at A (liftoff) (0:128):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 42 (i32)
- scope (module):
......@@ -333,6 +337,7 @@ Script wasm://wasm/e33badc2 byte offset 162: Wasm opcode 0x0b (kExprEnd)
Scope:
at B (liftoff) (0:162):
- scope (wasm-expression-stack):
stack:
- scope (local):
$i32_arg: 42 (i32)
$i32_local: 0 (i32)
......@@ -349,6 +354,7 @@ at B (liftoff) (0:162):
tables: "$exported_table": (Table)
at A (liftoff) (0:128):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 42 (i32)
- scope (module):
......@@ -367,6 +373,7 @@ Script wasm://wasm/e33badc2 byte offset 130: Wasm opcode 0x0b (kExprEnd)
Scope:
at A (liftoff) (0:130):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 42 (i32)
- scope (module):
......
......@@ -10,6 +10,7 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 (kExprNop)
Scope:
at wasm_A (0:38):
- scope (wasm-expression-stack):
stack:
- scope (local):
- scope (module):
instance: exports: "main" (Function)
......@@ -17,6 +18,7 @@ at wasm_A (0:38):
functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 3 (i32)
- scope (module):
......@@ -39,6 +41,7 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 (kExprNop)
Scope:
at wasm_A (0:39):
- scope (wasm-expression-stack):
stack:
- scope (local):
- scope (module):
instance: exports: "main" (Function)
......@@ -46,6 +49,7 @@ at wasm_A (0:39):
functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 3 (i32)
- scope (module):
......@@ -59,6 +63,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 (kExprLocalGet)
Scope:
at wasm_B (0:45):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 3 (i32)
- scope (module):
......@@ -72,7 +77,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf)
Scope:
at wasm_B (0:47):
- scope (wasm-expression-stack):
0: 3 (i32)
stack: "0": 3 (i32)
- scope (local):
$var0: 3 (i32)
- scope (module):
......@@ -86,6 +91,7 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20 (kExprLocalGet)
Scope:
at wasm_B (0:49):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 3 (i32)
- scope (module):
......@@ -99,7 +105,7 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 (kExprI32Const)
Scope:
at wasm_B (0:51):
- scope (wasm-expression-stack):
0: 3 (i32)
stack: "0": 3 (i32)
- scope (local):
$var0: 3 (i32)
- scope (module):
......@@ -113,8 +119,7 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b (kExprI32Sub)
Scope:
at wasm_B (0:53):
- scope (wasm-expression-stack):
0: 3 (i32)
1: 1 (i32)
stack: "0": 3 (i32), "1": 1 (i32)
- scope (local):
$var0: 3 (i32)
- scope (module):
......@@ -128,7 +133,7 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 (kExprLocalSet)
Scope:
at wasm_B (0:54):
- scope (wasm-expression-stack):
0: 2 (i32)
stack: "0": 2 (i32)
- scope (local):
$var0: 3 (i32)
- scope (module):
......@@ -142,6 +147,7 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 (kExprNop)
Scope:
at wasm_A (0:38):
- scope (wasm-expression-stack):
stack:
- scope (local):
- scope (module):
instance: exports: "main" (Function)
......@@ -149,6 +155,7 @@ at wasm_A (0:38):
functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 2 (i32)
- scope (module):
......@@ -162,6 +169,7 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 (kExprNop)
Scope:
at wasm_A (0:39):
- scope (wasm-expression-stack):
stack:
- scope (local):
- scope (module):
instance: exports: "main" (Function)
......@@ -169,6 +177,7 @@ at wasm_A (0:39):
functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 2 (i32)
- scope (module):
......@@ -182,6 +191,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 (kExprLocalGet)
Scope:
at wasm_B (0:45):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 2 (i32)
- scope (module):
......@@ -195,7 +205,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf)
Scope:
at wasm_B (0:47):
- scope (wasm-expression-stack):
0: 2 (i32)
stack: "0": 2 (i32)
- scope (local):
$var0: 2 (i32)
- scope (module):
......@@ -209,6 +219,7 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20 (kExprLocalGet)
Scope:
at wasm_B (0:49):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 2 (i32)
- scope (module):
......@@ -222,7 +233,7 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 (kExprI32Const)
Scope:
at wasm_B (0:51):
- scope (wasm-expression-stack):
0: 2 (i32)
stack: "0": 2 (i32)
- scope (local):
$var0: 2 (i32)
- scope (module):
......@@ -236,8 +247,7 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b (kExprI32Sub)
Scope:
at wasm_B (0:53):
- scope (wasm-expression-stack):
0: 2 (i32)
1: 1 (i32)
stack: "0": 2 (i32), "1": 1 (i32)
- scope (local):
$var0: 2 (i32)
- scope (module):
......@@ -251,7 +261,7 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 (kExprLocalSet)
Scope:
at wasm_B (0:54):
- scope (wasm-expression-stack):
0: 1 (i32)
stack: "0": 1 (i32)
- scope (local):
$var0: 2 (i32)
- scope (module):
......@@ -265,6 +275,7 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 (kExprNop)
Scope:
at wasm_A (0:38):
- scope (wasm-expression-stack):
stack:
- scope (local):
- scope (module):
instance: exports: "main" (Function)
......@@ -272,6 +283,7 @@ at wasm_A (0:38):
functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 1 (i32)
- scope (module):
......@@ -285,6 +297,7 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 (kExprNop)
Scope:
at wasm_A (0:39):
- scope (wasm-expression-stack):
stack:
- scope (local):
- scope (module):
instance: exports: "main" (Function)
......@@ -292,6 +305,7 @@ at wasm_A (0:39):
functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 1 (i32)
- scope (module):
......@@ -305,6 +319,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 (kExprLocalGet)
Scope:
at wasm_B (0:45):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 1 (i32)
- scope (module):
......@@ -318,7 +333,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf)
Scope:
at wasm_B (0:47):
- scope (wasm-expression-stack):
0: 1 (i32)
stack: "0": 1 (i32)
- scope (local):
$var0: 1 (i32)
- scope (module):
......@@ -332,6 +347,7 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20 (kExprLocalGet)
Scope:
at wasm_B (0:49):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 1 (i32)
- scope (module):
......@@ -345,7 +361,7 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 (kExprI32Const)
Scope:
at wasm_B (0:51):
- scope (wasm-expression-stack):
0: 1 (i32)
stack: "0": 1 (i32)
- scope (local):
$var0: 1 (i32)
- scope (module):
......@@ -359,8 +375,7 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b (kExprI32Sub)
Scope:
at wasm_B (0:53):
- scope (wasm-expression-stack):
0: 1 (i32)
1: 1 (i32)
stack: "0": 1 (i32), "1": 1 (i32)
- scope (local):
$var0: 1 (i32)
- scope (module):
......@@ -374,7 +389,7 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 (kExprLocalSet)
Scope:
at wasm_B (0:54):
- scope (wasm-expression-stack):
0: 0 (i32)
stack: "0": 0 (i32)
- scope (local):
$var0: 1 (i32)
- scope (module):
......@@ -388,6 +403,7 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 (kExprNop)
Scope:
at wasm_A (0:38):
- scope (wasm-expression-stack):
stack:
- scope (local):
- scope (module):
instance: exports: "main" (Function)
......@@ -395,6 +411,7 @@ at wasm_A (0:38):
functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 0 (i32)
- scope (module):
......@@ -408,6 +425,7 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 (kExprNop)
Scope:
at wasm_A (0:39):
- scope (wasm-expression-stack):
stack:
- scope (local):
- scope (module):
instance: exports: "main" (Function)
......@@ -415,6 +433,7 @@ at wasm_A (0:39):
functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 0 (i32)
- scope (module):
......@@ -428,6 +447,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 (kExprLocalGet)
Scope:
at wasm_B (0:45):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 0 (i32)
- scope (module):
......@@ -441,7 +461,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf)
Scope:
at wasm_B (0:47):
- scope (wasm-expression-stack):
0: 0 (i32)
stack: "0": 0 (i32)
- scope (local):
$var0: 0 (i32)
- scope (module):
......@@ -455,6 +475,7 @@ Script wasm://wasm/0c10a5fe byte offset 61: Wasm opcode 0x0b (kExprEnd)
Scope:
at wasm_B (0:61):
- scope (wasm-expression-stack):
stack:
- scope (local):
$var0: 0 (i32)
- scope (module):
......
......@@ -68,9 +68,16 @@ async function inspect(frame) {
// Inspect only the top wasm frame.
for (var scope of frame.scopeChain) {
if (scope.type == 'module') continue;
var scope_properties =
await Protocol.Runtime.getProperties({objectId: scope.object.objectId});
let str = (await Promise.all(scope_properties.result.result.map(
var { objectId } = scope.object;
if (scope.type == 'wasm-expression-stack') {
objectId = (await Protocol.Runtime.callFunctionOn({
functionDeclaration: 'function() { return this.stack }',
objectId
})).result.result.objectId;
}
var properties =
await Protocol.Runtime.getProperties({objectId});
let str = (await Promise.all(properties.result.result.map(
elem => WasmInspectorTest.getWasmValue(elem.value))))
.join(', ');
line.push(`${scope.type}: [${str}]`);
......
......@@ -54,8 +54,15 @@ async function printPauseLocationAndStep(msg) {
let scopes = {};
for (let scope of frame.scopeChain) {
if (scope.type == 'module') continue;
let scope_properties =
await Protocol.Runtime.getProperties({objectId: scope.object.objectId});
var { objectId } = scope.object;
if (scope.type == 'wasm-expression-stack') {
objectId = (await Protocol.Runtime.callFunctionOn({
functionDeclaration: 'function() { return this.stack }',
objectId
})).result.result.objectId;
}
var scope_properties =
await Protocol.Runtime.getProperties({objectId});
scopes[scope.type] = await Promise.all(scope_properties.result.result.map(
elem => WasmInspectorTest.getWasmValue(elem.value)));
}
......
......@@ -91,8 +91,15 @@ async function waitForPauseAndStep(stepAction) {
if (scope.type === 'global' || scope.type === 'module') {
InspectorTest.logObject(' -- skipped');
} else {
var { objectId } = scope.object;
if (scope.type == 'wasm-expression-stack') {
objectId = (await Protocol.Runtime.callFunctionOn({
functionDeclaration: 'function() { return this.stack }',
objectId
})).result.result.objectId;
}
let properties = await Protocol.Runtime.getProperties(
{objectId: scope.object.objectId});
{objectId});
for (let {name, value} of properties.result.result) {
value = await WasmInspectorTest.getWasmValue(value);
InspectorTest.log(` ${name}: ${value}`);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment