[PATCH] Fix PR gdb/17035: "show user" doesn't list user-defined commands that have empty bodies.

Sergio Durigan Junior sergiodj@redhat.com
Thu Sep 4 19:57:00 GMT 2014


On Thursday, September 04 2014, Gabriel Krisman Bertazi wrote:

> diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
> index c409d9c..914a8e3 100644
> --- a/gdb/cli/cli-decode.c
> +++ b/gdb/cli/cli-decode.c
> @@ -1884,3 +1884,10 @@ cmd_func (struct cmd_list_element *cmd, char *args, int from_tty)
>    else
>      error (_("Invalid command"));
>  }
> +
> +int
> +cli_user_command_p (struct cmd_list_element *cmd)
> +{
> +  return (cmd->class == class_user
> +	  && (cmd->func == do_cfunc || cmd->func == do_sfunc));
> +}

Thanks for the patch.

You correctly commented the function prototype on cli/cli-decode.h, but
it is also a good practice to put a comment in the function definition
as well, like:

  /* See declaration on cli/cli-decode.h.  */
  int
  cli_user_command_p (struct cmd_list_element *cmd)
  ...

Other than that, looks OK.

Cheers,

-- 
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/



More information about the Gdb-patches mailing list