public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 0/9] Disassembler opcode display and text alignment
Date: Thu, 23 Jun 2022 17:05:07 +0100	[thread overview]
Message-ID: <cover.1655999715.git.aburgess@redhat.com> (raw)

This series makes two related changes to GDB's disassembler.  Both
changes flow naturally from having GDB make use of libopcodes
bytes_per_line and bytes_per_chunk presentation hints that are set on
a per-architecure basis with each call into the disassembler.

The end result of this change is that GDB will now display instruction
opcodes in the same way that objdump does.

For x86-64 there's no change in the way that opcode bytes are
presented.  Now due to some special case, it's just that how GDB lays
out instruction opcodes just happens to match how libopcodes requests
that the opcodes be laid out.

For other architectures, risc-v, powerpc, arm, aarch64, etc, this is
not the case, and I (personally) think objdump does a better job of
presenting the information that GDB does; the instruction opcodes will
be grouped together based on the instruction size, and potentially
byte-swapped so they appear in the instruction's natural order.

Making use of the display hints also allows for better alignment of
the disassembly text when opcodes are being printed.

I have proposed that this new behaviour become the default for
'disassemble /r', and I've added a new flag 'disassemble /b' which
allows the user to access the old behaviour.

But, if people feel strongly that the old 'disassemble /r' should not
be changed, I can place the new behaviour under a new flag.

Let me know your thoughts,

Thanks,
Andrew

---

Andrew Burgess (9):
  gdb/doc: improve description of --data-disassemble opcodes output
  gdb/testsuite: new test for -data-disassemble opcodes format
  gdb/disasm: read opcodes bytes with a single read_code call
  gdb: disassembler opcode display formatting
  gdb: make gdb_disassembly_flag unsigned
  gdb/doc: fix column widths in MI compatibility table
  gdb/doc: update syntax of -data-disassemble command arguments
  gdb/mi: some int to bool conversion
  gdb/mi: new options for -data-disassemble command

 gdb/NEWS                                |  12 ++
 gdb/cli/cli-cmds.c                      |   6 +
 gdb/disasm-flags.h                      |   3 +-
 gdb/disasm.c                            |  55 +++++++--
 gdb/disasm.h                            |   3 +
 gdb/doc/gdb.texinfo                     | 137 ++++++++++++++++-----
 gdb/mi/mi-cmd-disas.c                   | 105 ++++++++++++----
 gdb/record.c                            |   3 +
 gdb/testsuite/gdb.mi/mi-disassemble.exp | 153 ++++++++++++++++++++----
 gdb/testsuite/lib/mi-support.exp        |  27 +++++
 10 files changed, 417 insertions(+), 87 deletions(-)

-- 
2.25.4


             reply	other threads:[~2022-06-23 16:05 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 16:05 Andrew Burgess [this message]
2022-06-23 16:05 ` [PATCH 1/9] gdb/doc: improve description of --data-disassemble opcodes output Andrew Burgess
2022-06-23 16:09   ` Eli Zaretskii
2022-06-29 12:54     ` Andrew Burgess
2022-06-23 16:05 ` [PATCH 2/9] gdb/testsuite: new test for -data-disassemble opcodes format Andrew Burgess
2022-06-23 16:05 ` [PATCH 3/9] gdb/disasm: read opcodes bytes with a single read_code call Andrew Burgess
2022-06-23 16:05 ` [PATCH 4/9] gdb: disassembler opcode display formatting Andrew Burgess
2022-06-23 16:14   ` Eli Zaretskii
2022-06-23 16:05 ` [PATCH 5/9] gdb: make gdb_disassembly_flag unsigned Andrew Burgess
2022-06-23 16:05 ` [PATCH 6/9] gdb/doc: fix column widths in MI compatibility table Andrew Burgess
2022-06-23 16:22   ` Eli Zaretskii
2022-06-30  9:39     ` Andrew Burgess
2022-06-23 16:05 ` [PATCH 7/9] gdb/doc: update syntax of -data-disassemble command arguments Andrew Burgess
2022-06-23 16:21   ` Eli Zaretskii
2022-06-30 10:18     ` Andrew Burgess
2022-06-30 10:46       ` Eli Zaretskii
2022-06-23 16:05 ` [PATCH 8/9] gdb/mi: some int to bool conversion Andrew Burgess
2022-06-23 16:05 ` [PATCH 9/9] gdb/mi: new options for -data-disassemble command Andrew Burgess
2022-06-23 16:34   ` Eli Zaretskii
2022-06-30 11:22     ` Andrew Burgess
2022-06-30 13:36       ` Eli Zaretskii
2022-07-25 18:28 ` [PATCH 0/9] Disassembler opcode display and text alignment Andrew Burgess
2022-09-05 14:11   ` Andrew Burgess
2022-09-21 16:41 ` Tom Tromey
2022-10-02 13:15   ` Andrew Burgess

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.1655999715.git.aburgess@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@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).