Open
Bug 1380642
Opened 7 years ago
Updated 2 years ago
Hide ordinals in wasm debugging
Categories
(DevTools :: Debugger, enhancement, P5)
DevTools
Debugger
Tracking
(Not tracked)
NEW
People
(Reporter: jujjyl, Unassigned)
References
(Blocks 1 open bug)
Details
STR:
Take a look at http://clbri.com/dump/wasm_debug/wasm_debug.html in wasm debugger.
The debugger shows the _main function of the wasm module as
(export "_main" $func22)
(func $func22 (result i32)
(local $var0 i32) (local $var1 i32) (local $var2 i32) (local $var3 i32)
block
get_global $global12
set_local $var3
get_global $global12
i32.const 16
i32.add
set_global $global12
get_global $global12
get_global $global13
i32.ge_s
if
i32.const 16
call $import3
end
get_local $var3
set_local $var1
get_local $var3
i32.const 4
i32.add
set_local $var0
get_local $var0
i32.const 1400
i64.load align=1
i64.store align=1
get_local $var0
i32.const 8
i32.add
i32.const 1400
i32.const 8
i32.add
i32.load16_s align=1
i32.store16 align=1
get_local $var1
get_local $var0
i32.store
i32.const 1410
get_local $var1
call $func68
drop
get_local $var3
set_global $global12
i32.const 0
return
unreachable
end
unreachable
)
The decompiled .wast file is at
http://clbri.com/dump/wasm_debug/wasm_debug.wast
which reads
(import "env" "STACKTOP" (global $import$3 i32))
(export "_main" (func $_main))
(func $_main (type $2) (result i32)
(local $var$0 i32)
(local $var$1 i32)
(local $var$2 i32)
(local $var$3 i32)
(block $label$0
(set_local $var$3
(get_global $global$3)
)
(set_global $global$3
(i32.add
(get_global $global$3)
(i32.const 16)
)
)
(if
(i32.ge_s
(get_global $global$3)
(get_global $global$4)
)
(block $label$1
(call $import$10
(i32.const 16)
)
)
)
(set_local $var$1
(get_local $var$3)
)
(set_local $var$0
(i32.add
(get_local $var$3)
(i32.const 4)
)
)
(i64.store align=1
(get_local $var$0)
(i64.load align=1
(i32.const 1400)
)
)
(i32.store16 align=1
(i32.add
(get_local $var$0)
(i32.const 8)
)
(i32.load16_s align=1
(i32.add
(i32.const 1400)
(i32.const 8)
)
)
)
(i32.store
(get_local $var$1)
(get_local $var$0)
)
(drop
(call $_printf
(i32.const 1410)
(get_local $var$1)
)
)
(set_global $global$3
(get_local $var$3)
)
(return
(i32.const 0)
)
(unreachable)
)
(unreachable)
)
It would be good to remove the indirection on the ordinals, and directly print out the symbol names in question. That is, could the debugger show
> (func "_main" (result i32)
instead of
> (func $func22 (result i32)
and
> get_global "STACKTOP"
for
> (import "env" "STACKTOP" (global $import$3 i32))
> (global $global$3 (mut i32) (get_global $import$3))
> (get_global $global$3)
and
> call "abortStackOverflow"
instead of
> call $import3
Perhaps the ordinal numbers could be shown in parentheses after the name? such as call "abortStackOverflow" ($import3) ?
Comment 1•7 years ago
|
||
I think it'd be good if our output (by default) was valid according to the official text format:
https://webassembly.github.io/spec/text/instructions.html#expressions
Fortunately, the text format has the following abbreviation:
(func $func22 (export "_main") ...)
(global $glob1 (export "STACKTOP") ...)
for definitions (with the $ name optional if it isn't used).
For uses (get_global) there is no such abbreviation, so I'd recommend putting it in a (* comment *).
Comment 2•7 years ago
|
||
Actually, probably the better option for uses is to have the name section or export name be used as the $ name, instead of an auto-generated $ name, when present.
Updated•6 years ago
|
Product: Firefox → DevTools
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•