[PATCH 0/9] Disassembler opcode display and text alignment
Andrew Burgess
aburgess@redhat.com
Thu Jun 23 16:05:07 GMT 2022
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
More information about the Gdb-patches
mailing list