aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorTsukasa OI <research_trasio@irq.a4lg.com>2022-08-30 12:20:30 +0000
committerTsukasa OI <research_trasio@irq.a4lg.com>2022-09-06 02:23:21 +0000
commit9869e2e5c7964039328013a283461d1826dbf96c (patch)
tree7af4afced2735841646fa1fe52a05f23e998b7ad /opcodes
parenta49fdb49c8d6bb2a2c2d200ea9e83ae688e67e22 (diff)
downloadfsf-binutils-gdb-9869e2e5c7964039328013a283461d1826dbf96c.zip
fsf-binutils-gdb-9869e2e5c7964039328013a283461d1826dbf96c.tar.gz
fsf-binutils-gdb-9869e2e5c7964039328013a283461d1826dbf96c.tar.bz2
opcodes: Add non-enum disassembler options
This is paired with "gdb: 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). include/ChangeLog: * dis-asm.h (disasm_option_arg_t): Update comment of values to allow non-enum disassembler options. opcodes/ChangeLog: * riscv-dis.c (print_riscv_disassembler_options): Support non-enum disassembler options on printing disassembler help. * arc-dis.c (print_arc_disassembler_options): Likewise. * mips-dis.c (print_mips_disassembler_options): Likewise.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/arc-dis.c2
-rw-r--r--opcodes/mips-dis.c2
-rw-r--r--opcodes/riscv-dis.c2
3 files changed, 6 insertions, 0 deletions
diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c
index 3490bad..c8dc525 100644
--- a/opcodes/arc-dis.c
+++ b/opcodes/arc-dis.c
@@ -1611,6 +1611,8 @@ print_arc_disassembler_options (FILE *stream)
for (i = 0; args[i].name != NULL; ++i)
{
size_t len = 3;
+ if (args[i].values == NULL)
+ continue;
fprintf (stream, _("\n\
For the options above, the following values are supported for \"%s\":\n "),
args[i].name);
diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
index 9db604f..faeebcc 100644
--- a/opcodes/mips-dis.c
+++ b/opcodes/mips-dis.c
@@ -2809,6 +2809,8 @@ with the -M switch (multiple options should be separated by commas):\n\n"));
for (i = 0; args[i].name != NULL; i++)
{
+ if (args[i].values == NULL)
+ continue;
fprintf (stream, _("\n\
For the options above, the following values are supported for \"%s\":\n "),
args[i].name);
diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c
index 160cc40..7ae6e70 100644
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -1195,6 +1195,8 @@ with the -M switch (multiple options should be separated by commas):\n"));
for (i = 0; args[i].name != NULL; i++)
{
+ if (args[i].values == NULL)
+ continue;
fprintf (stream, _("\n\
For the options above, the following values are supported for \"%s\":\n "),
args[i].name);