Re: [PATCH] Allow user-defined as a category for python gdb macros (resend)

Doug Evans
2012-02-14T03:12:53Z

On Mon, Feb 13, 2012 at 4:48 PM, Scott Goldman <scottjg@vmware.com> wrote:
> --- a/gdb/top.c
> +++ b/gdb/top.c
> @@ -470,7 +470,7 @@ execute_command (char *p, int from_tty)
>       if (c->flags & DEPRECATED_WARN_USER)
>        deprecated_cmd_warning (&line);
>
> -      if (c->class == class_user)
> +      if (c->class == class_user && c->user_commands)
>        execute_user_command (c, arg);
>       else if (c->type == set_cmd || c->type == show_cmd)
>        do_setshow_command (arg, from_tty, c);

This change is a bit obscure.
At the very least, I think this requires a proper comment explaining
why one needs to test c->user_commands.

Also, this patch feels like it's incomplete.
If I can see "user" python "macros" [sic] then happens if I do "show
user foo"? (a user may reasonably ask)
And given that that won't work, we'll have to explain(document) why.
Plus one now needs to explain that "document" and
"max-user-call-depth" don't apply to these commands (it may seem
obvious, but they show up in "apropos user-defined", and thus to not
document these things means the patch is incomplete).

I wonder if any more unforeseen changes will be needed.