From a63bc6bb1b3fccdf5c726e47681d7552174bb63b Mon Sep 17 00:00:00 2001 From: edeiana Date: Tue, 29 Oct 2024 13:06:50 -0700 Subject: [PATCH] i#6662: view tool spacing fix In REGDEPS public traces the encodings of instructions printed with the `view` tool are divided in 4 byte words, 2 words on the first line and an additional 2 on the second line (if necessary). Instructions that only have 1 word encodings (e.g., a branch) have their categories printed right after the encodings of their first word and don't align with the categories of 2 or more words instructions. For single word instructions we now add spacing equivalent to a second word. Issue #6662 --- core/ir/isa_regdeps/disassemble.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/ir/isa_regdeps/disassemble.c b/core/ir/isa_regdeps/disassemble.c index 47b08361305..0ac34ee80fc 100644 --- a/core/ir/isa_regdeps/disassemble.c +++ b/core/ir/isa_regdeps/disassemble.c @@ -70,11 +70,15 @@ d_r_regdeps_print_encoding_first_line(char *buf, size_t bufsz, */ print_to_buffer(buf, bufsz, sofar, " %08x", *((uint *)pc)); - /* Print second 4 byte word, if any. + /* Print second 4 byte word, if any. Otherwise, print an equivalent number of spaces + * to align single-word instructions categories after their encodings (total of + * 9 spaces: 1 separator from the first word + 8 to substitute the second word). */ if (sz > REGDEPS_BYTES_PER_WORD) { print_to_buffer(buf, bufsz, sofar, " %08x", *((uint *)(pc + REGDEPS_BYTES_PER_WORD))); + } else { + print_to_buffer(buf, bufsz, sofar, " "); } /* Add a space at the end.