[PATCH] Add a way to preserve overridden GDB commands for later invocation

Eli Zaretskii eliz@gnu.org
Mon Oct 28 17:36:00 GMT 2019


> From: Marco Barisione <mbarisione@undo.io>
> Date: Mon, 28 Oct 2019 13:32:34 +0000
> 
> diff --git a/gdb/NEWS b/gdb/NEWS
> index 25e67e43c8..e0f1f0a9c1 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -71,6 +71,14 @@
>    ** gdb.Block now supports the dictionary syntax for accessing symbols in
>       this block (e.g. block['local_variable']).
>  
> +  ** gdb.Command has a new method 'invoke_overridden' to invoke the
> +     command with the same name, if any, which was overridden by the new
> +     command.  gdb.Command.__init__ has a new 'preserve_when_overridden'
> +     argument which, if true (the default is false), means that the
> +     command, once overridden by another command of the same name, can
> +     still be invoked through the new command's 'invoke_overridden'
> +     method.

This part is OK.

> +@var{preserve_when_overridden} is an optional argument.  If @code{True},
> +then the new command is not deleted when it's overridden by another
> +command with the same name, otherwise it's deleted.  When a command is
> +preserved, the overriding command can still invoke it through its
> +@code{invoke_overridden} method.

When you describe a complex new notion, it is important to use the
same words consistently when referring to the same things.  In this
case, you first used "not deleted", and later referred to the same
thing as "preserved".  Not every reader will correctly conclude that
these two mean the same.  So, to avoid confusion, use just one of the
two in both instances, okay?

> +@defun Command.invoke_overridden (argument, from_tty)
> +If the command overrode another command of the same name,
                  ^^^^^^^^
"overrides" is better, I think.

> +                                                          this can be
> +invoked through this method as long as the overridden command supports this
> +feature.

What did you mean by "this" here?  It's unclear.

> +@item
> +All commands defined by @value{GDBN} itself support being invoked when
   ^^^^^^^^^^^^
"All the commands"

Thanks.



More information about the Gdb-patches mailing list