public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/3] gdb: add add_setshow_prefix_cmd
@ 2021-09-23 13:56 Simon Marchi
  2021-09-23 13:56 ` [PATCH 2/3] gdb: add "maint set/show selftest verbose" commands and use process_options Simon Marchi
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Simon Marchi @ 2021-09-23 13:56 UTC (permalink / raw)
  To: gdb-patches

From: Simon Marchi <simon.marchi@polymtl.ca>

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
---
 gdb/ada-lang.c            | 27 +++++++++------------
 gdb/arm-tdep.c            | 13 ++++-------
 gdb/breakpoint.c          | 11 ++++-----
 gdb/btrace.c              | 34 ++++++++++++---------------
 gdb/cli/cli-cmds.c        | 23 ++++++++----------
 gdb/cli/cli-decode.c      | 22 ++++++++++++++++++
 gdb/cli/cli-logging.c     | 12 +++++-----
 gdb/cli/cli-style.c       | 16 ++++++-------
 gdb/command.h             | 25 ++++++++++++++------
 gdb/dcache.c              | 11 ++++-----
 gdb/dwarf2/read.c         | 12 ++++------
 gdb/f-lang.c              | 13 +++++------
 gdb/frame.c               | 11 ++++-----
 gdb/guile/guile.c         | 22 +++++++++---------
 gdb/i386-tdep.c           | 18 +++++---------
 gdb/language.c            | 23 ++++++++----------
 gdb/maint-test-settings.c | 17 +++++---------
 gdb/memattr.c             | 13 ++++-------
 gdb/mips-tdep.c           | 12 ++++------
 gdb/python/python.c       | 12 ++++------
 gdb/ravenscar-thread.c    | 13 +++++------
 gdb/record-btrace.c       | 49 ++++++++++++++++-----------------------
 gdb/record-full.c         | 14 +++++------
 gdb/record.c              | 21 ++++++++---------
 gdb/riscv-tdep.c          | 26 ++++++++-------------
 gdb/rs6000-tdep.c         | 12 ++++------
 gdb/ser-tcp.c             | 11 ++++-----
 gdb/serial.c              | 16 ++++---------
 gdb/sh-tdep.c             |  9 +++----
 gdb/target-descriptions.c | 14 +++++------
 gdb/tui/tui-win.c         | 11 ++++-----
 gdb/typeprint.c           | 11 ++++-----
 gdb/utils.c               | 10 +++-----
 gdb/valprint.c            | 45 +++++++++++++++--------------------
 34 files changed, 280 insertions(+), 329 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 487d92be5c9..535e9c7c9f5 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13530,13 +13530,12 @@ _initialize_ada_language ()
 {
   initialize_ada_catchpoint_ops ();
 
-  add_basic_prefix_cmd ("ada", no_class,
-			_("Prefix command for changing Ada-specific settings."),
-			&set_ada_list, 0, &setlist);
-
-  add_show_prefix_cmd ("ada", no_class,
-		       _("Generic command for showing Ada-specific settings."),
-		       &show_ada_list, 0, &showlist);
+  add_setshow_prefix_cmd
+    ("ada", no_class,
+     _("Prefix command for changing Ada-specific settings."),
+     _("Generic command for showing Ada-specific settings."),
+     &set_ada_list, &show_ada_list,
+     &setlist, &showlist);
 
   add_setshow_boolean_cmd ("trust-PAD-over-XVS", class_obscure,
 			   &trust_pad_over_xvs, _("\
@@ -13613,15 +13612,11 @@ Usage: info exceptions [REGEXP]\n\
 If a regular expression is passed as an argument, only those matching\n\
 the regular expression are listed."));
 
-  add_basic_prefix_cmd ("ada", class_maintenance,
-			_("Set Ada maintenance-related variables."),
-			&maint_set_ada_cmdlist,
-			0/*allow-unknown*/, &maintenance_set_cmdlist);
-
-  add_show_prefix_cmd ("ada", class_maintenance,
-		       _("Show Ada maintenance-related variables."),
-		       &maint_show_ada_cmdlist,
-		       0/*allow-unknown*/, &maintenance_show_cmdlist);
+  add_setshow_prefix_cmd ("ada", class_maintenance,
+			  _("Set Ada maintenance-related variables."),
+			  _("Show Ada maintenance-related variables."),
+			  &maint_set_ada_cmdlist, &maint_show_ada_cmdlist,
+			  &maintenance_set_cmdlist, &maintenance_show_cmdlist);
 
   add_setshow_boolean_cmd
     ("ignore-descriptive-types", class_maintenance,
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index ab6999ae209..8b020190c59 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -9564,14 +9564,11 @@ _initialize_arm_tdep ()
 				  arm_elf_osabi_sniffer);
 
   /* Add root prefix command for all "set arm"/"show arm" commands.  */
-  add_basic_prefix_cmd ("arm", no_class,
-			_("Various ARM-specific commands."),
-			&setarmcmdlist, 0, &setlist);
-
-  add_show_prefix_cmd ("arm", no_class,
-		       _("Various ARM-specific commands."),
-		       &showarmcmdlist, 0, &showlist);
-
+  add_setshow_prefix_cmd ("arm", no_class,
+			  _("Various ARM-specific commands."),
+			  _("Various ARM-specific commands."),
+			  &setarmcmdlist, &showarmcmdlist,
+			  &setlist, &showlist);
 
   arm_disassembler_options = xstrdup ("reg-names-std");
   const disasm_options_t *disasm_options
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 10b28c97be7..1eb6d499b5c 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15908,18 +15908,17 @@ Use the 'source' command in another debug session to restore them."),
   c = add_com_alias ("save-tracepoints", save_tracepoints_cmd, class_trace, 0);
   deprecate_cmd (c, "save tracepoints");
 
-  add_basic_prefix_cmd ("breakpoint", class_maintenance, _("\
+  add_setshow_prefix_cmd ("breakpoint", class_maintenance,
+			  _("\
 Breakpoint specific settings.\n\
 Configure various breakpoint-specific variables such as\n\
 pending breakpoint behavior."),
-			&breakpoint_set_cmdlist,
-			0/*allow-unknown*/, &setlist);
-  add_show_prefix_cmd ("breakpoint", class_maintenance, _("\
+			  _("\
 Breakpoint specific settings.\n\
 Configure various breakpoint-specific variables such as\n\
 pending breakpoint behavior."),
-		       &breakpoint_show_cmdlist,
-		       0/*allow-unknown*/, &showlist);
+			  &breakpoint_set_cmdlist, &breakpoint_show_cmdlist,
+			  &setlist, &showlist);
 
   add_setshow_auto_boolean_cmd ("pending", no_class,
 				&pending_break_support, _("\
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 6a7b4cfcfc0..f12b1554d65 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -3455,25 +3455,21 @@ _initialize_btrace ()
 			_("Branch tracing maintenance commands."),
 			&maint_btrace_cmdlist, 0, &maintenancelist);
 
-  add_basic_prefix_cmd ("btrace", class_maintenance, _("\
-Set branch tracing specific variables."),
-			&maint_btrace_set_cmdlist,
-			0, &maintenance_set_cmdlist);
-
-  add_basic_prefix_cmd ("pt", class_maintenance, _("\
-Set Intel Processor Trace specific variables."),
-			&maint_btrace_pt_set_cmdlist,
-			0, &maint_btrace_set_cmdlist);
-
-  add_show_prefix_cmd ("btrace", class_maintenance, _("\
-Show branch tracing specific variables."),
-		       &maint_btrace_show_cmdlist,
-		       0, &maintenance_show_cmdlist);
-
-  add_show_prefix_cmd ("pt", class_maintenance, _("\
-Show Intel Processor Trace specific variables."),
-		       &maint_btrace_pt_show_cmdlist,
-		       0, &maint_btrace_show_cmdlist);
+  add_setshow_prefix_cmd ("btrace", class_maintenance,
+			  _("Set branch tracing specific variables."),
+			  _("Show branch tracing specific variables."),
+			  &maint_btrace_set_cmdlist,
+			  &maint_btrace_show_cmdlist,
+			  &maintenance_set_cmdlist,
+			  &maintenance_show_cmdlist);
+
+  add_setshow_prefix_cmd ("pt", class_maintenance,
+			  _("Set Intel Processor Trace specific variables."),
+			  _("Show Intel Processor Trace specific variables."),
+			  &maint_btrace_pt_set_cmdlist,
+			  &maint_btrace_pt_show_cmdlist,
+			  &maint_btrace_set_cmdlist,
+			  &maint_btrace_show_cmdlist);
 
   add_setshow_boolean_cmd ("skip-pad", class_maintenance,
 			   &maint_btrace_pt_skip_pad, _("\
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 5ff0b77eb68..91bad78d40c 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -2352,12 +2352,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."), _("\
@@ -2451,13 +2450,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, _("\
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 06f3de0f038..0d51dfdeaa9 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -407,6 +407,28 @@ add_show_prefix_cmd (const char *name, enum command_class theclass,
   return cmd;
 }
 
+/* See command.h.  */
+
+set_show_commands
+add_setshow_prefix_cmd (const char *name, command_class theclass,
+			const char *set_doc, const char *show_doc,
+			cmd_list_element **set_subcommands_list,
+			cmd_list_element **show_subcommands_list,
+			cmd_list_element **set_list,
+			cmd_list_element **show_list)
+{
+  set_show_commands cmds;
+
+  cmds.set = add_basic_prefix_cmd (name, theclass, set_doc,
+				   set_subcommands_list, 0,
+				   set_list);
+  cmds.show = add_show_prefix_cmd (name, theclass, show_doc,
+				   show_subcommands_list, 0,
+				   show_list);
+
+  return cmds;
+}
+
 /* Like ADD_PREFIX_CMD but sets the suppress_notification pointer on the
    new command list element.  */
 
diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
index dfedd7599a2..c14c53a5d5b 100644
--- a/gdb/cli/cli-logging.c
+++ b/gdb/cli/cli-logging.c
@@ -171,12 +171,12 @@ _initialize_cli_logging ()
 {
   static struct cmd_list_element *set_logging_cmdlist, *show_logging_cmdlist;
 
-  add_basic_prefix_cmd ("logging", class_support,
-			_("Set logging options."), &set_logging_cmdlist,
-			0, &setlist);
-  add_show_prefix_cmd ("logging", class_support,
-		       _("Show logging options."), &show_logging_cmdlist,
-		       0, &showlist);
+  add_setshow_prefix_cmd ("logging", class_support,
+			  _("Set logging options."),
+			  _("Show logging options."),
+			  &set_logging_cmdlist, &show_logging_cmdlist,
+			  &setlist, &showlist);
+
   add_setshow_boolean_cmd ("overwrite", class_support, &logging_overwrite, _("\
 Set whether logging overwrites or appends to the log file."), _("\
 Show whether logging overwrites or appends to the log file."), _("\
diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c
index aca19c51b84..f7e1a844ec0 100644
--- a/gdb/cli/cli-style.c
+++ b/gdb/cli/cli-style.c
@@ -226,10 +226,9 @@ cli_style_option::add_setshow_commands (enum command_class theclass,
 					struct cmd_list_element **show_list,
 					bool skip_intensity)
 {
-  add_basic_prefix_cmd (m_name, no_class, prefix_doc, &m_set_list,
-			0, set_list);
-  add_show_prefix_cmd (m_name, no_class, prefix_doc, &m_show_list,
-		       0, show_list);
+  add_setshow_prefix_cmd (m_name, theclass, prefix_doc, prefix_doc,
+			  &m_set_list, &m_show_list, set_list, show_list);
+
   set_show_commands commands;
 
   commands = add_setshow_enum_cmd
@@ -306,14 +305,15 @@ void _initialize_cli_style ();
 void
 _initialize_cli_style ()
 {
-  add_basic_prefix_cmd ("style", no_class, _("\
+  add_setshow_prefix_cmd ("style", no_class,
+			  _("\
 Style-specific settings.\n\
 Configure various style-related variables, such as colors"),
-		  &style_set_list, 0, &setlist);
-  add_show_prefix_cmd ("style", no_class, _("\
+			  _("\
 Style-specific settings.\n\
 Configure various style-related variables, such as colors"),
-		  &style_show_list, 0, &showlist);
+			  &style_set_list, &style_show_list,
+			  &setlist, &showlist);
 
   add_setshow_boolean_cmd ("enabled", no_class, &cli_styling, _("\
 Set whether CLI styling is enabled."), _("\
diff --git a/gdb/command.h b/gdb/command.h
index baf34401a07..acd4b0d3c9c 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -158,6 +158,13 @@ extern bool valid_user_defined_cmd_name_p (const char *name);
 
 extern bool valid_cmd_char_p (int c);
 
+/* Return value type for the add_setshow_* functions.  */
+
+struct set_show_commands
+{
+  cmd_list_element *set, *show;
+};
+
 /* Const-correct variant of the above.  */
 
 extern struct cmd_list_element *add_cmd (const char *, enum command_class,
@@ -204,6 +211,17 @@ extern struct cmd_list_element *add_show_prefix_cmd
   (const char *, enum command_class, const char *, struct cmd_list_element **,
    int, struct cmd_list_element **);
 
+/* Add matching set and show commands using add_basic_prefix_cmd and
+   add_show_prefix_cmd.  */
+
+extern set_show_commands add_setshow_prefix_cmd
+  (const char *name, command_class theclass, const char *set_doc,
+   const char *show_doc,
+   cmd_list_element **set_subcommands_list,
+   cmd_list_element **show_subcommands_list,
+   cmd_list_element **set_list,
+   cmd_list_element **show_list);
+
 extern struct cmd_list_element *add_prefix_cmd_suppress_notification
 			(const char *name, enum command_class theclass,
 			 cmd_simple_func_ftype *fun,
@@ -392,13 +410,6 @@ typedef void (show_value_ftype) (struct ui_file *file,
    instead print the value out directly.  */
 extern show_value_ftype deprecated_show_value_hack;
 
-/* Return value type for the add_setshow_* functions.  */
-
-struct set_show_commands
-{
-  cmd_list_element *set, *show;
-};
-
 extern set_show_commands add_setshow_enum_cmd
   (const char *name, command_class theclass, const char *const *enumlist,
    const char **var, const char *set_doc, const char *show_doc,
diff --git a/gdb/dcache.c b/gdb/dcache.c
index 50b3854fe69..189f3872e9c 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -694,13 +694,12 @@ With no arguments, this command prints the cache configuration and a\n\
 summary of each line in the cache.  With an argument, dump\"\n\
 the contents of the given line."));
 
-  add_basic_prefix_cmd ("dcache", class_obscure, _("\
+  add_setshow_prefix_cmd ("dcache", class_obscure,
+			  _("\
 Use this command to set number of lines in dcache and line-size."),
-			&dcache_set_list, /*allow_unknown*/0, &setlist);
-  add_show_prefix_cmd ("dcache", class_obscure, _("\
-Show dcachesettings."),
-		       &dcache_show_list, /*allow_unknown*/0,
-		       &showlist);
+			  ("Show dcache settings."),
+			  &dcache_set_list, &dcache_show_list,
+			  &setlist, &showlist);
 
   add_setshow_zuinteger_cmd ("line-size", class_obscure,
 			     &dcache_line_size, _("\
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 3c81ac6b7b5..e61e2ef46f0 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -24879,17 +24879,15 @@ void _initialize_dwarf2_read ();
 void
 _initialize_dwarf2_read ()
 {
-  add_basic_prefix_cmd ("dwarf", class_maintenance, _("\
+  add_setshow_prefix_cmd ("dwarf", class_maintenance,
+			  _("\
 Set DWARF specific variables.\n\
 Configure DWARF variables such as the cache size."),
-			&set_dwarf_cmdlist,
-			0/*allow-unknown*/, &maintenance_set_cmdlist);
-
-  add_show_prefix_cmd ("dwarf", class_maintenance, _("\
+			  _("\
 Show DWARF specific variables.\n\
 Show DWARF variables such as the cache size."),
-		       &show_dwarf_cmdlist,
-		       0/*allow-unknown*/, &maintenance_show_cmdlist);
+			  &set_dwarf_cmdlist, &show_dwarf_cmdlist,
+			  &maintenance_set_cmdlist, &maintenance_show_cmdlist);
 
   add_setshow_zinteger_cmd ("max-cache-age", class_obscure,
 			    &dwarf_max_cache_age, _("\
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 16ec9e04044..904c805abbc 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -1683,13 +1683,12 @@ _initialize_f_language ()
 {
   f_type_data = gdbarch_data_register_post_init (build_fortran_types);
 
-  add_basic_prefix_cmd ("fortran", no_class,
-			_("Prefix command for changing Fortran-specific settings."),
-			&set_fortran_list, 0, &setlist);
-
-  add_show_prefix_cmd ("fortran", no_class,
-		       _("Generic command for showing Fortran-specific settings."),
-		       &show_fortran_list, 0, &showlist);
+  add_setshow_prefix_cmd
+    ("fortran", no_class,
+     _("Prefix command for changing Fortran-specific settings."),
+     _("Generic command for showing Fortran-specific settings."),
+     &set_fortran_list, &show_fortran_list,
+     &setlist, &showlist);
 
   add_setshow_boolean_cmd ("repack-array-slices", class_vars,
 			   &repack_array_slices, _("\
diff --git a/gdb/frame.c b/gdb/frame.c
index d28944075ed..256a30cb49c 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -3082,16 +3082,15 @@ _initialize_frame ()
   gdb::observers::target_changed.attach (frame_observer_target_changed,
 					 "frame");
 
-  add_basic_prefix_cmd ("backtrace", class_maintenance, _("\
+  add_setshow_prefix_cmd ("backtrace", class_maintenance,
+			  _("\
 Set backtrace specific variables.\n\
 Configure backtrace variables such as the backtrace limit"),
-			&set_backtrace_cmdlist,
-			0/*allow-unknown*/, &setlist);
-  add_show_prefix_cmd ("backtrace", class_maintenance, _("\
+			  _("\
 Show backtrace specific variables.\n\
 Show backtrace variables such as the backtrace limit."),
-		       &show_backtrace_cmdlist,
-		       0/*allow-unknown*/, &showlist);
+			  &set_backtrace_cmdlist, &show_backtrace_cmdlist,
+			  &setlist, &showlist);
 
   add_setshow_uinteger_cmd ("limit", class_obscure,
 			    &user_set_backtrace_options.backtrace_limit, _("\
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index a28dee37ed8..9b44e546da1 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -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);
-
-  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);
+  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);
+
+  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,
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index a9c42928195..f6e3b0d0804 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -9042,19 +9042,13 @@ is \"default\"."),
 			NULL, /* FIXME: i18n: */
 			&setlist, &showlist);
 
-  /* Add "mpx" prefix for the set commands.  */
+  /* Add "mpx" prefix for the set and show commands.  */
 
-  add_basic_prefix_cmd ("mpx", class_support, _("\
-Set Intel Memory Protection Extensions specific variables."),
-			&mpx_set_cmdlist,
-			0 /* allow-unknown */, &setlist);
-
-  /* Add "mpx" prefix for the show commands.  */
-
-  add_show_prefix_cmd ("mpx", class_support, _("\
-Show Intel Memory Protection Extensions specific variables."),
-		       &mpx_show_cmdlist,
-		       0 /* allow-unknown */, &showlist);
+  add_setshow_prefix_cmd
+    ("mpx", class_support,
+     _("Set Intel Memory Protection Extensions specific variables."),
+     _("Show Intel Memory Protection Extensions specific variables."),
+     &mpx_set_cmdlist, &mpx_show_cmdlist, &setlist, &showlist);
 
   /* Add "bound" command for the show mpx commands list.  */
 
diff --git a/gdb/language.c b/gdb/language.c
index 45ce2ebcc92..73adbac853c 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -1164,19 +1164,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,
diff --git a/gdb/maint-test-settings.c b/gdb/maint-test-settings.c
index 0ce88905518..5e4f0691de1 100644
--- a/gdb/maint-test-settings.c
+++ b/gdb/maint-test-settings.c
@@ -85,19 +85,14 @@ _initialize_maint_test_settings ()
 {
   maintenance_test_settings_filename = xstrdup ("/foo/bar");
 
-  add_basic_prefix_cmd ("test-settings", class_maintenance,
-			_("\
+  add_setshow_prefix_cmd ("test-settings", class_maintenance,
+			  _("\
 Set GDB internal variables used for set/show command infrastructure testing."),
-			&maintenance_set_test_settings_list,
-			0/*allow-unknown*/,
-			&maintenance_set_cmdlist);
-
-  add_show_prefix_cmd ("test-settings", class_maintenance,
-		       _("\
+			  _("\
 Show GDB internal variables used for set/show command infrastructure testing."),
-		       &maintenance_show_test_settings_list,
-		       0/*allow-unknown*/,
-		       &maintenance_show_cmdlist);
+			  &maintenance_set_test_settings_list,
+			  &maintenance_show_test_settings_list,
+			  &maintenance_set_cmdlist, &maintenance_show_cmdlist);
 
   add_setshow_boolean_cmd ("boolean", class_maintenance,
 			   &maintenance_test_settings_boolean, _("\
diff --git a/gdb/memattr.c b/gdb/memattr.c
index e1c3931c262..c163ac07ebe 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -623,14 +623,11 @@ Do \"info mem\" to see current list of IDs."), &deletelist);
   add_info ("mem", info_mem_command,
 	    _("Memory region attributes."));
 
-  add_basic_prefix_cmd ("mem", class_vars, _("\
-Memory regions settings."),
-			&mem_set_cmdlist,
-			0/* allow-unknown */, &setlist);
-  add_show_prefix_cmd ("mem", class_vars, _("\
-Memory regions settings."),
-		       &mem_show_cmdlist,
-		       0/* allow-unknown */, &showlist);
+  add_setshow_prefix_cmd ("mem", class_vars,
+			  _("Memory regions settings."),
+			  _("Memory regions settings."),
+			  &mem_set_cmdlist, &mem_show_cmdlist,
+			  &setlist, &showlist);
 
   add_setshow_boolean_cmd ("inaccessible-by-default", no_class,
 				  &inaccessible_by_default, _("\
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index f16cdaa14cc..ef5e7fa92a3 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -8942,13 +8942,11 @@ _initialize_mips_tdep ()
   set_tdesc_property (mips_tdesc_gp64, PROPERTY_GP64, "");
 
   /* Add root prefix command for all "set mips"/"show mips" commands.  */
-  add_basic_prefix_cmd ("mips", no_class,
-			_("Various MIPS specific commands."),
-			&setmipscmdlist, 0, &setlist);
-
-  add_show_prefix_cmd ("mips", no_class,
-		       _("Various MIPS specific commands."),
-		       &showmipscmdlist, 0, &showlist);
+  add_setshow_prefix_cmd ("mips", no_class,
+			  _("Various MIPS specific commands."),
+			  _("Various MIPS specific commands."),
+			  &setmipscmdlist, &showmipscmdlist,
+			  &setlist, &showlist);
 
   /* Allow the user to override the ABI.  */
   add_setshow_enum_cmd ("abi", class_obscure, mips_abi_strings,
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 37eacefd8fc..981fdc3d800 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1977,13 +1977,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, _("\
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 490af3a0bb4..ae5308b831b 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -717,13 +717,12 @@ _initialize_ravenscar ()
   gdb::observers::inferior_created.attach (ravenscar_inferior_created,
 					   "ravenscar-thread");
 
-  add_basic_prefix_cmd ("ravenscar", no_class,
-			_("Prefix command for changing Ravenscar-specific settings."),
-			&set_ravenscar_list, 0, &setlist);
-
-  add_show_prefix_cmd ("ravenscar", no_class,
-		       _("Prefix command for showing Ravenscar-specific settings."),
-		       &show_ravenscar_list, 0, &showlist);
+  add_setshow_prefix_cmd
+    ("ravenscar", no_class,
+     _("Prefix command for changing Ravenscar-specific settings."),
+     _("Prefix command for showing Ravenscar-specific settings."),
+     &set_ravenscar_list, &show_ravenscar_list,
+     &setlist, &showlist);
 
   add_setshow_boolean_cmd ("task-switching", class_obscure,
 			   &ravenscar_task_support, _("\
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index e2b9866d68a..f326ca41a51 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -3134,13 +3134,12 @@ This format may not be available on all processors."),
 	     &record_btrace_cmdlist);
   add_alias_cmd ("pt", record_btrace_pt_cmd, class_obscure, 1, &record_cmdlist);
 
-  add_basic_prefix_cmd ("btrace", class_support,
-			_("Set record options."), &set_record_btrace_cmdlist,
-			0, &set_record_cmdlist);
-
-  add_show_prefix_cmd ("btrace", class_support,
-		       _("Show record options."), &show_record_btrace_cmdlist,
-		       0, &show_record_cmdlist);
+  add_setshow_prefix_cmd ("btrace", class_support,
+			  _("Set record options."),
+			  _("Show record options."),
+			  &set_record_btrace_cmdlist,
+			  &show_record_btrace_cmdlist,
+			  &set_record_cmdlist, &show_record_cmdlist);
 
   add_setshow_enum_cmd ("replay-memory-access", no_class,
 			replay_memory_access_types, &replay_memory_access, _("\
@@ -3183,17 +3182,13 @@ Do not enable errata workarounds for trace decode."),
 Show the cpu to be used for trace decode."),
 	   &show_record_btrace_cmdlist);
 
-  add_basic_prefix_cmd ("bts", class_support,
-			_("Set record btrace bts options."),
-			&set_record_btrace_bts_cmdlist,
-			0,
-			&set_record_btrace_cmdlist);
-
-  add_show_prefix_cmd ("bts", class_support,
-		       _("Show record btrace bts options."),
-		       &show_record_btrace_bts_cmdlist,
-		       0,
-		       &show_record_btrace_cmdlist);
+  add_setshow_prefix_cmd ("bts", class_support,
+			  _("Set record btrace bts options."),
+			  _("Show record btrace bts options."),
+			  &set_record_btrace_bts_cmdlist,
+			  &show_record_btrace_bts_cmdlist,
+			  &set_record_btrace_cmdlist,
+			  &show_record_btrace_cmdlist);
 
   add_setshow_uinteger_cmd ("buffer-size", no_class,
 			    &record_btrace_conf.bts.size,
@@ -3209,17 +3204,13 @@ The trace buffer size may not be changed while recording."), NULL,
 			    &set_record_btrace_bts_cmdlist,
 			    &show_record_btrace_bts_cmdlist);
 
-  add_basic_prefix_cmd ("pt", class_support,
-			_("Set record btrace pt options."),
-			&set_record_btrace_pt_cmdlist,
-			0,
-			&set_record_btrace_cmdlist);
-
-  add_show_prefix_cmd ("pt", class_support,
-		       _("Show record btrace pt options."),
-		       &show_record_btrace_pt_cmdlist,
-		       0,
-		       &show_record_btrace_cmdlist);
+  add_setshow_prefix_cmd ("pt", class_support,
+			  _("Set record btrace pt options."),
+			  _("Show record btrace pt options."),
+			  &set_record_btrace_pt_cmdlist,
+			  &show_record_btrace_pt_cmdlist,
+			  &set_record_btrace_cmdlist,
+			  &show_record_btrace_cmdlist);
 
   add_setshow_uinteger_cmd ("buffer-size", no_class,
 			    &record_btrace_conf.pt.size,
diff --git a/gdb/record-full.c b/gdb/record-full.c
index f5c4244f0ed..dad2e1d2a55 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2802,13 +2802,13 @@ Argument is filename.  File must be created with 'record save'."),
   set_cmd_completer (c, filename_completer);
   deprecate_cmd (c, "record full restore");
 
-  add_basic_prefix_cmd ("full", class_support,
-			_("Set record options."), &set_record_full_cmdlist,
-			0, &set_record_cmdlist);
-
-  add_show_prefix_cmd ("full", class_support,
-		       _("Show record options."), &show_record_full_cmdlist,
-		       0, &show_record_cmdlist);
+  add_setshow_prefix_cmd ("full", class_support,
+			  _("Set record options."),
+			  _("Show record options."),
+			  &set_record_full_cmdlist,
+			  &show_record_full_cmdlist,
+			  &set_record_cmdlist,
+			  &show_record_cmdlist);
 
   /* Record instructions number limit command.  */
   set_show_commands set_record_full_stop_at_limit_cmds
diff --git a/gdb/record.c b/gdb/record.c
index 6968c30d930..37619780d37 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -793,17 +793,16 @@ A size of \"unlimited\" means unlimited lines.  The default is 10."),
 
   add_com_alias ("rec", record_cmd, class_obscure, 1);
 
-  cmd_list_element *set_record_cmd
-    = add_basic_prefix_cmd ("record", class_support,
-			    _("Set record options."), &set_record_cmdlist,
-			    0, &setlist);
-  add_alias_cmd ("rec", set_record_cmd, class_obscure, 1, &setlist);
-
-  cmd_list_element *show_record_cmd
-    = add_show_prefix_cmd ("record", class_support,
-			   _("Show record options."), &show_record_cmdlist,
-			   0, &showlist);
-  add_alias_cmd ("rec", show_record_cmd, class_obscure, 1, &showlist);
+  set_show_commands setshow_record_cmds
+    = add_setshow_prefix_cmd ("record", class_support,
+			      _("Set record options."),
+			      _("Show record options."),
+			      &set_record_cmdlist, &show_record_cmdlist,
+			      &setlist, &showlist);
+
+
+  add_alias_cmd ("rec", setshow_record_cmds.set, class_obscure, 1, &setlist);
+  add_alias_cmd ("rec", setshow_record_cmds.show, class_obscure, 1, &showlist);
 
   cmd_list_element *info_record_cmd
     = add_prefix_cmd ("record", class_support, info_record_command,
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 8b55bc33ded..58fc0a77b48 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -4007,15 +4007,11 @@ _initialize_riscv_tdep ()
 
   /* Add root prefix command for all "set debug riscv" and "show debug
      riscv" commands.  */
-  add_basic_prefix_cmd ("riscv", no_class,
-			_("RISC-V specific debug commands."),
-			&setdebugriscvcmdlist, 0,
-			&setdebuglist);
-
-  add_show_prefix_cmd ("riscv", no_class,
-		       _("RISC-V specific debug commands."),
-		       &showdebugriscvcmdlist, 0,
-		       &showdebuglist);
+  add_setshow_prefix_cmd ("riscv", no_class,
+			  _("RISC-V specific debug commands."),
+			  _("RISC-V specific debug commands."),
+			  &setdebugriscvcmdlist, &showdebugriscvcmdlist,
+			  &setdebuglist, &showdebuglist);
 
   add_setshow_zuinteger_cmd ("breakpoints", class_maintenance,
 			     &riscv_debug_breakpoints,  _("\
@@ -4058,13 +4054,11 @@ initialisation process."),
 			     &setdebugriscvcmdlist, &showdebugriscvcmdlist);
 
   /* Add root prefix command for all "set riscv" and "show riscv" commands.  */
-  add_basic_prefix_cmd ("riscv", no_class,
-			_("RISC-V specific commands."),
-			&setriscvcmdlist, 0, &setlist);
-
-  add_show_prefix_cmd ("riscv", no_class,
-		       _("RISC-V specific commands."),
-		       &showriscvcmdlist, 0, &showlist);
+  add_setshow_prefix_cmd ("riscv", no_class,
+			  _("RISC-V specific commands."),
+			  _("RISC-V specific commands."),
+			  &setriscvcmdlist, &showriscvcmdlist,
+			  &setlist, &showlist);
 
 
   use_compressed_breakpoints = AUTO_BOOLEAN_AUTO;
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 826f0266ed8..de483a93f21 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -7411,13 +7411,11 @@ _initialize_rs6000_tdep ()
 
   /* Add root prefix command for all "set powerpc"/"show powerpc"
      commands.  */
-  add_basic_prefix_cmd ("powerpc", no_class,
-			_("Various PowerPC-specific commands."),
-			&setpowerpccmdlist, 0, &setlist);
-
-  add_show_prefix_cmd ("powerpc", no_class,
-		       _("Various PowerPC-specific commands."),
-		       &showpowerpccmdlist, 0, &showlist);
+  add_setshow_prefix_cmd ("powerpc", no_class,
+			  _("Various PowerPC-specific commands."),
+			  _("Various PowerPC-specific commands."),
+			  &setpowerpccmdlist, &showpowerpccmdlist,
+			  &setlist, &showlist);
 
   /* Add a command to allow the user to force the ABI.  */
   add_setshow_auto_boolean_cmd ("soft-float", class_support,
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 2519caa505c..7ed61db5774 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -466,16 +466,15 @@ _initialize_ser_tcp ()
   serial_add_interface (&tcp_ops);
 #endif /* USE_WIN32API */
 
-  add_basic_prefix_cmd ("tcp", class_maintenance, _("\
+  add_setshow_prefix_cmd ("tcp", class_maintenance,
+			  _("\
 TCP protocol specific variables.\n\
 Configure variables specific to remote TCP connections."),
-			&tcp_set_cmdlist,
-			0 /* allow-unknown */, &setlist);
-  add_show_prefix_cmd ("tcp", class_maintenance, _("\
+			  _("\
 TCP protocol specific variables.\n\
 Configure variables specific to remote TCP connections."),
-		       &tcp_show_cmdlist,
-		       0 /* allow-unknown */, &showlist);
+			  &tcp_set_cmdlist, &tcp_show_cmdlist,
+			  &setlist, &showlist);
 
   add_setshow_boolean_cmd ("auto-retry", class_obscure,
 			   &tcp_auto_retry, _("\
diff --git a/gdb/serial.c b/gdb/serial.c
index 7d1bc535ed9..042ca4761c1 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -669,17 +669,11 @@ Connect the terminal directly up to the command monitor.\n\
 Use <CR>~. or <CR>~^D to break out."));
 #endif /* 0 */
 
-  add_basic_prefix_cmd ("serial", class_maintenance, _("\
-Set default serial/parallel port configuration."),
-			&serial_set_cmdlist,
-			0/*allow-unknown*/,
-			&setlist);
-
-  add_show_prefix_cmd ("serial", class_maintenance, _("\
-Show default serial/parallel port configuration."),
-		       &serial_show_cmdlist,
-		       0/*allow-unknown*/,
-		       &showlist);
+  add_setshow_prefix_cmd ("serial", class_maintenance,
+			  _("Set default serial/parallel port configuration."),
+			  _("Show default serial/parallel port configuration."),
+			  &serial_set_cmdlist, &serial_show_cmdlist,
+			  &setlist, &showlist);
 
   /* If target is open when baud changes, it doesn't take effect until
      the next open (I think, not sure).  */
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index bfb220adf79..efe8bfdb527 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -2416,10 +2416,11 @@ _initialize_sh_tdep ()
 {
   gdbarch_register (bfd_arch_sh, sh_gdbarch_init, NULL);
 
-  add_basic_prefix_cmd ("sh", no_class, "SH specific commands.",
-			&setshcmdlist, 0, &setlist);
-  add_show_prefix_cmd ("sh", no_class, "SH specific commands.",
-		       &showshcmdlist, 0, &showlist);
+  add_setshow_prefix_cmd ("sh", no_class,
+			  _("SH specific commands."),
+			  _("SH specific commands."),
+			  &setshcmdlist, &showshcmdlist,
+			  &setlist, &showlist);
   
   add_setshow_enum_cmd ("calling-convention", class_vars, sh_cc_enum,
 			&sh_active_calling_convention,
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index f94ace756d4..30ecef360d9 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1962,14 +1962,12 @@ _initialize_target_descriptions ()
 
   tdesc_data = gdbarch_data_register_pre_init (tdesc_data_init);
 
-  add_basic_prefix_cmd ("tdesc", class_maintenance, _("\
-Set target description specific variables."),
-			&tdesc_set_cmdlist,
-			0 /* allow-unknown */, &setlist);
-  add_show_prefix_cmd ("tdesc", class_maintenance, _("\
-Show target description specific variables."),
-		       &tdesc_show_cmdlist,
-		       0 /* allow-unknown */, &showlist);
+  add_setshow_prefix_cmd ("tdesc", class_maintenance,
+			  _("Set target description specific variables."),
+			  _("Show target description specific variables."),
+			  &tdesc_set_cmdlist, &tdesc_show_cmdlist,
+			  &setlist, &showlist);
+
   add_basic_prefix_cmd ("tdesc", class_maintenance, _("\
 Unset target description specific variables."),
 			&tdesc_unset_cmdlist,
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index a51e7b9f6da..8462d1eb1da 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -987,12 +987,11 @@ _initialize_tui_win ()
 
   /* Define the classes of commands.
      They will appear in the help list in the reverse of this order.  */
-  add_basic_prefix_cmd ("tui", class_tui,
-			_("TUI configuration variables."),
-			&tui_setlist, 0 /* allow-unknown */, &setlist);
-  add_show_prefix_cmd ("tui", class_tui,
-		       _("TUI configuration variables."),
-		       &tui_showlist, 0 /* allow-unknown */, &showlist);
+  add_setshow_prefix_cmd ("tui", class_tui,
+			  _("TUI configuration variables."),
+			  _("TUI configuration variables."),
+			  &tui_setlist, &tui_showlist,
+			  &setlist, &showlist);
 
   add_com ("refresh", class_tui, tui_refresh_all_command,
 	   _("Refresh the terminal display."));
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 0776f634215..9d9bec5cd5e 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -845,12 +845,11 @@ Available FLAGS are:\n\
 Only one level of typedefs is unrolled.  See also \"ptype\"."));
   set_cmd_completer (c, expression_completer);
 
-  add_show_prefix_cmd ("type", no_class,
-		       _("Generic command for showing type-printing settings."),
-		       &showprinttypelist, 0, &showprintlist);
-  add_basic_prefix_cmd ("type", no_class,
-			_("Generic command for setting how types print."),
-			&setprinttypelist, 0, &setprintlist);
+  add_setshow_prefix_cmd ("type", no_class,
+			  _("Generic command for showing type-printing settings."),
+			  _("Generic command for setting how types print."),
+			  &setprinttypelist, &showprinttypelist,
+			  &setprintlist, &showprintlist);
 
   add_setshow_boolean_cmd ("methods", no_class, &print_methods,
 			   _("\
diff --git a/gdb/utils.c b/gdb/utils.c
index 0a7c270b40d..804cc4e6501 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -524,13 +524,9 @@ add_internal_problem_command (struct internal_problem *problem)
     = xstrprintf (_("Show what GDB does when %s is detected."),
 		  problem->name);
 
-  add_basic_prefix_cmd (problem->name, class_maintenance, set_doc,
-			set_cmd_list,
-			0/*allow-unknown*/, &maintenance_set_cmdlist);
-
-  add_show_prefix_cmd (problem->name, class_maintenance, show_doc,
-		       show_cmd_list,
-		       0/*allow-unknown*/, &maintenance_show_cmdlist);
+  add_setshow_prefix_cmd (problem->name, class_maintenance,
+			  set_doc, show_doc, set_cmd_list, show_cmd_list,
+			  &maintenance_set_cmdlist, &maintenance_show_cmdlist);
 
   if (problem->user_settable_should_quit)
     {
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 324055da93f..2fb308f30c7 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -3173,33 +3173,26 @@ _initialize_valprint ()
   selftests::register_test_foreach_arch ("print-flags", test_print_flags);
 #endif
 
-  cmd_list_element *cmd;
-
-  cmd_list_element *set_print_cmd
-    = add_basic_prefix_cmd ("print", no_class,
-			    _("Generic command for setting how things print."),
-			    &setprintlist, 0, &setlist);
-  add_alias_cmd ("p", set_print_cmd, no_class, 1, &setlist);
+  set_show_commands setshow_print_cmds
+    = add_setshow_prefix_cmd ("print", no_class,
+			      _("Generic command for setting how things print."),
+			      _("Generic command for showing print settings."),
+			      &setprintlist, &showprintlist,
+			      &setlist, &showlist);
+  add_alias_cmd ("p", setshow_print_cmds.set, no_class, 1, &setlist);
   /* Prefer set print to set prompt.  */
-  add_alias_cmd ("pr", set_print_cmd, no_class, 1, &setlist);
-
-  cmd_list_element *show_print_cmd
-    = add_show_prefix_cmd ("print", no_class,
-			   _("Generic command for showing print settings."),
-			   &showprintlist, 0, &showlist);
-  add_alias_cmd ("p", show_print_cmd, no_class, 1, &showlist);
-  add_alias_cmd ("pr", show_print_cmd, no_class, 1, &showlist);
-
-  cmd = add_basic_prefix_cmd ("raw", no_class,
-			      _("\
-Generic command for setting what things to print in \"raw\" mode."),
-			      &setprintrawlist, 0, &setprintlist);
-  deprecate_cmd (cmd, nullptr);
-
-  cmd = add_show_prefix_cmd ("raw", no_class,
-			     _("Generic command for showing \"print raw\" settings."),
-			     &showprintrawlist, 0, &showprintlist);
-  deprecate_cmd (cmd, nullptr);
+  add_alias_cmd ("pr", setshow_print_cmds.set, no_class, 1, &setlist);
+  add_alias_cmd ("p", setshow_print_cmds.show, no_class, 1, &showlist);
+  add_alias_cmd ("pr", setshow_print_cmds.show, no_class, 1, &showlist);
+
+  set_show_commands setshow_print_raw_cmds
+    = add_setshow_prefix_cmd
+	("raw", no_class,
+	 _("Generic command for setting what things to print in \"raw\" mode."),
+	 _("Generic command for showing \"print raw\" settings."),
+	 &setprintrawlist, &showprintrawlist, &setprintlist, &showprintlist);
+  deprecate_cmd (setshow_print_raw_cmds.set, nullptr);
+  deprecate_cmd (setshow_print_raw_cmds.show, nullptr);
 
   gdb::option::add_setshow_cmds_for_options
     (class_support, &user_print_options, value_print_option_defs,
-- 
2.33.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-10-29 12:06 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23 13:56 [PATCH 1/3] gdb: add add_setshow_prefix_cmd Simon Marchi
2021-09-23 13:56 ` [PATCH 2/3] gdb: add "maint set/show selftest verbose" commands and use process_options Simon Marchi
2021-09-23 15:45   ` Eli Zaretskii
2021-09-23 19:11     ` Simon Marchi
2021-09-23 19:31   ` Pedro Alves
2021-10-28 14:48     ` Simon Marchi
2021-09-23 20:44   ` Tom Tromey
2021-09-23 13:56 ` [PATCH 3/3] gdb: add selftest name completion Simon Marchi
2021-09-23 19:35   ` Pedro Alves
2021-10-28 15:18     ` Simon Marchi
2021-10-29  7:24       ` Tom de Vries
2021-10-29 12:05         ` Simon Marchi
2021-09-23 20:46   ` Tom Tromey
2021-10-28 15:19     ` Simon Marchi
2021-09-23 20:35 ` [PATCH 1/3] gdb: add add_setshow_prefix_cmd Bruno Larsen
2021-10-28 14:39   ` Simon Marchi
2021-09-23 20:41 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).