Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Guinevere Larsen <guinevere@redhat.com>, gdb-patches@sourceware.org
Cc: Guinevere Larsen <guinevere@redhat.com>
Subject: Re: [PATCH v2 1/2] gdb: improve help text for set commands with limited options
Date: Mon, 12 Jan 2026 15:35:29 +0000	[thread overview]
Message-ID: <875x96vo72.fsf@redhat.com> (raw)
In-Reply-To: <20260109115621.26003-2-guinevere@redhat.com>

Guinevere Larsen <guinevere@redhat.com> writes:

> Some "set" commands only allow a select few options, such as the "set
> architecture" command, however, there is no way for a user to know which
> options are allowed without trying to set something and getting an
> error. This commit improves the situation by making the help command list
> all the available options.
> ---
>  gdb/cli/cli-decode.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
> index 04935575b67..06313ba6c49 100644
> --- a/gdb/cli/cli-decode.c
> +++ b/gdb/cli/cli-decode.c
> @@ -1884,6 +1884,16 @@ help_cmd (const char *command, struct ui_file *stream)
>        /* Be sure to expand TABs in the documentation.  */
>        tab_expansion_file expander (stream);
>        gdb_puts (c->doc, &expander);
> +      if (c->enums != nullptr)
> +	{
> +	  gdb_puts ("Available options are:\n", &expander);
> +	  const char * const *opt = c->enums;
> +	  while (opt != nullptr)
> +	    {
> +	      gdb_printf (&expander, "%s\n", *opt);

Have you tried this on a build of GDB with all-targets enabled?  I
suspect this is going to result in rather a long list.  It might be
better if the options were printed as a comma separated list maybe?

Thanks,
Andrew


> +	      opt ++;
> +	    }
> +	}
>      }
>    else
>      {
> -- 
> 2.52.0


  reply	other threads:[~2026-01-12 15:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09 11:56 [PATCH v2 0/2] Add warning if the native target is not supported Guinevere Larsen
2026-01-09 11:56 ` [PATCH v2 1/2] gdb: improve help text for set commands with limited options Guinevere Larsen
2026-01-12 15:35   ` Andrew Burgess [this message]
2026-01-09 11:56 ` [PATCH v2 2/2] gdb: add warning when no native target is available Guinevere Larsen
2026-01-09 12:36   ` Ciaran Woodward
2026-01-09 13:40     ` Guinevere Larsen
2026-01-09 14:16       ` Ciaran Woodward
2026-01-09 14:26         ` Guinevere Larsen
2026-01-09 16:53           ` Ciaran Woodward
2026-01-12 15:33           ` Andrew Burgess
2026-01-13 18:23             ` Guinevere Larsen

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=875x96vo72.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=guinevere@redhat.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