public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Tsukasa OI <research_trasio@irq.a4lg.com>,
	Tsukasa OI <research_trasio@irq.a4lg.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Claudiu Zissulescu <claziss@synopsys.com>,
	Chenghua Xu <paul.hua.gm@gmail.com>,
	Nelson Chu <nelson@rivosinc.com>
Cc: binutils@sourceware.org, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] gdb: Add non-enum disassembler options
Date: Fri, 02 Sep 2022 11:00:02 +0100	[thread overview]
Message-ID: <87ilm6cd0d.fsf@redhat.com> (raw)
In-Reply-To: <b8fbaf03878716762e7c3b0d530a7a9a5307e96d.1661912099.git.research_trasio@irq.a4lg.com>

Tsukasa OI <research_trasio@irq.a4lg.com> writes:

> 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.
> ---
>  gdb/disasm.c | 4 ++++
>  1 file changed, 4 insertions(+)

The GDB parts are OK.

Thanks,
Andrew

>
> 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);
> -- 
> 2.34.1


  reply	other threads:[~2022-09-02 10:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31  2:15 [PATCH 0/2] gdb, opcodes: " Tsukasa OI
2022-08-31  2:15 ` [PATCH 1/2] " Tsukasa OI
2022-09-01 12:03   ` Nick Clifton
2022-08-31  2:15 ` [PATCH 2/2] gdb: " Tsukasa OI
2022-09-02 10:00   ` Andrew Burgess [this message]
2022-09-04  8:03 ` [PATCH v2 0/2] gdb, opcodes: " Tsukasa OI
2022-09-04  8:03   ` [PATCH v2 1/2] " Tsukasa OI
2022-09-06  2:36     ` Tsukasa OI
2022-09-06  8:31       ` Tsukasa OI
2022-09-04  8:03   ` [PATCH v2 2/2] gdb: " Tsukasa OI

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=87ilm6cd0d.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=claziss@synopsys.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nelson@rivosinc.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.hua.gm@gmail.com \
    --cc=research_trasio@irq.a4lg.com \
    /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).