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

Pedro Alves
2014-09-05T13:12:27Z

On 09/04/2014 08:26 PM, Gabriel Krisman Bertazi wrote:
> Pedro Alves <palves@redhat.com> writes:
>
>> Yeah. Close now. Only nits on the details.
>
> Guess I fixed all the things you pointed out.

Excellent!

>
>> cli_user_command_p (struct cmd_list_element *cmd)
>
> I implemented that as well. Thanks.
>
> Updated patch below. :)

Thanks!

Ideally you'd send a 'git am'able patch, with commit log
in place too. That is, treat the commit log as just
another part of the patch that gets updated/resent.

>
> gdb/
> 2014-08-20 Gabriel Krisman Bertazi <gabriel@krisman.be>
>
> * cli/cli-cmds.c (show_user): Use cli_user_command_p to
> decide whether we display the command on "show user".

Note that the "decide" should be indented with a tab only, under
the '*'.

> * cli/cli-script.c (show_user_1): Only verify cmdlines after
> printing command name.
> * cli/cli-decode.h (cli_user_command_p): Declare new function.
> * cli/cli-decode.c (cli_user_command_p): Create helper function
> to verify whether cmd_list_element is a user-defined command.
>
> gdb/testsuite/
> 2014-08-20 Gabriel Krisman Bertazi <gabriel@krisman.be>
>
> * gdb.base/commands.exp: Add tests to verify user-defined
> commands with empty bodies.
> * gdb.python/py-cmd.exp: Test that we don't show user-defined
> python commands in `show user command`.
> * gdb.python/scm-cmd.exp: Test that we don't show user-defined
> scheme commands in `show user command`.

Likewise everywhere else.

> extern const char * const auto_boolean_enums[];
>
> +/* Verify whether a given cmd_list_element is a user-defined command.
> + Return 1 if it is user-defined. Return 0 otherwise. */
> +
> +int cli_user_command_p (struct cmd_list_element *);

Note that every other declaration in the header uses explicit
"extern". Please add that for consistency. OK with these
little nits fixed. Please push.

Thanks!

Pedro Alves