[wasm][debugging] Add wasm instance to module scope
This adds the wasm instance to the module scope. The instance contains the exported entities that can now be inspected. Bug: chromium:1043034 Change-Id: I9236ac9c126f3bc4b1e056990fe34956bbe8ed6b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2213433 Commit-Queue: Kim-Anh Tran <kimanh@chromium.org> Reviewed-by: Clemens Backes <clemensb@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#67961}
This commit is contained in:
parent
4c256166a8
commit
c8e3cbbe13
@ -349,6 +349,12 @@ Handle<JSObject> GetModuleScopeObject(Handle<WasmInstanceObject> instance) {
|
||||
|
||||
Handle<JSObject> module_scope_object =
|
||||
isolate->factory()->NewJSObjectWithNullProto();
|
||||
|
||||
Handle<String> instance_name =
|
||||
isolate->factory()->InternalizeString(StaticCharVector("instance"));
|
||||
JSObject::AddProperty(isolate, module_scope_object, instance_name, instance,
|
||||
NONE);
|
||||
|
||||
if (instance->has_memory_object()) {
|
||||
Handle<String> name;
|
||||
// TODO(duongn): extend the logic when multiple memories are supported.
|
||||
|
@ -62,6 +62,7 @@ async function logMemoryName(msg, Protocol) {
|
||||
})).result.result;
|
||||
|
||||
for (let prop of moduleObjectProps) {
|
||||
if (prop.name == 'instance') continue;
|
||||
InspectorTest.log(`name: ${prop.name}`);
|
||||
}
|
||||
}
|
||||
|
@ -4,22 +4,26 @@ Waiting for wasm script to be parsed.
|
||||
Got wasm script!
|
||||
Setting breakpoint on first instruction of second function
|
||||
{
|
||||
columnNumber : 69
|
||||
columnNumber : 134
|
||||
lineNumber : 0
|
||||
scriptId : <scriptId>
|
||||
}
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 69: Wasm opcode 0x41
|
||||
Script wasm://wasm/2d24c81e byte offset 134: Wasm opcode 0x41
|
||||
Scope:
|
||||
at func (0:69):
|
||||
at func (0:134):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 4 (i32), "var1": 0 (i32), "i64_local": 0 (i64), "unicode☼f64": 0 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -28,18 +32,22 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 71: Wasm opcode 0x21
|
||||
Script wasm://wasm/2d24c81e byte offset 136: Wasm opcode 0x21
|
||||
Scope:
|
||||
at func (0:71):
|
||||
at func (0:136):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 4 (i32), "var1": 0 (i32), "i64_local": 0 (i64), "unicode☼f64": 0 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 11 (i32)
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -48,17 +56,21 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 73: Wasm opcode 0x41
|
||||
Script wasm://wasm/2d24c81e byte offset 138: Wasm opcode 0x41
|
||||
Scope:
|
||||
at func (0:73):
|
||||
at func (0:138):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 0 (i32), "i64_local": 0 (i64), "unicode☼f64": 0 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -67,18 +79,22 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 75: Wasm opcode 0x21
|
||||
Script wasm://wasm/2d24c81e byte offset 140: Wasm opcode 0x21
|
||||
Scope:
|
||||
at func (0:75):
|
||||
at func (0:140):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 0 (i32), "i64_local": 0 (i64), "unicode☼f64": 0 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 47 (i32)
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -87,17 +103,21 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 77: Wasm opcode 0x42
|
||||
Script wasm://wasm/2d24c81e byte offset 142: Wasm opcode 0x42
|
||||
Scope:
|
||||
at func (0:77):
|
||||
at func (0:142):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 47 (i32), "i64_local": 0 (i64), "unicode☼f64": 0 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -106,18 +126,22 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 88: Wasm opcode 0x21
|
||||
Script wasm://wasm/2d24c81e byte offset 153: Wasm opcode 0x21
|
||||
Scope:
|
||||
at func (0:88):
|
||||
at func (0:153):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 47 (i32), "i64_local": 0 (i64), "unicode☼f64": 0 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 9223372036854775807 (i64)
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -126,17 +150,21 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 90: Wasm opcode 0x42
|
||||
Script wasm://wasm/2d24c81e byte offset 155: Wasm opcode 0x42
|
||||
Scope:
|
||||
at func (0:90):
|
||||
at func (0:155):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 47 (i32), "i64_local": 9223372036854775807 (i64), "unicode☼f64": 0 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -145,18 +173,22 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 101: Wasm opcode 0x21
|
||||
Script wasm://wasm/2d24c81e byte offset 166: Wasm opcode 0x21
|
||||
Scope:
|
||||
at func (0:101):
|
||||
at func (0:166):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 47 (i32), "i64_local": 9223372036854775807 (i64), "unicode☼f64": 0 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
0: -9223372036854775808 (i64)
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -165,17 +197,21 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 103: Wasm opcode 0x41
|
||||
Script wasm://wasm/2d24c81e byte offset 168: Wasm opcode 0x41
|
||||
Scope:
|
||||
at func (0:103):
|
||||
at func (0:168):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 47 (i32), "i64_local": -9223372036854775808 (i64), "unicode☼f64": 0 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -184,18 +220,22 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 105: Wasm opcode 0xb8
|
||||
Script wasm://wasm/2d24c81e byte offset 170: Wasm opcode 0xb8
|
||||
Scope:
|
||||
at func (0:105):
|
||||
at func (0:170):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 47 (i32), "i64_local": -9223372036854775808 (i64), "unicode☼f64": 0 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 1 (i32)
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -204,18 +244,22 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 106: Wasm opcode 0x41
|
||||
Script wasm://wasm/2d24c81e byte offset 171: Wasm opcode 0x41
|
||||
Scope:
|
||||
at func (0:106):
|
||||
at func (0:171):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 47 (i32), "i64_local": -9223372036854775808 (i64), "unicode☼f64": 0 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 1 (f64)
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -224,19 +268,23 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 108: Wasm opcode 0xb8
|
||||
Script wasm://wasm/2d24c81e byte offset 173: Wasm opcode 0xb8
|
||||
Scope:
|
||||
at func (0:108):
|
||||
at func (0:173):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 47 (i32), "i64_local": -9223372036854775808 (i64), "unicode☼f64": 0 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 1 (f64)
|
||||
1: 7 (i32)
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -245,19 +293,23 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 109: Wasm opcode 0xa3
|
||||
Script wasm://wasm/2d24c81e byte offset 174: Wasm opcode 0xa3
|
||||
Scope:
|
||||
at func (0:109):
|
||||
at func (0:174):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 47 (i32), "i64_local": -9223372036854775808 (i64), "unicode☼f64": 0 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 1 (f64)
|
||||
1: 7 (f64)
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -266,18 +318,22 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 110: Wasm opcode 0x21
|
||||
Script wasm://wasm/2d24c81e byte offset 175: Wasm opcode 0x21
|
||||
Scope:
|
||||
at func (0:110):
|
||||
at func (0:175):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 47 (i32), "i64_local": -9223372036854775808 (i64), "unicode☼f64": 0 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 0.14285714285714285 (f64)
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -286,17 +342,21 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 112: Wasm opcode 0x41
|
||||
Script wasm://wasm/2d24c81e byte offset 177: Wasm opcode 0x41
|
||||
Scope:
|
||||
at func (0:112):
|
||||
at func (0:177):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 47 (i32), "i64_local": -9223372036854775808 (i64), "unicode☼f64": 0.14285714285714285 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -305,18 +365,22 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 114: Wasm opcode 0x24
|
||||
Script wasm://wasm/2d24c81e byte offset 179: Wasm opcode 0x24
|
||||
Scope:
|
||||
at func (0:114):
|
||||
at func (0:179):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 47 (i32), "i64_local": -9223372036854775808 (i64), "unicode☼f64": 0.14285714285714285 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 15 (i32)
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -325,17 +389,21 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 116: Wasm opcode 0x0b
|
||||
Script wasm://wasm/2d24c81e byte offset 181: Wasm opcode 0x0b
|
||||
Scope:
|
||||
at func (0:116):
|
||||
at func (0:181):
|
||||
- scope (module):
|
||||
globals: "global0": 15 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 15 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f64), "i32Arg": 11 (i32), "var1": 47 (i32), "i64_local": -9223372036854775808 (i64), "unicode☼f64": 0.14285714285714285 (f64)
|
||||
- scope (wasm-expression-stack):
|
||||
at call_func (0:58):
|
||||
at call_func (0:123):
|
||||
- scope (module):
|
||||
globals: "global0": 15 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 15 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -344,11 +412,13 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/d374ef0a byte offset 60: Wasm opcode 0x0b
|
||||
Script wasm://wasm/2d24c81e byte offset 125: Wasm opcode 0x0b
|
||||
Scope:
|
||||
at call_func (0:60):
|
||||
at call_func (0:125):
|
||||
- scope (module):
|
||||
globals: "global0": 15 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 15 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 4 (i32), "var1": 7.199999809265137 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
|
@ -5,30 +5,36 @@ Calling instantiate function.
|
||||
Got wasm script!
|
||||
Setting breakpoint on line 2 (first instruction) of third function
|
||||
{
|
||||
columnNumber : 85
|
||||
columnNumber : 150
|
||||
lineNumber : 0
|
||||
scriptId : <scriptId>
|
||||
}
|
||||
Paused:
|
||||
Script wasm://wasm/c4eb034a byte offset 85: Wasm opcode 0x20
|
||||
Script wasm://wasm/be0fbeba byte offset 150: Wasm opcode 0x20
|
||||
Scope:
|
||||
at C (interpreted) (0:85):
|
||||
at C (interpreted) (0:150):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "i32_arg": 42 (i32), "i32_local": 0 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
at B (liftoff) (0:76):
|
||||
at B (liftoff) (0:141):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f32), "i32_arg": 42 (i32), "i32_local": 0 (i32), "f32_local": 7.199999809265137 (f32), "var5": 0 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 42 (i32)
|
||||
1: 3 (i32)
|
||||
at A (liftoff) (0:54):
|
||||
at A (liftoff) (0:119):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 42 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -37,26 +43,32 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/c4eb034a byte offset 87: Wasm opcode 0x24
|
||||
Script wasm://wasm/be0fbeba byte offset 152: Wasm opcode 0x24
|
||||
Scope:
|
||||
at C (interpreted) (0:87):
|
||||
at C (interpreted) (0:152):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "i32_arg": 42 (i32), "i32_local": 0 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 42 (i32)
|
||||
at B (liftoff) (0:76):
|
||||
at B (liftoff) (0:141):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f32), "i32_arg": 42 (i32), "i32_local": 0 (i32), "f32_local": 7.199999809265137 (f32), "var5": 0 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 42 (i32)
|
||||
1: 3 (i32)
|
||||
at A (liftoff) (0:54):
|
||||
at A (liftoff) (0:119):
|
||||
- scope (module):
|
||||
globals: "global0": 0 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 0 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 42 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -65,25 +77,31 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/c4eb034a byte offset 89: Wasm opcode 0x41
|
||||
Script wasm://wasm/be0fbeba byte offset 154: Wasm opcode 0x41
|
||||
Scope:
|
||||
at C (interpreted) (0:89):
|
||||
at C (interpreted) (0:154):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "i32_arg": 42 (i32), "i32_local": 0 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
at B (liftoff) (0:76):
|
||||
at B (liftoff) (0:141):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f32), "i32_arg": 42 (i32), "i32_local": 0 (i32), "f32_local": 7.199999809265137 (f32), "var5": 0 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 42 (i32)
|
||||
1: 3 (i32)
|
||||
at A (liftoff) (0:54):
|
||||
at A (liftoff) (0:119):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 42 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -92,26 +110,32 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/c4eb034a byte offset 91: Wasm opcode 0x21
|
||||
Script wasm://wasm/be0fbeba byte offset 156: Wasm opcode 0x21
|
||||
Scope:
|
||||
at C (interpreted) (0:91):
|
||||
at C (interpreted) (0:156):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "i32_arg": 42 (i32), "i32_local": 0 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 47 (i32)
|
||||
at B (liftoff) (0:76):
|
||||
at B (liftoff) (0:141):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f32), "i32_arg": 42 (i32), "i32_local": 0 (i32), "f32_local": 7.199999809265137 (f32), "var5": 0 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 42 (i32)
|
||||
1: 3 (i32)
|
||||
at A (liftoff) (0:54):
|
||||
at A (liftoff) (0:119):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 42 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -120,25 +144,31 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/c4eb034a byte offset 93: Wasm opcode 0x0b
|
||||
Script wasm://wasm/be0fbeba byte offset 158: Wasm opcode 0x0b
|
||||
Scope:
|
||||
at C (interpreted) (0:93):
|
||||
at C (interpreted) (0:158):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "i32_arg": 42 (i32), "i32_local": 47 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
at B (liftoff) (0:76):
|
||||
at B (liftoff) (0:141):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f32), "i32_arg": 42 (i32), "i32_local": 0 (i32), "f32_local": 7.199999809265137 (f32), "var5": 0 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 42 (i32)
|
||||
1: 3 (i32)
|
||||
at A (liftoff) (0:54):
|
||||
at A (liftoff) (0:119):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 42 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -147,19 +177,23 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/c4eb034a byte offset 78: Wasm opcode 0x1a
|
||||
Script wasm://wasm/be0fbeba byte offset 143: Wasm opcode 0x1a
|
||||
Scope:
|
||||
at B (liftoff) (0:78):
|
||||
at B (liftoff) (0:143):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f32), "i32_arg": 42 (i32), "i32_local": 0 (i32), "f32_local": 7.199999809265137 (f32), "var5": 0 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 42 (i32)
|
||||
1: 3 (i32)
|
||||
at A (liftoff) (0:54):
|
||||
at A (liftoff) (0:119):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 42 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -168,18 +202,22 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/c4eb034a byte offset 79: Wasm opcode 0x1a
|
||||
Script wasm://wasm/be0fbeba byte offset 144: Wasm opcode 0x1a
|
||||
Scope:
|
||||
at B (liftoff) (0:79):
|
||||
at B (liftoff) (0:144):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f32), "i32_arg": 42 (i32), "i32_local": 0 (i32), "f32_local": 7.199999809265137 (f32), "var5": 0 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
0: 42 (i32)
|
||||
at A (liftoff) (0:54):
|
||||
at A (liftoff) (0:119):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 42 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -188,17 +226,21 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/c4eb034a byte offset 80: Wasm opcode 0x0b
|
||||
Script wasm://wasm/be0fbeba byte offset 145: Wasm opcode 0x0b
|
||||
Scope:
|
||||
at B (liftoff) (0:80):
|
||||
at B (liftoff) (0:145):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "0": 0 (f32), "i32_arg": 42 (i32), "i32_local": 0 (i32), "f32_local": 7.199999809265137 (f32), "var5": 0 (f32)
|
||||
- scope (wasm-expression-stack):
|
||||
at A (liftoff) (0:54):
|
||||
at A (liftoff) (0:119):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 42 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -207,11 +249,13 @@ at (anonymous) (0:17):
|
||||
-- skipped globals
|
||||
|
||||
Paused:
|
||||
Script wasm://wasm/c4eb034a byte offset 56: Wasm opcode 0x0b
|
||||
Script wasm://wasm/be0fbeba byte offset 121: Wasm opcode 0x0b
|
||||
Scope:
|
||||
at A (liftoff) (0:56):
|
||||
at A (liftoff) (0:121):
|
||||
- scope (module):
|
||||
globals: "global0": 42 (i32)
|
||||
instance: exports: "exported_global" (Global), "exported_memory" (Memory), "exported_table" (Table), "main" (Function)
|
||||
exported_memory: Uint8Array(65536)
|
||||
globals: "exported_global": 42 (i32)
|
||||
- scope (local):
|
||||
locals: "var0": 42 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
|
@ -62,8 +62,10 @@ async function instantiateWasm() {
|
||||
utils.load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
|
||||
var builder = new WasmModuleBuilder();
|
||||
// Also add a global, so we have some global scope.
|
||||
builder.addGlobal(kWasmI32, true);
|
||||
// Add a global, memory and exports to populate the module scope.
|
||||
builder.addGlobal(kWasmI32, true).exportAs('exported_global');
|
||||
builder.addMemory(1,1).exportMemoryAs('exported_memory');
|
||||
builder.addTable(kWasmAnyFunc, 0).exportAs('exported_table');
|
||||
|
||||
// Add two functions without breakpoint, to check that locals and operand
|
||||
// stack values are shown correctly in Liftoff code.
|
||||
@ -144,8 +146,11 @@ async function waitForWasmScripts() {
|
||||
return wasm_script_ids;
|
||||
}
|
||||
|
||||
async function getScopeValues(value) {
|
||||
async function getScopeValues(name, value) {
|
||||
if (value.type == 'object') {
|
||||
if (value.subtype == 'typedarray') return value.description;
|
||||
if (name == 'instance') return dumpInstanceProperties(value);
|
||||
|
||||
let msg = await Protocol.Runtime.getProperties({objectId: value.objectId});
|
||||
printIfFailure(msg);
|
||||
const printProperty = function(elem) {
|
||||
@ -159,11 +164,34 @@ async function getScopeValues(value) {
|
||||
async function dumpScopeProperties(message) {
|
||||
printIfFailure(message);
|
||||
for (var value of message.result.result) {
|
||||
var value_str = await getScopeValues(value.value);
|
||||
var value_str = await getScopeValues(value.name, value.value);
|
||||
InspectorTest.log(' ' + value.name + ': ' + value_str);
|
||||
}
|
||||
}
|
||||
|
||||
async function dumpInstanceProperties(instanceObj) {
|
||||
function invokeGetter(property) {
|
||||
return this[JSON.parse(property)];
|
||||
}
|
||||
|
||||
const exportsName = 'exports';
|
||||
let exportsObj = await Protocol.Runtime.callFunctionOn(
|
||||
{objectId: instanceObj.objectId,
|
||||
functionDeclaration: invokeGetter.toString(),
|
||||
arguments: [{value: JSON.stringify(exportsName)}]
|
||||
});
|
||||
printIfFailure(exportsObj);
|
||||
let exports = await Protocol.Runtime.getProperties(
|
||||
{objectId: exportsObj.result.result.objectId});
|
||||
printIfFailure(exports);
|
||||
|
||||
const printExports = function(value) {
|
||||
return `"${value.name}" (${value.value.className})`;
|
||||
}
|
||||
const formattedExports = exports.result.result.map(printExports).join(', ');
|
||||
return `${exportsName}: ${formattedExports}`
|
||||
}
|
||||
|
||||
function getWasmValue(wasmValue) {
|
||||
return typeof (wasmValue.value) === 'undefined' ?
|
||||
wasmValue.unserializableValue :
|
||||
|
@ -67,8 +67,10 @@ async function instantiateWasm() {
|
||||
utils.load('test/mjsunit/wasm/wasm-module-builder.js');
|
||||
|
||||
var builder = new WasmModuleBuilder();
|
||||
// Also add a global, so we have some global scope.
|
||||
builder.addGlobal(kWasmI32, true);
|
||||
// Add a global, memory and exports to populate the module scope.
|
||||
builder.addGlobal(kWasmI32, true).exportAs('exported_global');
|
||||
builder.addMemory(1,1).exportMemoryAs('exported_memory');
|
||||
builder.addTable(kWasmAnyFunc, 0).exportAs('exported_table');
|
||||
|
||||
// Add a function without breakpoint, to check that locals are shown
|
||||
// correctly in compiled code.
|
||||
@ -142,8 +144,11 @@ async function waitForWasmScripts() {
|
||||
return wasm_script_ids;
|
||||
}
|
||||
|
||||
async function getScopeValues(value) {
|
||||
async function getScopeValues(name, value) {
|
||||
if (value.type == 'object') {
|
||||
if (value.subtype == 'typedarray') return value.description;
|
||||
if (name == 'instance') return dumpInstanceProperties(value);
|
||||
|
||||
let msg = await Protocol.Runtime.getProperties({objectId: value.objectId});
|
||||
printIfFailure(msg);
|
||||
const printProperty = function(elem) {
|
||||
@ -157,11 +162,34 @@ async function getScopeValues(value) {
|
||||
async function dumpScopeProperties(message) {
|
||||
printIfFailure(message);
|
||||
for (var value of message.result.result) {
|
||||
var value_str = await getScopeValues(value.value);
|
||||
var value_str = await getScopeValues(value.name, value.value);
|
||||
InspectorTest.log(' ' + value.name + ': ' + value_str);
|
||||
}
|
||||
}
|
||||
|
||||
async function dumpInstanceProperties(instanceObj) {
|
||||
function invokeGetter(property) {
|
||||
return this[JSON.parse(property)];
|
||||
}
|
||||
|
||||
const exportsName = 'exports';
|
||||
let exportsObj = await Protocol.Runtime.callFunctionOn(
|
||||
{objectId: instanceObj.objectId,
|
||||
functionDeclaration: invokeGetter.toString(),
|
||||
arguments: [{value: JSON.stringify(exportsName)}]
|
||||
});
|
||||
printIfFailure(exportsObj);
|
||||
let exports = await Protocol.Runtime.getProperties(
|
||||
{objectId: exportsObj.result.result.objectId});
|
||||
printIfFailure(exports);
|
||||
|
||||
const printExports = function(value) {
|
||||
return `"${value.name}" (${value.value.className})`;
|
||||
}
|
||||
const formattedExports = exports.result.result.map(printExports).join(', ');
|
||||
return `${exportsName}: ${formattedExports}`
|
||||
}
|
||||
|
||||
function getWasmValue(wasmValue) {
|
||||
return typeof (wasmValue.value) === 'undefined' ?
|
||||
wasmValue.unserializableValue :
|
||||
|
@ -8,10 +8,12 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01
|
||||
Scope:
|
||||
at wasm_A (0:38):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
- scope (wasm-expression-stack):
|
||||
at wasm_B (0:56):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 3 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -31,10 +33,12 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01
|
||||
Scope:
|
||||
at wasm_A (0:39):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
- scope (wasm-expression-stack):
|
||||
at wasm_B (0:56):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 3 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -45,6 +49,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20
|
||||
Scope:
|
||||
at wasm_B (0:45):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 3 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -55,6 +60,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04
|
||||
Scope:
|
||||
at wasm_B (0:47):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 3 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -66,6 +72,7 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20
|
||||
Scope:
|
||||
at wasm_B (0:49):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 3 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -76,6 +83,7 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41
|
||||
Scope:
|
||||
at wasm_B (0:51):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 3 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -87,6 +95,7 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b
|
||||
Scope:
|
||||
at wasm_B (0:53):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 3 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -99,6 +108,7 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21
|
||||
Scope:
|
||||
at wasm_B (0:54):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 3 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -110,10 +120,12 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01
|
||||
Scope:
|
||||
at wasm_A (0:38):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
- scope (wasm-expression-stack):
|
||||
at wasm_B (0:56):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 2 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -124,10 +136,12 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01
|
||||
Scope:
|
||||
at wasm_A (0:39):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
- scope (wasm-expression-stack):
|
||||
at wasm_B (0:56):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 2 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -138,6 +152,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20
|
||||
Scope:
|
||||
at wasm_B (0:45):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 2 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -148,6 +163,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04
|
||||
Scope:
|
||||
at wasm_B (0:47):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 2 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -159,6 +175,7 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20
|
||||
Scope:
|
||||
at wasm_B (0:49):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 2 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -169,6 +186,7 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41
|
||||
Scope:
|
||||
at wasm_B (0:51):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 2 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -180,6 +198,7 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b
|
||||
Scope:
|
||||
at wasm_B (0:53):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 2 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -192,6 +211,7 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21
|
||||
Scope:
|
||||
at wasm_B (0:54):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 2 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -203,10 +223,12 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01
|
||||
Scope:
|
||||
at wasm_A (0:38):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
- scope (wasm-expression-stack):
|
||||
at wasm_B (0:56):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 1 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -217,10 +239,12 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01
|
||||
Scope:
|
||||
at wasm_A (0:39):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
- scope (wasm-expression-stack):
|
||||
at wasm_B (0:56):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 1 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -231,6 +255,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20
|
||||
Scope:
|
||||
at wasm_B (0:45):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 1 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -241,6 +266,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04
|
||||
Scope:
|
||||
at wasm_B (0:47):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 1 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -252,6 +278,7 @@ Script wasm://wasm/0c10a5fe byte offset 49: Wasm opcode 0x20
|
||||
Scope:
|
||||
at wasm_B (0:49):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 1 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -262,6 +289,7 @@ Script wasm://wasm/0c10a5fe byte offset 51: Wasm opcode 0x41
|
||||
Scope:
|
||||
at wasm_B (0:51):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 1 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -273,6 +301,7 @@ Script wasm://wasm/0c10a5fe byte offset 53: Wasm opcode 0x6b
|
||||
Scope:
|
||||
at wasm_B (0:53):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 1 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -285,6 +314,7 @@ Script wasm://wasm/0c10a5fe byte offset 54: Wasm opcode 0x21
|
||||
Scope:
|
||||
at wasm_B (0:54):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 1 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -296,10 +326,12 @@ Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01
|
||||
Scope:
|
||||
at wasm_A (0:38):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
- scope (wasm-expression-stack):
|
||||
at wasm_B (0:56):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 0 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -310,10 +342,12 @@ Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01
|
||||
Scope:
|
||||
at wasm_A (0:39):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
- scope (wasm-expression-stack):
|
||||
at wasm_B (0:56):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 0 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -324,6 +358,7 @@ Script wasm://wasm/0c10a5fe byte offset 45: Wasm opcode 0x20
|
||||
Scope:
|
||||
at wasm_B (0:45):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 0 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -334,6 +369,7 @@ Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04
|
||||
Scope:
|
||||
at wasm_B (0:47):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 0 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
@ -345,6 +381,7 @@ Script wasm://wasm/0c10a5fe byte offset 61: Wasm opcode 0x0b
|
||||
Scope:
|
||||
at wasm_B (0:61):
|
||||
- scope (module):
|
||||
instance: exports: "main" (Function)
|
||||
- scope (local):
|
||||
locals: "var0": 0 (i32)
|
||||
- scope (wasm-expression-stack):
|
||||
|
@ -83,7 +83,7 @@ Protocol.Debugger.onPaused(async msg => {
|
||||
var properties = await Protocol.Runtime.getProperties(
|
||||
{'objectId': scope.object.objectId});
|
||||
for (var value of properties.result.result) {
|
||||
var value_str = await getScopeValues(value.value);
|
||||
var value_str = await getScopeValues(value.name, value.value);
|
||||
InspectorTest.log(' ' + value.name + ': ' + value_str);
|
||||
}
|
||||
}
|
||||
@ -108,8 +108,10 @@ function getWasmValue(value) {
|
||||
value.value;
|
||||
}
|
||||
|
||||
async function getScopeValues(value) {
|
||||
async function getScopeValues(name, value) {
|
||||
if (value.type == 'object') {
|
||||
if (name == 'instance') return dumpInstanceProperties(value);
|
||||
|
||||
let msg = await Protocol.Runtime.getProperties({objectId: value.objectId});
|
||||
const printProperty = function(elem) {
|
||||
return `"${elem.name}": ${getWasmValue(elem.value)} (${elem.value.subtype})`;
|
||||
@ -119,6 +121,27 @@ async function getScopeValues(value) {
|
||||
return getWasmValue(value) + ' (' + value.subtype + ')';
|
||||
}
|
||||
|
||||
async function dumpInstanceProperties(instanceObj) {
|
||||
function invokeGetter(property) {
|
||||
return this[JSON.parse(property)];
|
||||
}
|
||||
|
||||
const exportsName = 'exports';
|
||||
let exportsObj = await Protocol.Runtime.callFunctionOn(
|
||||
{objectId: instanceObj.objectId,
|
||||
functionDeclaration: invokeGetter.toString(),
|
||||
arguments: [{value: JSON.stringify(exportsName)}]
|
||||
});
|
||||
let exports = await Protocol.Runtime.getProperties(
|
||||
{objectId: exportsObj.result.result.objectId});
|
||||
|
||||
const printExports = function(value) {
|
||||
return `"${value.name}" (${value.value.className})`;
|
||||
}
|
||||
const formattedExports = exports.result.result.map(printExports).join(', ');
|
||||
return `${exportsName}: ${formattedExports}`
|
||||
}
|
||||
|
||||
(async function test() {
|
||||
await Protocol.Debugger.enable();
|
||||
InspectorTest.log('Instantiating.');
|
||||
|
Loading…
Reference in New Issue
Block a user