[wasm][debug] Fix printing of wasm opcodes

This is a minor cosmetic fix. Wasm opcodes are bytes, hence they should
always be printed as an even number of hexadecimal digits.
Note that currently we only print a single byte anyway, but in the
future we will want to extend this to correctly parse multi-byte
opcodes. Those will also be printed as an even number of characters
then.

R=thibaudm@chromium.org

Bug: v8:10351
Change-Id: I2423277b470d74c1c72cb619c2a43bb978423bc0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2122025
Reviewed-by: Thibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66883}
This commit is contained in:
Clemens Backes 2020-03-26 18:29:15 +01:00 committed by Commit Bot
parent 982c4abaed
commit a1d2e34260
9 changed files with 60 additions and 57 deletions

View File

@ -4,11 +4,11 @@ Calling instantiate function for module A.
Waiting for wasm script to be parsed.
Got wasm script!
Setting breakpoint in line 1:
Script wasm://wasm/8c388106 byte offset 33: Wasm opcode 0x1
Script wasm://wasm/8c388106 byte offset 33: Wasm opcode 0x01
Calling instantiate function for module B.
Calling main function on module B.
Paused at 0:33.
Script wasm://wasm/8c388106 byte offset 33: Wasm opcode 0x1
Script wasm://wasm/8c388106 byte offset 33: Wasm opcode 0x01
Getting current stack trace via "new Error().stack".
Error
at v8://test/getStack:1:1

View File

@ -357,7 +357,7 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/d374ef0a byte offset 116: Wasm opcode 0xb
Script wasm://wasm/d374ef0a byte offset 116: Wasm opcode 0x0b
Scope:
at func (0:116):
- scope (global):
@ -378,7 +378,7 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/d374ef0a byte offset 60: Wasm opcode 0xb
Script wasm://wasm/d374ef0a byte offset 60: Wasm opcode 0x0b
Scope:
at call_func (0:60):
- scope (global):

View File

@ -132,7 +132,7 @@ at (anonymous) (0:17):
-- skipped globals
Paused:
Script wasm://wasm/c4eb034a byte offset 93: Wasm opcode 0xb
Script wasm://wasm/c4eb034a byte offset 93: Wasm opcode 0x0b
Scope:
at C (interpreted) (0:93):
- scope (global):

View File

@ -4,7 +4,7 @@ Waiting for wasm script (ignoring first non-wasm script).
Setting breakpoint at offset 38 on script wasm://wasm/0c10a5fe
Calling main(4)
Paused:
Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x1
Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01
Scope:
at wasm_A (0:38):
- scope (global):
@ -29,7 +29,7 @@ Setting breakpoint at offset 49 on script v8://test/runWasm
Setting breakpoint at offset 45 on script v8://test/runWasm
Setting breakpoint at offset 47 on script v8://test/runWasm
Paused:
Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x1
Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01
Scope:
at wasm_A (0:39):
- scope (global):
@ -56,7 +56,7 @@ at wasm_B (0:45):
at (anonymous) (0:17):
-- skipped
Paused:
Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x4
Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04
Scope:
at wasm_B (0:47):
- scope (global):
@ -116,7 +116,7 @@ at wasm_B (0:54):
at (anonymous) (0:17):
-- skipped
Paused:
Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x1
Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01
Scope:
at wasm_A (0:38):
- scope (global):
@ -132,7 +132,7 @@ at wasm_B (0:56):
at (anonymous) (0:17):
-- skipped
Paused:
Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x1
Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01
Scope:
at wasm_A (0:39):
- scope (global):
@ -159,7 +159,7 @@ at wasm_B (0:45):
at (anonymous) (0:17):
-- skipped
Paused:
Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x4
Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04
Scope:
at wasm_B (0:47):
- scope (global):
@ -219,7 +219,7 @@ at wasm_B (0:54):
at (anonymous) (0:17):
-- skipped
Paused:
Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x1
Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01
Scope:
at wasm_A (0:38):
- scope (global):
@ -235,7 +235,7 @@ at wasm_B (0:56):
at (anonymous) (0:17):
-- skipped
Paused:
Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x1
Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01
Scope:
at wasm_A (0:39):
- scope (global):
@ -262,7 +262,7 @@ at wasm_B (0:45):
at (anonymous) (0:17):
-- skipped
Paused:
Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x4
Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04
Scope:
at wasm_B (0:47):
- scope (global):
@ -322,7 +322,7 @@ at wasm_B (0:54):
at (anonymous) (0:17):
-- skipped
Paused:
Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x1
Script wasm://wasm/0c10a5fe byte offset 38: Wasm opcode 0x01
Scope:
at wasm_A (0:38):
- scope (global):
@ -338,7 +338,7 @@ at wasm_B (0:56):
at (anonymous) (0:17):
-- skipped
Paused:
Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x1
Script wasm://wasm/0c10a5fe byte offset 39: Wasm opcode 0x01
Scope:
at wasm_A (0:39):
- scope (global):
@ -365,7 +365,7 @@ at wasm_B (0:45):
at (anonymous) (0:17):
-- skipped
Paused:
Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x4
Script wasm://wasm/0c10a5fe byte offset 47: Wasm opcode 0x04
Scope:
at wasm_B (0:47):
- scope (global):
@ -377,7 +377,7 @@ at wasm_B (0:47):
at (anonymous) (0:17):
-- skipped
Paused:
Script wasm://wasm/0c10a5fe byte offset 61: Wasm opcode 0xb
Script wasm://wasm/0c10a5fe byte offset 61: Wasm opcode 0x0b
Scope:
at wasm_B (0:61):
- scope (global):

