This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix PR gdb/17035: "show user" doesn't list user-defined commands that have empty bodies.
- From: Sergio Durigan Junior <sergiodj at redhat dot com>
- To: Gabriel Krisman Bertazi <gabriel at krisman dot be>
- Cc: Pedro Alves <palves at redhat dot com>, gdb-patches at sourceware dot org
- Date: Thu, 04 Sep 2014 15:57:41 -0400
- Subject: Re: [PATCH] Fix PR gdb/17035: "show user" doesn't list user-defined commands that have empty bodies.
- Authentication-results: sourceware.org; auth=none
- References: <1408515134-31165-1-git-send-email-gabriel at krisman dot be> <53F615D8 dot 5000901 at redhat dot com> <878umgaqjk dot fsf at krisman dot be> <53FDC751 dot 3000902 at redhat dot com> <87sikc1p8z dot fsf at anubis dot Home> <5405BD6E dot 9080000 at redhat dot com> <87a96frxu5 dot fsf at anubis dot Home>
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/