aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-10-20 11:15:51 +0100
committerAndrew Burgess <aburgess@redhat.com>2023-11-08 11:18:39 +0000
commitf3a8a979bbed4f9462761638a57136fcb38bad68 (patch)
tree3ad7c23e271ae003959e6735827ed6af5f561c99 /gdb/cli
parent80968745ee9fd6b48996e35adaf998d1ccf35642 (diff)
downloadbinutils-f3a8a979bbed4f9462761638a57136fcb38bad68.zip
binutils-f3a8a979bbed4f9462761638a57136fcb38bad68.tar.gz
binutils-f3a8a979bbed4f9462761638a57136fcb38bad68.tar.bz2
gdb: error if /r and /b are used with disassemble command
The disassembler gained a new /b flag in this commit: commit d4ce49b7ac077a9882d6a5e689e260300045ca88 Date: Tue Jun 21 20:23:35 2022 +0100 gdb: disassembler opcode display formatting The /b and /r flags result in the instruction opcodes displayed in different formats, so it's not possible to have both at the same time. Currently the /b flag overrides the /r flag. We have a similar situation with the /m and /s flags, but here, if the user tries to use both flags then they will get an error. I think the error is clearer, so in this commit I propose that we add an error if /r and /b are both used. Obviously this change breaks backwards compatibility. I don't have a compelling argument for why we should make the change beyond my feeling that it was a mistake not to add this error from the start, and that the new behaviour is better. Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-cmds.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 8cadd63..9098958 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1644,6 +1644,10 @@ disassemble_command (const char *arg, int from_tty)
== (DISASSEMBLY_SOURCE_DEPRECATED | DISASSEMBLY_SOURCE))
error (_("Cannot specify both /m and /s."));
+ if ((flags & (DISASSEMBLY_RAW_INSN | DISASSEMBLY_RAW_BYTES))
+ == (DISASSEMBLY_RAW_INSN | DISASSEMBLY_RAW_BYTES))
+ error (_("Cannot specify both /r and /b."));
+
if (! p || ! *p)
{
flags |= DISASSEMBLY_OMIT_FNAME;