View File

@ -20,7 +20,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Script wasm://wasm/befe41aa byte offset 39: Wasm opcode 0x1
Script wasm://wasm/befe41aa byte offset 39: Wasm opcode 0x01
at wasm_A (0:39):
- scope (global):
-- skipped
@ -41,7 +41,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepOver called
Script wasm://wasm/befe41aa byte offset 40: Wasm opcode 0x1
Script wasm://wasm/befe41aa byte offset 40: Wasm opcode 0x01
at wasm_A (0:40):
- scope (global):
-- skipped
@ -62,7 +62,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepOut called
Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0xc
Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c
at wasm_B (0:62):
- scope (global):
-- skipped
@ -88,7 +88,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepOver called
Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0xc
Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c
at wasm_B (0:62):
- scope (global):
-- skipped
@ -127,7 +127,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Script wasm://wasm/befe41aa byte offset 39: Wasm opcode 0x1
Script wasm://wasm/befe41aa byte offset 39: Wasm opcode 0x01
at wasm_A (0:39):
- scope (global):
-- skipped
@ -148,7 +148,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepOut called
Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0xc
Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c
at wasm_B (0:62):
- scope (global):
-- skipped
@ -174,7 +174,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Script wasm://wasm/befe41aa byte offset 48: Wasm opcode 0x4
Script wasm://wasm/befe41aa byte offset 48: Wasm opcode 0x04
at wasm_B (0:48):
- scope (global):
-- skipped
@ -265,7 +265,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Script wasm://wasm/befe41aa byte offset 39: Wasm opcode 0x1
Script wasm://wasm/befe41aa byte offset 39: Wasm opcode 0x01
at wasm_A (0:39):
- scope (global):
-- skipped
@ -286,7 +286,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Script wasm://wasm/befe41aa byte offset 40: Wasm opcode 0x1
Script wasm://wasm/befe41aa byte offset 40: Wasm opcode 0x01
at wasm_A (0:40):
- scope (global):
-- skipped
@ -307,7 +307,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Script wasm://wasm/befe41aa byte offset 41: Wasm opcode 0xb
Script wasm://wasm/befe41aa byte offset 41: Wasm opcode 0x0b
at wasm_A (0:41):
- scope (global):
-- skipped
@ -328,7 +328,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0xc
Script wasm://wasm/befe41aa byte offset 62: Wasm opcode 0x0c
at wasm_B (0:62):
- scope (global):
-- skipped

View File

