Re: [PATCH 15/24] Introduce rename_cmd

Philippe Waroquiers
2019-05-25T19:58:48Z

On Wed, 2019-05-22 at 21:53 +0100, Pedro Alves wrote:

> diff --git a/gdb/command.h b/gdb/command.h
> index 35006cc339e..ed848114b85 100644
> --- a/gdb/command.h
> +++ b/gdb/command.h
> @@ -439,6 +439,11 @@ extern void
> struct cmd_list_element **set_list,
> struct cmd_list_element **show_list);
>
> +/* Move command OLD_NAME from OLD_LIST to NEW_LIST and rename it from
> + OLD_NAME to NEW_NAME. */
> +extern void rename_cmd (const char *old_name, cmd_list_element **old_list,
> + const char *new_name, cmd_list_element **new_list);
> +
I have some difficulties to understand the idea here.
If the command is moved from one list to another, how is the renamed
command still available via the 'normal' list ?

Effectively, it looks like set/show print raw-frame-arguments commands
are not known.

Why not just keep the old command untouched, and define a new
command via the new framework.

Below is just a patch (based on HEAD) that defines 2 different set/show
changing the same variable:
(gdb) apropos raw form
set print raw frame-arguments -- Set whether to print frame arguments in raw form
set print raw-frame-arguments -- Set whether to print frame arguments in raw form
show print raw frame-arguments -- Show whether to print frame arguments in raw form
show print raw-frame-arguments -- Show whether to print frame arguments in raw form
(gdb) set print raw frame-arguments on
(gdb) show print raw frame-argumentsÂ
Whether to print frame arguments in raw form is on.
(gdb) show print raw-frame-argumentsÂ
Whether to print frame arguments in raw form is on.
(gdb) set print raw-frame-arguments off
(gdb) show print raw frame-arguments
Whether to print frame arguments in raw form is off.
(gdb) show print raw-frame-argumentsÂ
Whether to print frame arguments in raw form is off.
(gdb)Â

I guess this should still work if the same variable is changed via
the new framework and/or via add_setshow_boolean_cmd.
The old commands might be marked as obsolete.

Philippe

diff --git a/gdb/stack.c b/gdb/stack.c
index 408c795e38..05b11e6ecb 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -3106,6 +3106,16 @@ Usage: func NAME"));
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â _("Show printing of non-scalar frame arguments"),
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â NULL, NULL, NULL, &setprintlist, &showprintlist);
Â
+
+Â Â add_setshow_boolean_cmd ("raw-frame-arguments", no_class,
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &print_raw_frame_arguments, _("\
+Set whether to print frame arguments in raw form."), _("\
+Show whether to print frame arguments in raw form."), _("\
+If set, frame arguments are printed in raw form, bypassing any\n\
+pretty-printers for that value."),
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â NULL, NULL,
+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &setprintlist, &showprintlist);
+
Â Â Â add_setshow_boolean_cmd ("frame-arguments", no_class,
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &print_raw_frame_arguments, _("\
Â Set whether to print frame arguments in raw form."), _("\