gdb: add add_setshow_prefix_cmd

There's a common pattern to call add_basic_prefix_cmd and
add_show_prefix_cmd to add matching set and show commands.  Add the
add_setshow_prefix_cmd function to factor that out and use it at a few
places.

Change-Id: I6e9e90a30e9efb7b255bf839cac27b85d7069cfd
This commit is contained in:
Simon Marchi 2021-09-22 13:43:25 -04:00 committed by Simon Marchi
parent 5ad2694b1e
commit f54bdb6d27
34 changed files with 276 additions and 325 deletions

View file

@ -2394,12 +2394,11 @@ Show verbosity."), NULL,
show_info_verbose,
&setlist, &showlist);
add_basic_prefix_cmd ("history", class_support, _("\
Generic command for setting command history parameters."),
&sethistlist, 0, &setlist);
add_show_prefix_cmd ("history", class_support, _("\
Generic command for showing command history parameters."),
&showhistlist, 0, &showlist);
add_setshow_prefix_cmd
("history", class_support,
_("Generic command for setting command history parameters."),
_("Generic command for showing command history parameters."),
&sethistlist, &showhistlist, &setlist, &showlist);
add_setshow_boolean_cmd ("expansion", no_class, &history_expansion_p, _("\
Set history expansion on command input."), _("\
@ -2493,13 +2492,11 @@ the previous command number shown."),
add_cmd ("configuration", no_set_class, show_configuration,
_("Show how GDB was configured at build time."), &showlist);
add_basic_prefix_cmd ("debug", no_class,
_("Generic command for setting gdb debugging flags."),
&setdebuglist, 0, &setlist);
add_show_prefix_cmd ("debug", no_class,
_("Generic command for showing gdb debugging flags."),
&showdebuglist, 0, &showlist);
add_setshow_prefix_cmd ("debug", no_class,
_("Generic command for setting gdb debugging flags."),
_("Generic command for showing gdb debugging flags."),
&setdebuglist, &showdebuglist,
&setlist, &showlist);
cmd_list_element *shell_cmd
= add_com ("shell", class_support, shell_command, _("\