@ -9,27 +9,27 @@ Setting breakpoint on offset 72 (should be propagated to 73, the offset of the c
}
Script wasm://wasm/42af3c82 byte offset 73: Wasm opcode 0x10
Debugger.stepInto called
Script wasm://wasm/42af3c82 byte offset 52: Wasm opcode 0x1
Script wasm://wasm/42af3c82 byte offset 52: Wasm opcode 0x01
Debugger.stepOver called
Script wasm://wasm/42af3c82 byte offset 53: Wasm opcode 0x1
Script wasm://wasm/42af3c82 byte offset 53: Wasm opcode 0x01
Debugger.stepOut called
Script wasm://wasm/42af3c82 byte offset 75: Wasm opcode 0xc
Script wasm://wasm/42af3c82 byte offset 75: Wasm opcode 0x0c
Debugger.stepOut called
Script wasm://wasm/42af3c82 byte offset 73: Wasm opcode 0x10
Debugger.stepOver called
Script wasm://wasm/42af3c82 byte offset 75: Wasm opcode 0xc
Script wasm://wasm/42af3c82 byte offset 75: Wasm opcode 0x0c
Debugger.stepInto called
Script wasm://wasm/42af3c82 byte offset 59: Wasm opcode 0x20
Debugger.resume called
Script wasm://wasm/42af3c82 byte offset 73: Wasm opcode 0x10
Debugger.stepInto called
Script wasm://wasm/42af3c82 byte offset 52: Wasm opcode 0x1
Script wasm://wasm/42af3c82 byte offset 52: Wasm opcode 0x01
Debugger.stepOut called
Script wasm://wasm/42af3c82 byte offset 75: Wasm opcode 0xc
Script wasm://wasm/42af3c82 byte offset 75: Wasm opcode 0x0c
Debugger.stepInto called
Script wasm://wasm/42af3c82 byte offset 59: Wasm opcode 0x20
Debugger.stepInto called
Script wasm://wasm/42af3c82 byte offset 61: Wasm opcode 0x4
Script wasm://wasm/42af3c82 byte offset 61: Wasm opcode 0x04
Debugger.stepInto called
Script wasm://wasm/42af3c82 byte offset 63: Wasm opcode 0x20
Debugger.stepInto called
@ -43,13 +43,13 @@ Script wasm://wasm/42af3c82 byte offset 70: Wasm opcode 0x41
Debugger.stepInto called
Script wasm://wasm/42af3c82 byte offset 73: Wasm opcode 0x10
Debugger.stepInto called
Script wasm://wasm/42af3c82 byte offset 52: Wasm opcode 0x1
Script wasm://wasm/42af3c82 byte offset 52: Wasm opcode 0x01
Debugger.stepInto called
Script wasm://wasm/42af3c82 byte offset 53: Wasm opcode 0x1
Script wasm://wasm/42af3c82 byte offset 53: Wasm opcode 0x01
Debugger.stepInto called
Script wasm://wasm/42af3c82 byte offset 54: Wasm opcode 0xb
Script wasm://wasm/42af3c82 byte offset 54: Wasm opcode 0x0b
Debugger.stepInto called
Script wasm://wasm/42af3c82 byte offset 75: Wasm opcode 0xc
Script wasm://wasm/42af3c82 byte offset 75: Wasm opcode 0x0c
Debugger.stepInto called
Script wasm://wasm/42af3c82 byte offset 59: Wasm opcode 0x20
Debugger.resume called

View File

