[PATCH 1/3] Expand "show disassembler-options" output

Simon Marchi simark@simark.ca
Sun Sep 16 03:12:00 GMT 2018


On 2018-09-14 10:55 p.m., Tom Tromey wrote:
> I typed this:
> 
>     (gdb) help set disassembler-options
>     Set the disassembler options.
>     Usage: set disassembler-options OPTION [,OPTION]...
> 
>     See: 'show disassembler-options' for valid option values.
> 
> ... so I tried what it said and got:
> 
>     (gdb) show disassembler-options
>     The current disassembler options are ''
> 
> This surprised me a little, so this patch adds some text to explain
> the situation when an architecture does not have disassembler options.
> 
> While there I noticed one more spot where gdb was not using the GNU
> style for metasyntactic variables.  This patch fixes this as well.
> 
> gdb/ChangeLog
> 2018-09-14  Tom Tromey  <tom@tromey.com>
> 
> 	* disasm.c (show_disassembler_options_sfunc): Use GNU style for
> 	metasyntactic variables.  Print message if no disassembler options
> 	are available.
> ---
>  gdb/ChangeLog | 6 ++++++
>  gdb/disasm.c  | 9 +++++++--
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/disasm.c b/gdb/disasm.c
> index 11793df67c0..d908af3fb43 100644
> --- a/gdb/disasm.c
> +++ b/gdb/disasm.c
> @@ -1014,13 +1014,18 @@ show_disassembler_options_sfunc (struct ui_file *file, int from_tty,
>    valid_options_and_args = gdbarch_valid_disassembler_options (gdbarch);
>  
>    if (valid_options_and_args == NULL)
> -    return;
> +    {
> +      fputs_filtered (_("(There are no disassembler options available "
> +			"for this architecture.)\n"),
> +		      file);
> +      return;
> +    }

It's probably a matter of taste, but I would use the same format as the message
shown when there are options available: no parenthesis and an empty line before.

Otherwise, this LGTM.

Simon



More information about the Gdb-patches mailing list