Skip to content

Commit

Permalink
i#6662: view tool spacing fix
Browse files Browse the repository at this point in the history
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
  • Loading branch information
edeiana committed Oct 29, 2024
1 parent b88a389 commit a63bc6b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/ir/isa_regdeps/disassemble.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a63bc6b

Please sign in to comment.