[PATCH 3/5] gdb/python: allow redefinition of python GDB/MI commands

Lancelot SIX lsix@lancelotsix.com
Sun Feb 6 17:13:55 GMT 2022


Hi,

> @@ -163,6 +164,9 @@ struct mi_command
>       wrong.  */
>    void invoke (struct mi_parse *parse) const;
>  
> +  /* Return TRUE if the command can be redefined, FALSE otherwise.  */
> +  virtual bool can_be_redefined ();

It looks like that this method can be made const I think.

I also did ont pay too close attention in the previous patch, but it
looks like you use space indentation.  I think GNU standard[1] and GDB
codebase uses tab indentation (tab size of 8):

    The rest of this section gives our recommendations for other aspects of
    C formatting style, which is also the default style of the indent
    program in version 1.2 and newer. It corresponds to the options

    -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2
    -ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob

This way to tell things is not super informative in itself.  Depending
on the text editor you use, there might be a configuration option to
help you automate this.

I will not point it out in every place in the patch, but there are
multiple instances where your changes lead to a indentation change (i.e.
replace 1 tab with 8 spaces).  This should be avoided.

> --- a/gdb/python/py-micmd.c
> +++ b/gdb/python/py-micmd.c
> @@ -1,6 +1,6 @@
>  /* MI Command Set for GDB, the GNU debugger.
>  
> -   Copyright (C) 2019 Free Software Foundation, Inc.
> +   Copyright (C) 2019-2021 Free Software Foundation, Inc.

2021 will most probably need to become 2022 (and same goes for other new
files as well).


>  class mi_command_py : public mi_command
>  {
> -  public:
> -    /* Constructs a new mi_command_py object.  NAME is command name without
> -       leading dash.  OBJECT is a reference to a Python object implementing
> -       the command.  This object should inherit from gdb.MICommand and should
> -       implement method invoke (args). */
> -    mi_command_py (const char *name, gdbpy_ref<> object);
> +public:
> +  /* Constructs a new mi_command_py object.  NAME is command name without
> +     leading dash.  OBJECT is a reference to a Python object implementing
> +     the command.  This object should inherit from gdb.MICommand and should
> +     implement method invoke (args).  */
> +  mi_command_py (const char *name, gdbpy_ref<> object);

Here you change the indentation from the previous patch.  This change
should probably be moved to it.

I understand that this is tedious to change and am sorry for that.

Best,
Lancelot.

[1] https://www.gnu.org/prep/standards/html_node/Formatting.html


More information about the Gdb-patches mailing list