diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-11-02 15:53:43 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2022-12-05 10:05:45 +0000 |
commit | 2438b771ee07be19d5b01ea55e077dd8b7cef445 (patch) | |
tree | e101b74fec42b0e6a71dde75130cf351af01996d /opcodes | |
parent | 47afa56ee2bba22111df848ebeeec8c0a616ae73 (diff) | |
download | fsf-binutils-gdb-2438b771ee07be19d5b01ea55e077dd8b7cef445.zip fsf-binutils-gdb-2438b771ee07be19d5b01ea55e077dd8b7cef445.tar.gz fsf-binutils-gdb-2438b771ee07be19d5b01ea55e077dd8b7cef445.tar.bz2 |
opcodes/mips: use .word/.short for undefined instructions
While working on disassembler styling for MIPS, I noticed that
undefined instructions are printed by the disassembler as raw number
with no assembler directive prefix (e.g. without .word or .short).
I think adding something like .word, or .short, helps to make it
clearer the size of the value that is being displayed, and is inline
with what many of the other libopcode disassemblers do.
In this commit I've added the .word and .short directives, and updated
all the tests that I spotted that failed as a result.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/mips-dis.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c index faeebcc..1d9875f 100644 --- a/opcodes/mips-dis.c +++ b/opcodes/mips-dis.c @@ -2020,7 +2020,7 @@ print_insn_mips (bfd_vma memaddr, /* Handle undefined instructions. */ info->insn_type = dis_noninsn; - infprintf (is, "0x%x", word); + infprintf (is, ".word\t0x%x", word); return INSNLEN; } @@ -2398,7 +2398,7 @@ print_insn_mips16 (bfd_vma memaddr, struct disassemble_info *info) } #undef GET_OP - infprintf (is, "0x%x", first); + infprintf (is, ".short\t0x%x", first); info->insn_type = dis_noninsn; return 2; @@ -2515,7 +2515,10 @@ print_insn_micromips (bfd_vma memaddr, struct disassemble_info *info) } } - infprintf (is, "0x%x", insn); + if (length == 2) + infprintf (is, ".short\t0x%x", insn); + else + infprintf (is, ".word\t0x%x", insn); info->insn_type = dis_noninsn; return length; |