public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: binutils@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCHv2 0/3] disassembler syntax highlighting in objdump (via libopcodes)
Date: Mon, 21 Mar 2022 14:33:49 +0000	[thread overview]
Message-ID: <cover.1647873051.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1645043588.git.aburgess@redhat.com>

This series is a serious attempt at what I discussed here:

  https://sourceware.org/pipermail/binutils/2021-December/118806.html

This series changes libopcodes so that this disassemblers can supply
styling information with every piece of disassembly output, e.g. is
this a register?  an address?  a mnemonic?  etc.

Users of the disassembler can then choose to make use of this
information to add styling to the disassembler output.

And that is what I do for objdump in this series.  The styling is off
by default, but can be turned on with a new command line flag:
    --disassembler-color=off|color|extended-color

I've updated GDB enough to keep it building and running after this
change, though at this point GDB doesn't make use of the new styling
information, that will come later.

All feedback would be welcome.

Changes since v1:

  - After discussion with Jan I've now added additional disassembler
    styles (see enum disassembler_style in includes/dis-asm.h),

  - I've updated the riscv-dis.c and i386-dis.c to make use of these
    new styles, and fixed a few places (mostly in riscv-dis.c) where
    the wrong style was being used,

  - I've gone through my changes in riscv-dis.c and i386-dis.c and
    made sure that lines are all under 80 characters,

  - I've extended binutils/objdump.c to handle the new styles.  For
    now I've not given these styles separate colours, but used
    existing grouping similar styles together, e.g. anything that is a
    number (immediate, address, address offset) all gets the same
    colour.

  - The crash that Nelson reported from riscv-dis.c is fixed.

Andrew Burgess (3):
  objdump/opcodes: add syntax highlighting to disassembler output
  opcodes/riscv: implement style support in the disassembler
  opcodes/i386: partially implement disassembler style support

 binutils/NEWS              |   4 +
 binutils/doc/binutils.texi |  11 ++
 binutils/objdump.c         | 249 ++++++++++++++++++++++++++++++++-----
 gdb/disasm.c               |  34 ++++-
 gdb/disasm.h               |   7 ++
 include/dis-asm.h          |  88 ++++++++++++-
 opcodes/dis-init.c         |   5 +-
 opcodes/disassemble.c      |  23 +++-
 opcodes/i386-dis.c         |  63 ++++++----
 opcodes/riscv-dis.c        | 193 +++++++++++++++++-----------
 10 files changed, 541 insertions(+), 136 deletions(-)

-- 
2.25.4


  parent reply	other threads:[~2022-03-21 14:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 20:53 [PATCH " Andrew Burgess
2022-02-16 20:53 ` [PATCH 1/3] objdump/opcodes: add syntax highlighting to disassembler output Andrew Burgess
2022-02-28 15:54   ` Tom Tromey
2022-02-16 20:53 ` [PATCH 2/3] opcodes/riscv: implement style support in the disassembler Andrew Burgess
2022-02-19 10:24   ` Andrew Burgess
2022-02-16 20:53 ` [PATCH 3/3] opcodes/i386: partially implement disassembler style support Andrew Burgess
2022-02-17  9:35   ` Jan Beulich
2022-02-17 16:15     ` Andrew Burgess
2022-02-17 16:29       ` Jan Beulich
2022-02-17 22:37         ` Andrew Burgess
2022-02-18  7:14           ` Jan Beulich
2022-02-19 10:54             ` Andrew Burgess
2022-02-21 13:08               ` Jan Beulich
2022-02-21 18:01                 ` Andrew Burgess
2022-02-17  3:57 ` [PATCH 0/3] disassembler syntax highlighting in objdump (via libopcodes) Nelson Chu
2022-02-17 16:17   ` Andrew Burgess
2022-03-21 14:33 ` Andrew Burgess [this message]
2022-03-21 14:33   ` [PATCHv2 1/3] objdump/opcodes: add syntax highlighting to disassembler output Andrew Burgess
2022-03-21 14:33   ` [PATCHv2 2/3] opcodes/riscv: implement style support in the disassembler Andrew Burgess
2022-03-21 14:33   ` [PATCHv2 3/3] opcodes/i386: partially implement disassembler style support Andrew Burgess
2022-03-24 17:08   ` [PATCHv2 0/3] disassembler syntax highlighting in objdump (via libopcodes) Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1647873051.git.aburgess@redhat.com \
    --to=aburgess@redhat.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).