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 { ...@@ -732,7 +732,10 @@ class DebugWasmScopeIterator final : public debug::ScopeIterator {
return Utils::ToLocal(LocalsProxy::Create(frame_)); return Utils::ToLocal(LocalsProxy::Create(frame_));
} }
case debug::ScopeIterator::ScopeTypeWasmExpressionStack: { 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: default:
UNREACHABLE(); UNREACHABLE();
......
...@@ -165,8 +165,15 @@ Protocol.Debugger.onPaused(async msg => { ...@@ -165,8 +165,15 @@ Protocol.Debugger.onPaused(async msg => {
} }
for (var scope of frame.scopeChain) { for (var scope of frame.scopeChain) {
InspectorTest.logObject(' - scope (' + scope.type + '):'); InspectorTest.logObject(' - scope (' + scope.type + '):');
var properties = await Protocol.Runtime.getProperties( var { objectId } = scope.object;
{'objectId': scope.object.objectId}); 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); await WasmInspectorTest.dumpScopeProperties(properties);
if (scope.type === 'wasm-expression-stack' || scope.type === 'local') { if (scope.type === 'wasm-expression-stack' || scope.type === 'local') {
for (var value of properties.result.result) { for (var value of properties.result.result) {
......
...@@ -22,8 +22,15 @@ Protocol.Debugger.onPaused(async msg => { ...@@ -22,8 +22,15 @@ Protocol.Debugger.onPaused(async msg => {
var frame = msg.params.callFrames[0]; var frame = msg.params.callFrames[0];
for (var scope of frame.scopeChain) { for (var scope of frame.scopeChain) {
if (scope.type == 'module') continue; 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 = 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( let str = (await Promise.all(scope_properties.result.result.map(
elem => WasmInspectorTest.getWasmValue(elem.value)))) elem => WasmInspectorTest.getWasmValue(elem.value))))
.join(', '); .join(', ');
......
...@@ -15,6 +15,7 @@ Script wasm://wasm/e33badc2 byte offset 169: Wasm opcode 0x20 (kExprLocalGet) ...@@ -15,6 +15,7 @@ Script wasm://wasm/e33badc2 byte offset 169: Wasm opcode 0x20 (kExprLocalGet)
Scope: Scope:
at C (interpreted) (0:169): at C (interpreted) (0:169):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$i32_arg: 42 (i32) $i32_arg: 42 (i32)
$i32_local: 0 (i32) $i32_local: 0 (i32)
...@@ -28,8 +29,7 @@ at C (interpreted) (0:169): ...@@ -28,8 +29,7 @@ at C (interpreted) (0:169):
tables: "$exported_table": (Table) tables: "$exported_table": (Table)
at B (liftoff) (0:158): at B (liftoff) (0:158):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 42 (i32) stack: "0": 42 (i32), "1": 3 (i32)
1: 3 (i32)
- scope (local): - scope (local):
$i32_arg: 42 (i32) $i32_arg: 42 (i32)
$i32_local: 0 (i32) $i32_local: 0 (i32)
...@@ -46,6 +46,7 @@ at B (liftoff) (0:158): ...@@ -46,6 +46,7 @@ at B (liftoff) (0:158):
tables: "$exported_table": (Table) tables: "$exported_table": (Table)
at A (liftoff) (0:128): at A (liftoff) (0:128):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 42 (i32) $var0: 42 (i32)
- scope (module): - scope (module):
...@@ -64,7 +65,7 @@ Script wasm://wasm/e33badc2 byte offset 171: Wasm opcode 0x24 (kExprGlobalSet) ...@@ -64,7 +65,7 @@ Script wasm://wasm/e33badc2 byte offset 171: Wasm opcode 0x24 (kExprGlobalSet)
Scope: Scope:
at C (interpreted) (0:171): at C (interpreted) (0:171):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 42 (i32) stack: "0": 42 (i32)
- scope (local): - scope (local):
$i32_arg: 42 (i32) $i32_arg: 42 (i32)
$i32_local: 0 (i32) $i32_local: 0 (i32)
...@@ -78,8 +79,7 @@ at C (interpreted) (0:171): ...@@ -78,8 +79,7 @@ at C (interpreted) (0:171):
tables: "$exported_table": (Table) tables: "$exported_table": (Table)
at B (liftoff) (0:158): at B (liftoff) (0:158):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 42 (i32) stack: "0": 42 (i32), "1": 3 (i32)
1: 3 (i32)
- scope (local): - scope (local):
$i32_arg: 42 (i32) $i32_arg: 42 (i32)
$i32_local: 0 (i32) $i32_local: 0 (i32)
...@@ -96,6 +96,7 @@ at B (liftoff) (0:158): ...@@ -96,6 +96,7 @@ at B (liftoff) (0:158):
tables: "$exported_table": (Table) tables: "$exported_table": (Table)
at A (liftoff) (0:128): at A (liftoff) (0:128):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 42 (i32) $var0: 42 (i32)
- scope (module): - scope (module):
...@@ -114,6 +115,7 @@ Script wasm://wasm/e33badc2 byte offset 173: Wasm opcode 0x41 (kExprI32Const) ...@@ -114,6 +115,7 @@ Script wasm://wasm/e33badc2 byte offset 173: Wasm opcode 0x41 (kExprI32Const)
Scope: Scope:
at C (interpreted) (0:173): at C (interpreted) (0:173):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$i32_arg: 42 (i32) $i32_arg: 42 (i32)
$i32_local: 0 (i32) $i32_local: 0 (i32)
...@@ -127,8 +129,7 @@ at C (interpreted) (0:173): ...@@ -127,8 +129,7 @@ at C (interpreted) (0:173):
tables: "$exported_table": (Table) tables: "$exported_table": (Table)
at B (liftoff) (0:158): at B (liftoff) (0:158):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 42 (i32) stack: "0": 42 (i32), "1": 3 (i32)
1: 3 (i32)
- scope (local): - scope (local):
$i32_arg: 42 (i32) $i32_arg: 42 (i32)
$i32_local: 0 (i32) $i32_local: 0 (i32)
...@@ -145,6 +146,7 @@ at B (liftoff) (0:158): ...@@ -145,6 +146,7 @@ at B (liftoff) (0:158):
tables: "$exported_table": (Table) tables: "$exported_table": (Table)
at A (liftoff) (0:128): at A (liftoff) (0:128):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 42 (i32) $var0: 42 (i32)
- scope (module): - scope (module):
...@@ -163,7 +165,7 @@ Script wasm://wasm/e33badc2 byte offset 175: Wasm opcode 0x21 (kExprLocalSet) ...@@ -163,7 +165,7 @@ Script wasm://wasm/e33badc2 byte offset 175: Wasm opcode 0x21 (kExprLocalSet)
Scope: Scope:
at C (interpreted) (0:175): at C (interpreted) (0:175):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 47 (i32) stack: "0": 47 (i32)
- scope (local): - scope (local):
$i32_arg: 42 (i32) $i32_arg: 42 (i32)
$i32_local: 0 (i32) $i32_local: 0 (i32)
...@@ -177,8 +179,7 @@ at C (interpreted) (0:175): ...@@ -177,8 +179,7 @@ at C (interpreted) (0:175):
tables: "$exported_table": (Table) tables: "$exported_table": (Table)
at B (liftoff) (0:158): at B (liftoff) (0:158):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 42 (i32) stack: "0": 42 (i32), "1": 3 (i32)
1: 3 (i32)
- scope (local): - scope (local):
$i32_arg: 42 (i32) $i32_arg: 42 (i32)
$i32_local: 0 (i32) $i32_local: 0 (i32)
...@@ -195,6 +196,7 @@ at B (liftoff) (0:158): ...@@ -195,6 +196,7 @@ at B (liftoff) (0:158):
tables: "$exported_table": (Table) tables: "$exported_table": (Table)
at A (liftoff) (0:128): at A (liftoff) (0:128):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 42 (i32) $var0: 42 (i32)
- scope (module): - scope (module):
...@@ -213,6 +215,7 @@ Script wasm://wasm/e33badc2 byte offset 177: Wasm opcode 0x0b (kExprEnd) ...@@ -213,6 +215,7 @@ Script wasm://wasm/e33badc2 byte offset 177: Wasm opcode 0x0b (kExprEnd)
Scope: Scope:
at C (interpreted) (0:177): at C (interpreted) (0:177):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$i32_arg: 42 (i32) $i32_arg: 42 (i32)
$i32_local: 47 (i32) $i32_local: 47 (i32)
...@@ -226,8 +229,7 @@ at C (interpreted) (0:177): ...@@ -226,8 +229,7 @@ at C (interpreted) (0:177):
tables: "$exported_table": (Table) tables: "$exported_table": (Table)
at B (liftoff) (0:158): at B (liftoff) (0:158):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 42 (i32) stack: "0": 42 (i32), "1": 3 (i32)
1: 3 (i32)
- scope (local): - scope (local):
$i32_arg: 42 (i32) $i32_arg: 42 (i32)
$i32_local: 0 (i32) $i32_local: 0 (i32)
...@@ -244,6 +246,7 @@ at B (liftoff) (0:158): ...@@ -244,6 +246,7 @@ at B (liftoff) (0:158):
tables: "$exported_table": (Table) tables: "$exported_table": (Table)
at A (liftoff) (0:128): at A (liftoff) (0:128):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 42 (i32) $var0: 42 (i32)
- scope (module): - scope (module):
...@@ -262,8 +265,7 @@ Script wasm://wasm/e33badc2 byte offset 160: Wasm opcode 0x1a (kExprDrop) ...@@ -262,8 +265,7 @@ Script wasm://wasm/e33badc2 byte offset 160: Wasm opcode 0x1a (kExprDrop)
Scope: Scope:
at B (liftoff) (0:160): at B (liftoff) (0:160):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 42 (i32) stack: "0": 42 (i32), "1": 3 (i32)
1: 3 (i32)
- scope (local): - scope (local):
$i32_arg: 42 (i32) $i32_arg: 42 (i32)
$i32_local: 0 (i32) $i32_local: 0 (i32)
...@@ -280,6 +282,7 @@ at B (liftoff) (0:160): ...@@ -280,6 +282,7 @@ at B (liftoff) (0:160):
tables: "$exported_table": (Table) tables: "$exported_table": (Table)
at A (liftoff) (0:128): at A (liftoff) (0:128):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 42 (i32) $var0: 42 (i32)
- scope (module): - scope (module):
...@@ -298,7 +301,7 @@ Script wasm://wasm/e33badc2 byte offset 161: Wasm opcode 0x1a (kExprDrop) ...@@ -298,7 +301,7 @@ Script wasm://wasm/e33badc2 byte offset 161: Wasm opcode 0x1a (kExprDrop)
Scope: Scope:
at B (liftoff) (0:161): at B (liftoff) (0:161):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 42 (i32) stack: "0": 42 (i32)
- scope (local): - scope (local):
$i32_arg: 42 (i32) $i32_arg: 42 (i32)
$i32_local: 0 (i32) $i32_local: 0 (i32)
...@@ -315,6 +318,7 @@ at B (liftoff) (0:161): ...@@ -315,6 +318,7 @@ at B (liftoff) (0:161):
tables: "$exported_table": (Table) tables: "$exported_table": (Table)
at A (liftoff) (0:128): at A (liftoff) (0:128):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 42 (i32) $var0: 42 (i32)
- scope (module): - scope (module):
...@@ -333,6 +337,7 @@ Script wasm://wasm/e33badc2 byte offset 162: Wasm opcode 0x0b (kExprEnd) ...@@ -333,6 +337,7 @@ Script wasm://wasm/e33badc2 byte offset 162: Wasm opcode 0x0b (kExprEnd)
Scope: Scope:
at B (liftoff) (0:162): at B (liftoff) (0:162):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$i32_arg: 42 (i32) $i32_arg: 42 (i32)
$i32_local: 0 (i32) $i32_local: 0 (i32)
...@@ -349,6 +354,7 @@ at B (liftoff) (0:162): ...@@ -349,6 +354,7 @@ at B (liftoff) (0:162):
tables: "$exported_table": (Table) tables: "$exported_table": (Table)
at A (liftoff) (0:128): at A (liftoff) (0:128):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 42 (i32) $var0: 42 (i32)
- scope (module): - scope (module):
...@@ -367,6 +373,7 @@ Script wasm://wasm/e33badc2 byte offset 130: Wasm opcode 0x0b (kExprEnd) ...@@ -367,6 +373,7 @@ Script wasm://wasm/e33badc2 byte offset 130: Wasm opcode 0x0b (kExprEnd)
Scope: Scope:
at A (liftoff) (0:130): at A (liftoff) (0:130):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 42 (i32) $var0: 42 (i32)
- scope (module): - scope (module):
......
...@@ -10,6 +10,7 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 (kExprNop) ...@@ -10,6 +10,7 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 (kExprNop)
Scope: Scope:
at wasm_A (0:38): at wasm_A (0:38):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
- scope (module): - scope (module):
instance: exports: "main" (Function) instance: exports: "main" (Function)
...@@ -17,6 +18,7 @@ at wasm_A (0:38): ...@@ -17,6 +18,7 @@ at wasm_A (0:38):
functions: "$wasm_A": (Function), "$wasm_B": (Function) functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56): at wasm_B (0:56):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 3 (i32) $var0: 3 (i32)
- scope (module): - scope (module):
...@@ -39,6 +41,7 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 (kExprNop) ...@@ -39,6 +41,7 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 (kExprNop)
Scope: Scope:
at wasm_A (0:39): at wasm_A (0:39):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
- scope (module): - scope (module):
instance: exports: "main" (Function) instance: exports: "main" (Function)
...@@ -46,6 +49,7 @@ at wasm_A (0:39): ...@@ -46,6 +49,7 @@ at wasm_A (0:39):
functions: "$wasm_A": (Function), "$wasm_B": (Function) functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56): at wasm_B (0:56):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 3 (i32) $var0: 3 (i32)
- scope (module): - scope (module):
...@@ -59,6 +63,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 (kExprLocalGet) ...@@ -59,6 +63,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 (kExprLocalGet)
Scope: Scope:
at wasm_B (0:45): at wasm_B (0:45):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 3 (i32) $var0: 3 (i32)
- scope (module): - scope (module):
...@@ -72,7 +77,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf) ...@@ -72,7 +77,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf)
Scope: Scope:
at wasm_B (0:47): at wasm_B (0:47):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 3 (i32) stack: "0": 3 (i32)
- scope (local): - scope (local):
$var0: 3 (i32) $var0: 3 (i32)
- scope (module): - scope (module):
...@@ -86,6 +91,7 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20 (kExprLocalGet) ...@@ -86,6 +91,7 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20 (kExprLocalGet)
Scope: Scope:
at wasm_B (0:49): at wasm_B (0:49):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 3 (i32) $var0: 3 (i32)
- scope (module): - scope (module):
...@@ -99,7 +105,7 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 (kExprI32Const) ...@@ -99,7 +105,7 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 (kExprI32Const)
Scope: Scope:
at wasm_B (0:51): at wasm_B (0:51):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 3 (i32) stack: "0": 3 (i32)
- scope (local): - scope (local):
$var0: 3 (i32) $var0: 3 (i32)
- scope (module): - scope (module):
...@@ -113,8 +119,7 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b (kExprI32Sub) ...@@ -113,8 +119,7 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b (kExprI32Sub)
Scope: Scope:
at wasm_B (0:53): at wasm_B (0:53):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 3 (i32) stack: "0": 3 (i32), "1": 1 (i32)
1: 1 (i32)
- scope (local): - scope (local):
$var0: 3 (i32) $var0: 3 (i32)
- scope (module): - scope (module):
...@@ -128,7 +133,7 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 (kExprLocalSet) ...@@ -128,7 +133,7 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 (kExprLocalSet)
Scope: Scope:
at wasm_B (0:54): at wasm_B (0:54):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 2 (i32) stack: "0": 2 (i32)
- scope (local): - scope (local):
$var0: 3 (i32) $var0: 3 (i32)
- scope (module): - scope (module):
...@@ -142,6 +147,7 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 (kExprNop) ...@@ -142,6 +147,7 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 (kExprNop)
Scope: Scope:
at wasm_A (0:38): at wasm_A (0:38):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
- scope (module): - scope (module):
instance: exports: "main" (Function) instance: exports: "main" (Function)
...@@ -149,6 +155,7 @@ at wasm_A (0:38): ...@@ -149,6 +155,7 @@ at wasm_A (0:38):
functions: "$wasm_A": (Function), "$wasm_B": (Function) functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56): at wasm_B (0:56):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 2 (i32) $var0: 2 (i32)
- scope (module): - scope (module):
...@@ -162,6 +169,7 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 (kExprNop) ...@@ -162,6 +169,7 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 (kExprNop)
Scope: Scope:
at wasm_A (0:39): at wasm_A (0:39):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
- scope (module): - scope (module):
instance: exports: "main" (Function) instance: exports: "main" (Function)
...@@ -169,6 +177,7 @@ at wasm_A (0:39): ...@@ -169,6 +177,7 @@ at wasm_A (0:39):
functions: "$wasm_A": (Function), "$wasm_B": (Function) functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56): at wasm_B (0:56):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 2 (i32) $var0: 2 (i32)
- scope (module): - scope (module):
...@@ -182,6 +191,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 (kExprLocalGet) ...@@ -182,6 +191,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 (kExprLocalGet)
Scope: Scope:
at wasm_B (0:45): at wasm_B (0:45):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 2 (i32) $var0: 2 (i32)
- scope (module): - scope (module):
...@@ -195,7 +205,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf) ...@@ -195,7 +205,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf)
Scope: Scope:
at wasm_B (0:47): at wasm_B (0:47):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 2 (i32) stack: "0": 2 (i32)
- scope (local): - scope (local):
$var0: 2 (i32) $var0: 2 (i32)
- scope (module): - scope (module):
...@@ -209,6 +219,7 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20 (kExprLocalGet) ...@@ -209,6 +219,7 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20 (kExprLocalGet)
Scope: Scope:
at wasm_B (0:49): at wasm_B (0:49):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 2 (i32) $var0: 2 (i32)
- scope (module): - scope (module):
...@@ -222,7 +233,7 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 (kExprI32Const) ...@@ -222,7 +233,7 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 (kExprI32Const)
Scope: Scope:
at wasm_B (0:51): at wasm_B (0:51):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 2 (i32) stack: "0": 2 (i32)
- scope (local): - scope (local):
$var0: 2 (i32) $var0: 2 (i32)
- scope (module): - scope (module):
...@@ -236,8 +247,7 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b (kExprI32Sub) ...@@ -236,8 +247,7 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b (kExprI32Sub)
Scope: Scope:
at wasm_B (0:53): at wasm_B (0:53):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 2 (i32) stack: "0": 2 (i32), "1": 1 (i32)
1: 1 (i32)
- scope (local): - scope (local):
$var0: 2 (i32) $var0: 2 (i32)
- scope (module): - scope (module):
...@@ -251,7 +261,7 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 (kExprLocalSet) ...@@ -251,7 +261,7 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 (kExprLocalSet)
Scope: Scope:
at wasm_B (0:54): at wasm_B (0:54):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 1 (i32) stack: "0": 1 (i32)
- scope (local): - scope (local):
$var0: 2 (i32) $var0: 2 (i32)
- scope (module): - scope (module):
...@@ -265,6 +275,7 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 (kExprNop) ...@@ -265,6 +275,7 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 (kExprNop)
Scope: Scope:
at wasm_A (0:38): at wasm_A (0:38):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
- scope (module): - scope (module):
instance: exports: "main" (Function) instance: exports: "main" (Function)
...@@ -272,6 +283,7 @@ at wasm_A (0:38): ...@@ -272,6 +283,7 @@ at wasm_A (0:38):
functions: "$wasm_A": (Function), "$wasm_B": (Function) functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56): at wasm_B (0:56):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 1 (i32) $var0: 1 (i32)
- scope (module): - scope (module):
...@@ -285,6 +297,7 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 (kExprNop) ...@@ -285,6 +297,7 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 (kExprNop)
Scope: Scope:
at wasm_A (0:39): at wasm_A (0:39):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
- scope (module): - scope (module):
instance: exports: "main" (Function) instance: exports: "main" (Function)
...@@ -292,6 +305,7 @@ at wasm_A (0:39): ...@@ -292,6 +305,7 @@ at wasm_A (0:39):
functions: "$wasm_A": (Function), "$wasm_B": (Function) functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56): at wasm_B (0:56):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 1 (i32) $var0: 1 (i32)
- scope (module): - scope (module):
...@@ -305,6 +319,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 (kExprLocalGet) ...@@ -305,6 +319,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 (kExprLocalGet)
Scope: Scope:
at wasm_B (0:45): at wasm_B (0:45):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 1 (i32) $var0: 1 (i32)
- scope (module): - scope (module):
...@@ -318,7 +333,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf) ...@@ -318,7 +333,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf)
Scope: Scope:
at wasm_B (0:47): at wasm_B (0:47):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 1 (i32) stack: "0": 1 (i32)
- scope (local): - scope (local):
$var0: 1 (i32) $var0: 1 (i32)
- scope (module): - scope (module):
...@@ -332,6 +347,7 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20 (kExprLocalGet) ...@@ -332,6 +347,7 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20 (kExprLocalGet)
Scope: Scope:
at wasm_B (0:49): at wasm_B (0:49):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 1 (i32) $var0: 1 (i32)
- scope (module): - scope (module):
...@@ -345,7 +361,7 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 (kExprI32Const) ...@@ -345,7 +361,7 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41 (kExprI32Const)
Scope: Scope:
at wasm_B (0:51): at wasm_B (0:51):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 1 (i32) stack: "0": 1 (i32)
- scope (local): - scope (local):
$var0: 1 (i32) $var0: 1 (i32)
- scope (module): - scope (module):
...@@ -359,8 +375,7 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b (kExprI32Sub) ...@@ -359,8 +375,7 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b (kExprI32Sub)
Scope: Scope:
at wasm_B (0:53): at wasm_B (0:53):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 1 (i32) stack: "0": 1 (i32), "1": 1 (i32)
1: 1 (i32)
- scope (local): - scope (local):
$var0: 1 (i32) $var0: 1 (i32)
- scope (module): - scope (module):
...@@ -374,7 +389,7 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 (kExprLocalSet) ...@@ -374,7 +389,7 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21 (kExprLocalSet)
Scope: Scope:
at wasm_B (0:54): at wasm_B (0:54):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 0 (i32) stack: "0": 0 (i32)
- scope (local): - scope (local):
$var0: 1 (i32) $var0: 1 (i32)
- scope (module): - scope (module):
...@@ -388,6 +403,7 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 (kExprNop) ...@@ -388,6 +403,7 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01 (kExprNop)
Scope: Scope:
at wasm_A (0:38): at wasm_A (0:38):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
- scope (module): - scope (module):
instance: exports: "main" (Function) instance: exports: "main" (Function)
...@@ -395,6 +411,7 @@ at wasm_A (0:38): ...@@ -395,6 +411,7 @@ at wasm_A (0:38):
functions: "$wasm_A": (Function), "$wasm_B": (Function) functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56): at wasm_B (0:56):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 0 (i32) $var0: 0 (i32)
- scope (module): - scope (module):
...@@ -408,6 +425,7 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 (kExprNop) ...@@ -408,6 +425,7 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01 (kExprNop)
Scope: Scope:
at wasm_A (0:39): at wasm_A (0:39):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
- scope (module): - scope (module):
instance: exports: "main" (Function) instance: exports: "main" (Function)
...@@ -415,6 +433,7 @@ at wasm_A (0:39): ...@@ -415,6 +433,7 @@ at wasm_A (0:39):
functions: "$wasm_A": (Function), "$wasm_B": (Function) functions: "$wasm_A": (Function), "$wasm_B": (Function)
at wasm_B (0:56): at wasm_B (0:56):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 0 (i32) $var0: 0 (i32)
- scope (module): - scope (module):
...@@ -428,6 +447,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 (kExprLocalGet) ...@@ -428,6 +447,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20 (kExprLocalGet)
Scope: Scope:
at wasm_B (0:45): at wasm_B (0:45):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 0 (i32) $var0: 0 (i32)
- scope (module): - scope (module):
...@@ -441,7 +461,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf) ...@@ -441,7 +461,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04 (kExprIf)
Scope: Scope:
at wasm_B (0:47): at wasm_B (0:47):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
0: 0 (i32) stack: "0": 0 (i32)
- scope (local): - scope (local):
$var0: 0 (i32) $var0: 0 (i32)
- scope (module): - scope (module):
...@@ -455,6 +475,7 @@ Script wasm://wasm/0c10a5fe byte offset 61: Wasm opcode 0x0b (kExprEnd) ...@@ -455,6 +475,7 @@ Script wasm://wasm/0c10a5fe byte offset 61: Wasm opcode 0x0b (kExprEnd)
Scope: Scope:
at wasm_B (0:61): at wasm_B (0:61):
- scope (wasm-expression-stack): - scope (wasm-expression-stack):
stack:
- scope (local): - scope (local):
$var0: 0 (i32) $var0: 0 (i32)
- scope (module): - scope (module):
......
...@@ -68,9 +68,16 @@ async function inspect(frame) { ...@@ -68,9 +68,16 @@ async function inspect(frame) {
// Inspect only the top wasm frame. // Inspect only the top wasm frame.
for (var scope of frame.scopeChain) { for (var scope of frame.scopeChain) {
if (scope.type == 'module') continue; if (scope.type == 'module') continue;
var scope_properties = var { objectId } = scope.object;
await Protocol.Runtime.getProperties({objectId: scope.object.objectId}); if (scope.type == 'wasm-expression-stack') {
let str = (await Promise.all(scope_properties.result.result.map( 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)))) elem => WasmInspectorTest.getWasmValue(elem.value))))
.join(', '); .join(', ');
line.push(`${scope.type}: [${str}]`); line.push(`${scope.type}: [${str}]`);
......
...@@ -54,8 +54,15 @@ async function printPauseLocationAndStep(msg) { ...@@ -54,8 +54,15 @@ async function printPauseLocationAndStep(msg) {
let scopes = {}; let scopes = {};
for (let scope of frame.scopeChain) { for (let scope of frame.scopeChain) {
if (scope.type == 'module') continue; if (scope.type == 'module') continue;
let scope_properties = var { objectId } = scope.object;
await Protocol.Runtime.getProperties({objectId: scope.object.objectId}); 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( scopes[scope.type] = await Promise.all(scope_properties.result.result.map(
elem => WasmInspectorTest.getWasmValue(elem.value))); elem => WasmInspectorTest.getWasmValue(elem.value)));
} }
......
...@@ -91,8 +91,15 @@ async function waitForPauseAndStep(stepAction) { ...@@ -91,8 +91,15 @@ async function waitForPauseAndStep(stepAction) {
if (scope.type === 'global' || scope.type === 'module') { if (scope.type === 'global' || scope.type === 'module') {
InspectorTest.logObject(' -- skipped'); InspectorTest.logObject(' -- skipped');
} else { } 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( let properties = await Protocol.Runtime.getProperties(
{objectId: scope.object.objectId}); {objectId});
for (let {name, value} of properties.result.result) { for (let {name, value} of properties.result.result) {
value = await WasmInspectorTest.getWasmValue(value); value = await WasmInspectorTest.getWasmValue(value);
InspectorTest.log(` ${name}: ${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