@ -18,7 +18,7 @@ function test() {
Debugger.resume
paused
Script wasm://wasm/242f4a16 byte offset 33: Wasm opcode 0x1
Script wasm://wasm/242f4a16 byte offset 33: Wasm opcode 0x01
Debugger.stepOut
paused
instance.exports.main();
@ -37,10 +37,10 @@ function test() {
Debugger.resume
paused
Script wasm://wasm/242f4a16 byte offset 33: Wasm opcode 0x1
Script wasm://wasm/242f4a16 byte offset 33: Wasm opcode 0x01
Debugger.stepOver
paused
Script wasm://wasm/242f4a16 byte offset 34: Wasm opcode 0xb
Script wasm://wasm/242f4a16 byte offset 34: Wasm opcode 0x0b
Debugger.resume
exports.main returned!
Finished run 2!
@ -53,10 +53,11 @@ function test() {
Debugger.resume
paused
Script wasm://wasm/242f4a16 byte offset 33: Wasm opcode 0x1
Script wasm://wasm/242f4a16 byte offset 33: Wasm opcode 0x01
Debugger.stepInto
paused
Script wasm://wasm/242f4a16 byte offset 34: Wasm opcode 0xb
Script wasm://wasm/242f4a16 byte offset 34: Wasm opcode 0x0b
Debugger.resume
exports.main returned!
Finished run 3!

View File

@ -36,7 +36,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Script wasm://wasm/9b4bf87e byte offset 38: Wasm opcode 0x1
Script wasm://wasm/9b4bf87e byte offset 38: Wasm opcode 0x01
at wasm_A (0:38):
- scope (global):
-- skipped
@ -56,7 +56,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepOver called
Script wasm://wasm/9b4bf87e byte offset 39: Wasm opcode 0x1
Script wasm://wasm/9b4bf87e byte offset 39: Wasm opcode 0x01
at wasm_A (0:39):
- scope (global):
-- skipped
@ -76,7 +76,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepOut called
Script wasm://wasm/9b4bf87e byte offset 58: Wasm opcode 0xc
Script wasm://wasm/9b4bf87e byte offset 58: Wasm opcode 0x0c
at wasm_B (0:58):
- scope (global):
-- skipped
@ -115,7 +115,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepOver called
Script wasm://wasm/9b4bf87e byte offset 58: Wasm opcode 0xc
Script wasm://wasm/9b4bf87e byte offset 58: Wasm opcode 0x0c
at wasm_B (0:58):
- scope (global):
-- skipped
@ -154,7 +154,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Script wasm://wasm/9b4bf87e byte offset 38: Wasm opcode 0x1
Script wasm://wasm/9b4bf87e byte offset 38: Wasm opcode 0x01
at wasm_A (0:38):
- scope (global):
-- skipped
@ -174,7 +174,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepOut called
Script wasm://wasm/9b4bf87e byte offset 58: Wasm opcode 0xc
Script wasm://wasm/9b4bf87e byte offset 58: Wasm opcode 0x0c
at wasm_B (0:58):
- scope (global):
-- skipped
@ -200,7 +200,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Script wasm://wasm/9b4bf87e byte offset 47: Wasm opcode 0x4
Script wasm://wasm/9b4bf87e byte offset 47: Wasm opcode 0x04
at wasm_B (0:47):
- scope (global):
-- skipped
@ -278,7 +278,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Script wasm://wasm/9b4bf87e byte offset 38: Wasm opcode 0x1
Script wasm://wasm/9b4bf87e byte offset 38: Wasm opcode 0x01
at wasm_A (0:38):
- scope (global):
-- skipped
@ -298,7 +298,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Script wasm://wasm/9b4bf87e byte offset 39: Wasm opcode 0x1
Script wasm://wasm/9b4bf87e byte offset 39: Wasm opcode 0x01
at wasm_A (0:39):
- scope (global):
-- skipped
@ -318,7 +318,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Script wasm://wasm/9b4bf87e byte offset 40: Wasm opcode 0xb
Script wasm://wasm/9b4bf87e byte offset 40: Wasm opcode 0x0b
at wasm_A (0:40):
- scope (global):
-- skipped
@ -338,7 +338,7 @@ at (anonymous) (0:17):
- scope (global):
-- skipped
Debugger.stepInto called
Script wasm://wasm/9b4bf87e byte offset 58: Wasm opcode 0xc
Script wasm://wasm/9b4bf87e byte offset 58: Wasm opcode 0x0c
at wasm_B (0:58):
- scope (global):
-- skipped

View File

@ -287,7 +287,9 @@ InspectorTest.Session = class {
if (location.lineNumber != 0) {
InspectorTest.log('Unexpected wasm line number: ' + location.lineNumber);
}
InspectorTest.log(`Script ${script.url} byte offset ${location.columnNumber}: Wasm opcode 0x${script.bytecode[location.columnNumber].toString(16)}`);
let wasm_opcode = script.bytecode[location.columnNumber].toString(16);
if (wasm_opcode.length % 2) wasm_opcode = '0' + wasm_opcode;
InspectorTest.log(`Script ${script.url} byte offset ${location.columnNumber}: Wasm opcode 0x${wasm_opcode}`);
} else {
var lines = script.scriptSource.split('\n');
var line = lines[location.lineNumber];