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

@ -2041,13 +2041,11 @@ This command is only a placeholder.")
add_com_alias ("py", python_cmd_element, class_obscure, 1);
/* Add set/show python print-stack. */
add_basic_prefix_cmd ("python", no_class,
_("Prefix command for python preference settings."),
&user_show_python_list, 0, &showlist);
add_show_prefix_cmd ("python", no_class,
_("Prefix command for python preference settings."),
&user_set_python_list, 0, &setlist);
add_setshow_prefix_cmd ("python", no_class,
_("Prefix command for python preference settings."),
_("Prefix command for python preference settings."),
&user_set_python_list, &user_show_python_list,
&setlist, &showlist);
add_setshow_enum_cmd ("print-stack", no_class, python_excp_enums,
&gdbpy_should_print_stack, _("\