diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-02-05 11:25:14 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2022-04-04 13:10:52 +0100 |
commit | fbbb45cef5f740d0e273b0f5fe4d19a093c2bf8f (patch) | |
tree | 33ffeec8caa2d91de6ca91bcdb8df571ec9d5bbf /opcodes/disassemble.c | |
parent | 49d31dc98e3f4bb15553bab9d903c542287446d4 (diff) | |
download | fsf-binutils-gdb-fbbb45cef5f740d0e273b0f5fe4d19a093c2bf8f.zip fsf-binutils-gdb-fbbb45cef5f740d0e273b0f5fe4d19a093c2bf8f.tar.gz fsf-binutils-gdb-fbbb45cef5f740d0e273b0f5fe4d19a093c2bf8f.tar.bz2 |
opcodes/i386: partially implement disassembler style support
This commit adds partial support for disassembler styling in the i386
disassembler.
The i386 disassembler collects the instruction arguments into an array
of strings, and then loops over the array printing the arguments out
later on. The problem is that by the time we print the arguments out
it's not obvious what the type of each argument is.
Obviously this can be fixed, but I'd like to not do that as part of
this commit, rather, I'd prefer to keep this commit as small as
possible to get the basic infrastructure in place, then we can improve
on this, to add additional styling, in later commits.
For now then, I think this commit should correctly style mnemonics,
some immediates, and comments. Everything else will be printed as
plain text, which will include most instruction arguments, unless the
argument is printed as a symbol, by calling the print_address_func
callback.
Ignoring colours, there should be no other user visible changes in the
output of the disassembler in either objdump or gdb.
opcodes/ChangeLog:
* disassembler.c (disassemble_init_for_target): Set
created_styled_output for i386 based targets.
* i386-dis.c: Changed throughout to use fprintf_styled_func
instead of fprintf_func.
Diffstat (limited to 'opcodes/disassemble.c')
-rw-r--r-- | opcodes/disassemble.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c index 894c97a..bd1b90b 100644 --- a/opcodes/disassemble.c +++ b/opcodes/disassemble.c @@ -630,7 +630,12 @@ disassemble_init_for_target (struct disassemble_info * info) info->disassembler_needs_relocs = true; break; #endif - +#ifdef ARCH_i386 + case bfd_arch_i386: + case bfd_arch_iamcu: + info->created_styled_output = true; + break; +#endif #ifdef ARCH_ia64 case bfd_arch_ia64: info->skip_zeroes = 16; |