public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: Add non-enum disassembler options
@ 2022-09-06 8:28 Tsukasa OI
0 siblings, 0 replies; only message in thread
From: Tsukasa OI @ 2022-09-06 8:28 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f2028892699ded3276246ddec602d6b9f3e7295d
commit f2028892699ded3276246ddec602d6b9f3e7295d
Author: Tsukasa OI <research_trasio@irq.a4lg.com>
Date: Tue Aug 30 12:21:13 2022 +0000
gdb: Add non-enum disassembler options
This is paired with "opcodes: Add non-enum disassembler options".
There is a portable mechanism for disassembler options and used on some
architectures:
- ARC
- Arm
- MIPS
- PowerPC
- RISC-V
- S/390
However, it only supports following forms:
- [NAME]
- [NAME]=[ENUM_VALUE]
Valid values for [ENUM_VALUE] must be predefined in
disasm_option_arg_t.values. For instance, for -M cpu=[CPU] in ARC
architecture, opcodes/arc-dis.c builds valid CPU model list from
include/elf/arc-cpu.def.
In this commit, it adds following format:
- [NAME]=[ARBITRARY_VALUE] (cannot contain "," though)
This is identified by NULL value of disasm_option_arg_t.values
(normally, this is a non-NULL pointer to a NULL-terminated list).
gdb/ChangeLog:
* gdb/disasm.c (set_disassembler_options): Add support for
non-enum disassembler options.
(show_disassembler_options_sfunc): Likewise.
Diff:
---
gdb/disasm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gdb/disasm.c b/gdb/disasm.c
index db6724757ac..fe4eed2d524 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -1270,6 +1270,8 @@ set_disassembler_options (const char *prospective_options)
if (memcmp (opt, valid_options->name[i], len) != 0)
continue;
arg = opt + len;
+ if (valid_options->arg[i]->values == NULL)
+ break;
for (j = 0; valid_options->arg[i]->values[j] != NULL; j++)
if (disassembler_options_cmp
(arg, valid_options->arg[i]->values[j]) == 0)
@@ -1391,6 +1393,8 @@ The following disassembler options are supported for use with the\n\
for (i = 0; valid_args[i].name != NULL; i++)
{
+ if (valid_args[i].values == NULL)
+ continue;
gdb_printf (file, _("\n\
For the options above, the following values are supported for \"%s\":\n "),
valid_args[i].name);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-09-06 8:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-06 8:28 [binutils-gdb] gdb: Add non-enum disassembler options Tsukasa OI
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).