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

@@ -780,17 +780,17 @@ This command is only a placeholder.")
);
add_com_alias ("gu", guile_cmd_element, class_obscure, 1);
cmd_list_element *set_guile_cmd
= add_basic_prefix_cmd ("guile", class_obscure,
_("Prefix command for Guile preference settings."),
&set_guile_list, 0, &setlist);
add_alias_cmd ("gu", set_guile_cmd, class_obscure, 1, &setlist);
set_show_commands setshow_guile_cmds
= add_setshow_prefix_cmd ("guile", class_obscure,
_("\
Prefix command for Guile preference settings."),
_("\
Prefix command for Guile preference settings."),
&set_guile_list, &show_guile_list,
&setlist, &showlist);
cmd_list_element *show_guile_cmd
= add_show_prefix_cmd ("guile", class_obscure,
_("Prefix command for Guile preference settings."),
&show_guile_list, 0, &showlist);
add_alias_cmd ("gu", show_guile_cmd, class_obscure, 1, &showlist);
add_alias_cmd ("gu", setshow_guile_cmds.set, class_obscure, 1, &setlist);
add_alias_cmd ("gu", setshow_guile_cmds.show, class_obscure, 1, &showlist);
cmd_list_element *info_guile_cmd
= add_basic_prefix_cmd ("guile", class_obscure,