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

@ -1140,19 +1140,16 @@ _initialize_language ()
/* GDB commands for language specific stuff. */
cmd_list_element *set_check_cmd
= add_basic_prefix_cmd ("check", no_class,
_("Set the status of the type/range checker."),
&setchecklist, 0, &setlist);
add_alias_cmd ("c", set_check_cmd, no_class, 1, &setlist);
add_alias_cmd ("ch", set_check_cmd, no_class, 1, &setlist);
cmd_list_element *show_check_cmd
= add_show_prefix_cmd ("check", no_class,
_("Show the status of the type/range checker."),
&showchecklist, 0, &showlist);
add_alias_cmd ("c", show_check_cmd, no_class, 1, &showlist);
add_alias_cmd ("ch", show_check_cmd, no_class, 1, &showlist);
set_show_commands setshow_check_cmds
= add_setshow_prefix_cmd ("check", no_class,
_("Set the status of the type/range checker."),
_("Show the status of the type/range checker."),
&setchecklist, &showchecklist,
&setlist, &showlist);
add_alias_cmd ("c", setshow_check_cmds.set, no_class, 1, &setlist);
add_alias_cmd ("ch", setshow_check_cmds.set, no_class, 1, &setlist);
add_alias_cmd ("c", setshow_check_cmds.show, no_class, 1, &showlist);
add_alias_cmd ("ch", setshow_check_cmds.show, no_class, 1, &showlist);
add_setshow_enum_cmd ("range", class_support, type_or_range_names,
&range,