Replace most calls to help_list and cmd_show_list
authorTom Tromey <tromey@adacore.com>
Fri, 17 Apr 2020 13:27:14 +0000 (07:27 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 17 Apr 2020 21:13:41 +0000 (15:13 -0600)
Currently there are many prefix commands that do nothing but call
either help_list or cmd_show_list.  I happened to notice that one such
call, for "set print type", used the wrong command list parameter,
causing incorrect output.

Rather than fix this bug in isolation, I decided to eliminate this
possibility by adding two new ways to add prefix commands, which
simply route the call to help_list or cmd_show_list, as appropriate.
This makes it impossible for a mismatch to occur.

In some cases, a bit of output was removed; however, I don't think
this output in general was very useful.  It seemed redundant with
what's already printed by help_list.  A representative example is this
hunk, removed from ada-lang.c:

-  printf_unfiltered (_(\
-"\"set ada\" must be followed by the name of a setting.\n"));

This simplified the CLI style set/show commands quite a bit, and
allowed the deletion of a macro.

This also cleans up some unusual code in windows-tdep.c.

Tested on x86-64 Fedora 30.  Note that I have no way to build the
go32-nat.c change.

gdb/ChangeLog
2020-04-17  Tom Tromey  <tromey@adacore.com>

* auto-load.c (show_auto_load_cmd): Remove.
(auto_load_show_cmdlist_get): Use add_show_prefix_cmd.
* arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd.
(maintenance_print_arc_command): Remove.
* tui/tui-win.c (tui_command): Remove.
(tui_get_cmd_list): Use add_basic_prefix_cmd.
* tui/tui-layout.c (tui_layout_command): Remove.
(_initialize_tui_layout): Use add_basic_prefix_cmd.
* python/python.c (user_set_python, user_show_python): Remove.
(_initialize_python): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* guile/guile.c (set_guile_command, show_guile_command): Remove.
(install_gdb_commands): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
(info_guile_command): Remove.
* dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove.
(_initialize_dwarf2_read): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* cli/cli-style.h (class cli_style_option) <add_setshow_commands>:
Remove do_set and do_show parameters.
* cli/cli-style.c (set_style, show_style): Remove.
(_initialize_cli_style): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
(cli_style_option::add_setshow_commands): Remove do_set and
do_show parameters.
(cli_style_option::add_setshow_commands): Use
add_basic_prefix_cmd, add_show_prefix_cmd.
(STYLE_ADD_SETSHOW_COMMANDS): Remove macro.
(set_style_name): Remove.
* cli/cli-dump.c (dump_command, append_command): Remove.
(srec_dump_command, ihex_dump_command, verilog_dump_command)
(tekhex_dump_command, binary_dump_command)
(binary_append_command): Remove.
(_initialize_cli_dump): Use add_basic_prefix_cmd.
* windows-tdep.c (w32_prefix_command_valid): Remove global.
(init_w32_command_list): Remove; move into ...
(_initialize_windows_tdep): ... here.  Use add_basic_prefix_cmd.
* valprint.c (set_print, show_print, set_print_raw)
(show_print_raw): Remove.
(_initialize_valprint): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* typeprint.c (set_print_type, show_print_type): Remove.
(_initialize_typeprint): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* record.c (set_record_command, show_record_command): Remove.
(_initialize_record): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
(info_command, show_command, set_debug, show_debug): Remove.
* top.h (set_history, show_history): Don't declare.
* top.c (set_history, show_history): Remove.
* target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd)
(unset_tdesc_cmd): Remove.
(_initialize_target_descriptions): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* symtab.c (info_module_command): Remove.
(_initialize_symtab): Use add_basic_prefix_cmd.
* symfile.c (overlay_command): Remove.
(_initialize_symfile): Use add_basic_prefix_cmd.
* sparc64-tdep.c (info_adi_command): Remove.
(_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd.
* sh-tdep.c (show_sh_command, set_sh_command): Remove.
(_initialize_sh_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* serial.c (serial_set_cmd, serial_show_cmd): Remove.
(_initialize_serial): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove.
(_initialize_ser_tcp): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* rs6000-tdep.c (set_powerpc_command, show_powerpc_command)
(_initialize_rs6000_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* riscv-tdep.c (show_riscv_command, set_riscv_command)
(show_debug_riscv_command, set_debug_riscv_command): Remove.
(_initialize_riscv_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* remote.c (remote_command, set_remote_cmd): Remove.
(_initialize_remote): Use add_basic_prefix_cmd.
* record-full.c (set_record_full_command)
(show_record_full_command): Remove.
(_initialize_record_full): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* record-btrace.c (cmd_set_record_btrace)
(cmd_show_record_btrace, cmd_set_record_btrace_bts)
(cmd_show_record_btrace_bts, cmd_set_record_btrace_pt)
(cmd_show_record_btrace_pt): Remove.
(_initialize_record_btrace): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* ravenscar-thread.c (set_ravenscar_command)
(show_ravenscar_command): Remove.
(_initialize_ravenscar): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* mips-tdep.c (show_mips_command, set_mips_command)
(_initialize_mips_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* maint.c (maintenance_command, maintenance_info_command)
(maintenance_check_command, maintenance_print_command)
(maintenance_set_cmd, maintenance_show_cmd): Remove.
(_initialize_maint_cmds): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
(show_per_command_cmd): Remove.
* maint-test-settings.c (maintenance_set_test_settings_cmd):
Remove.
(maintenance_show_test_settings_cmd): Remove.
(_initialize_maint_test_settings): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* maint-test-options.c (maintenance_test_options_command):
Remove.
(_initialize_maint_test_options): Use add_basic_prefix_cmd.
* macrocmd.c (macro_command): Remove
(_initialize_macrocmd): Use add_basic_prefix_cmd.
* language.c (set_check, show_check): Remove.
(_initialize_language): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* infcmd.c (unset_command): Remove.
(_initialize_infcmd): Use add_basic_prefix_cmd.
* i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove.
(_initialize_i386_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* go32-nat.c (go32_info_dos_command): Remove.
(_initialize_go32_nat): Use add_basic_prefix_cmd.
* cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd)
(do_show_prefix_cmd, add_show_prefix_cmd): New functions.
* frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove.
(_initialize_frame): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* dcache.c (set_dcache_command, show_dcache_command): Remove.
(_initialize_dcache): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* cp-support.c (maint_cplus_command): Remove.
(_initialize_cp_support): Use add_basic_prefix_cmd.
* btrace.c (maint_btrace_cmd, maint_btrace_set_cmd)
(maint_btrace_show_cmd, maint_btrace_pt_set_cmd)
(maint_btrace_pt_show_cmd, _initialize_btrace): Use
add_basic_prefix_cmd, add_show_prefix_cmd.
* breakpoint.c (save_command): Remove.
(_initialize_breakpoint): Use add_basic_prefix_cmd.
* arm-tdep.c (set_arm_command, show_arm_command): Remove.
(_initialize_arm_tdep): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd)
(set_ada_command, show_ada_command): Remove.
(_initialize_ada_language): Use add_basic_prefix_cmd,
add_show_prefix_cmd.
* command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare.

gdb/testsuite/ChangeLog
2020-04-17  Tom Tromey  <tromey@adacore.com>

* gdb.cp/maint.exp (test_help): Simplify multiple_help_body.
Update tests.
* gdb.btrace/cpu.exp: Update tests.
* gdb.base/maint.exp: Update tests.
* gdb.base/default.exp: Update tests.
* gdb.base/completion.exp: Update tests.

55 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/arc-tdep.c
gdb/arm-tdep.c
gdb/auto-load.c
gdb/breakpoint.c
gdb/btrace.c
gdb/cli/cli-cmds.c
gdb/cli/cli-decode.c
gdb/cli/cli-dump.c
gdb/cli/cli-style.c
gdb/cli/cli-style.h
gdb/command.h
gdb/cp-support.c
gdb/dcache.c
gdb/dwarf2/read.c
gdb/frame.c
gdb/go32-nat.c
gdb/guile/guile.c
gdb/i386-tdep.c
gdb/infcmd.c
gdb/language.c
gdb/macrocmd.c
gdb/maint-test-options.c
gdb/maint-test-settings.c
gdb/maint.c
gdb/mips-tdep.c
gdb/python/python.c
gdb/ravenscar-thread.c
gdb/record-btrace.c
gdb/record-full.c
gdb/record.c
gdb/remote.c
gdb/riscv-tdep.c
gdb/rs6000-tdep.c
gdb/ser-tcp.c
gdb/serial.c
gdb/sh-tdep.c
gdb/sparc64-tdep.c
gdb/symfile.c
gdb/symtab.c
gdb/target-descriptions.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/completion.exp
gdb/testsuite/gdb.base/default.exp
gdb/testsuite/gdb.base/maint.exp
gdb/testsuite/gdb.btrace/cpu.exp
gdb/testsuite/gdb.cp/maint.exp
gdb/top.c
gdb/top.h
gdb/tui/tui-layout.c
gdb/tui/tui-win.c
gdb/typeprint.c
gdb/valprint.c
gdb/windows-tdep.c

index b03101c8cd971a8563a7511b6ba2561fe88db57b..57418b852fe97fde53cd3c2e50b42dee8ad253fb 100644 (file)
@@ -1,3 +1,153 @@
+2020-04-17  Tom Tromey  <tromey@adacore.com>
+
+       * auto-load.c (show_auto_load_cmd): Remove.
+       (auto_load_show_cmdlist_get): Use add_show_prefix_cmd.
+       * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd.
+       (maintenance_print_arc_command): Remove.
+       * tui/tui-win.c (tui_command): Remove.
+       (tui_get_cmd_list): Use add_basic_prefix_cmd.
+       * tui/tui-layout.c (tui_layout_command): Remove.
+       (_initialize_tui_layout): Use add_basic_prefix_cmd.
+       * python/python.c (user_set_python, user_show_python): Remove.
+       (_initialize_python): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * guile/guile.c (set_guile_command, show_guile_command): Remove.
+       (install_gdb_commands): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       (info_guile_command): Remove.
+       * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove.
+       (_initialize_dwarf2_read): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * cli/cli-style.h (class cli_style_option) <add_setshow_commands>:
+       Remove do_set and do_show parameters.
+       * cli/cli-style.c (set_style, show_style): Remove.
+       (_initialize_cli_style): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       (cli_style_option::add_setshow_commands): Remove do_set and
+       do_show parameters.
+       (cli_style_option::add_setshow_commands): Use
+       add_basic_prefix_cmd, add_show_prefix_cmd.
+       (STYLE_ADD_SETSHOW_COMMANDS): Remove macro.
+       (set_style_name): Remove.
+       * cli/cli-dump.c (dump_command, append_command): Remove.
+       (srec_dump_command, ihex_dump_command, verilog_dump_command)
+       (tekhex_dump_command, binary_dump_command)
+       (binary_append_command): Remove.
+       (_initialize_cli_dump): Use add_basic_prefix_cmd.
+       * windows-tdep.c (w32_prefix_command_valid): Remove global.
+       (init_w32_command_list): Remove; move into ...
+       (_initialize_windows_tdep): ... here.  Use add_basic_prefix_cmd.
+       * valprint.c (set_print, show_print, set_print_raw)
+       (show_print_raw): Remove.
+       (_initialize_valprint): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * typeprint.c (set_print_type, show_print_type): Remove.
+       (_initialize_typeprint): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * record.c (set_record_command, show_record_command): Remove.
+       (_initialize_record): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       (info_command, show_command, set_debug, show_debug): Remove.
+       * top.h (set_history, show_history): Don't declare.
+       * top.c (set_history, show_history): Remove.
+       * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd)
+       (unset_tdesc_cmd): Remove.
+       (_initialize_target_descriptions): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * symtab.c (info_module_command): Remove.
+       (_initialize_symtab): Use add_basic_prefix_cmd.
+       * symfile.c (overlay_command): Remove.
+       (_initialize_symfile): Use add_basic_prefix_cmd.
+       * sparc64-tdep.c (info_adi_command): Remove.
+       (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd.
+       * sh-tdep.c (show_sh_command, set_sh_command): Remove.
+       (_initialize_sh_tdep): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * serial.c (serial_set_cmd, serial_show_cmd): Remove.
+       (_initialize_serial): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove.
+       (_initialize_ser_tcp): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * rs6000-tdep.c (set_powerpc_command, show_powerpc_command)
+       (_initialize_rs6000_tdep): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * riscv-tdep.c (show_riscv_command, set_riscv_command)
+       (show_debug_riscv_command, set_debug_riscv_command): Remove.
+       (_initialize_riscv_tdep): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * remote.c (remote_command, set_remote_cmd): Remove.
+       (_initialize_remote): Use add_basic_prefix_cmd.
+       * record-full.c (set_record_full_command)
+       (show_record_full_command): Remove.
+       (_initialize_record_full): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * record-btrace.c (cmd_set_record_btrace)
+       (cmd_show_record_btrace, cmd_set_record_btrace_bts)
+       (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt)
+       (cmd_show_record_btrace_pt): Remove.
+       (_initialize_record_btrace): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * ravenscar-thread.c (set_ravenscar_command)
+       (show_ravenscar_command): Remove.
+       (_initialize_ravenscar): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * mips-tdep.c (show_mips_command, set_mips_command)
+       (_initialize_mips_tdep): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * maint.c (maintenance_command, maintenance_info_command)
+       (maintenance_check_command, maintenance_print_command)
+       (maintenance_set_cmd, maintenance_show_cmd): Remove.
+       (_initialize_maint_cmds): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       (show_per_command_cmd): Remove.
+       * maint-test-settings.c (maintenance_set_test_settings_cmd):
+       Remove.
+       (maintenance_show_test_settings_cmd): Remove.
+       (_initialize_maint_test_settings): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * maint-test-options.c (maintenance_test_options_command):
+       Remove.
+       (_initialize_maint_test_options): Use add_basic_prefix_cmd.
+       * macrocmd.c (macro_command): Remove
+       (_initialize_macrocmd): Use add_basic_prefix_cmd.
+       * language.c (set_check, show_check): Remove.
+       (_initialize_language): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * infcmd.c (unset_command): Remove.
+       (_initialize_infcmd): Use add_basic_prefix_cmd.
+       * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove.
+       (_initialize_i386_tdep): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * go32-nat.c (go32_info_dos_command): Remove.
+       (_initialize_go32_nat): Use add_basic_prefix_cmd.
+       * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd)
+       (do_show_prefix_cmd, add_show_prefix_cmd): New functions.
+       * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove.
+       (_initialize_frame): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * dcache.c (set_dcache_command, show_dcache_command): Remove.
+       (_initialize_dcache): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * cp-support.c (maint_cplus_command): Remove.
+       (_initialize_cp_support): Use add_basic_prefix_cmd.
+       * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd)
+       (maint_btrace_show_cmd, maint_btrace_pt_set_cmd)
+       (maint_btrace_pt_show_cmd, _initialize_btrace): Use
+       add_basic_prefix_cmd, add_show_prefix_cmd.
+       * breakpoint.c (save_command): Remove.
+       (_initialize_breakpoint): Use add_basic_prefix_cmd.
+       * arm-tdep.c (set_arm_command, show_arm_command): Remove.
+       (_initialize_arm_tdep): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd)
+       (set_ada_command, show_ada_command): Remove.
+       (_initialize_ada_language): Use add_basic_prefix_cmd,
+       add_show_prefix_cmd.
+       * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare.
+
 2020-04-16  Kamil Rytarowski  <n54@gmx.com>
 
        * nbsd-nat.c (inf_ptrace_target::auxv_parse): Remove.
index 029a7912a036d702d7af2f5aa555275b521aac59..49f2280198e1bf92a6987f0e24ff7f026962203c 100644 (file)
@@ -332,23 +332,6 @@ static const char *known_auxiliary_function_name_patterns[] = {
 static struct cmd_list_element *maint_set_ada_cmdlist;
 static struct cmd_list_element *maint_show_ada_cmdlist;
 
-/* Implement the "maintenance set ada" (prefix) command.  */
-
-static void
-maint_set_ada_cmd (const char *args, int from_tty)
-{
-  help_list (maint_set_ada_cmdlist, "maintenance set ada ", all_commands,
-            gdb_stdout);
-}
-
-/* Implement the "maintenance show ada" (prefix) command.  */
-
-static void
-maint_show_ada_cmd (const char *args, int from_tty)
-{
-  cmd_show_list (maint_show_ada_cmdlist, from_tty, "");
-}
-
 /* The "maintenance ada set/show ignore-descriptive-type" value.  */
 
 static bool ada_ignore_descriptive_types_p = false;
@@ -14139,24 +14122,6 @@ extern const struct language_defn ada_language_defn = {
 static struct cmd_list_element *set_ada_list;
 static struct cmd_list_element *show_ada_list;
 
-/* Implement the "set ada" prefix command.  */
-
-static void
-set_ada_command (const char *arg, int from_tty)
-{
-  printf_unfiltered (_(\
-"\"set ada\" must be followed by the name of a setting.\n"));
-  help_list (set_ada_list, "set ada ", all_commands, gdb_stdout);
-}
-
-/* Implement the "show ada" prefix command.  */
-
-static void
-show_ada_command (const char *args, int from_tty)
-{
-  cmd_show_list (show_ada_list, from_tty, "");
-}
-
 static void
 initialize_ada_catchpoint_ops (void)
 {
@@ -14227,13 +14192,13 @@ _initialize_ada_language ()
 {
   initialize_ada_catchpoint_ops ();
 
-  add_prefix_cmd ("ada", no_class, set_ada_command,
-                  _("Prefix command for changing Ada-specific settings."),
-                  &set_ada_list, "set ada ", 0, &setlist);
+  add_basic_prefix_cmd ("ada", no_class,
+                       _("Prefix command for changing Ada-specific settings."),
+                       &set_ada_list, "set ada ", 0, &setlist);
 
-  add_prefix_cmd ("ada", no_class, show_ada_command,
-                  _("Generic command for showing Ada-specific settings."),
-                  &show_ada_list, "show ada ", 0, &showlist);
+  add_show_prefix_cmd ("ada", no_class,
+                      _("Generic command for showing Ada-specific settings."),
+                      &show_ada_list, "show ada ", 0, &showlist);
 
   add_setshow_boolean_cmd ("trust-PAD-over-XVS", class_obscure,
                            &trust_pad_over_xvs, _("\
@@ -14310,15 +14275,15 @@ Usage: info exceptions [REGEXP]\n\
 If a regular expression is passed as an argument, only those matching\n\
 the regular expression are listed."));
 
-  add_prefix_cmd ("ada", class_maintenance, maint_set_ada_cmd,
-                 _("Set Ada maintenance-related variables."),
-                  &maint_set_ada_cmdlist, "maintenance set ada ",
-                  0/*allow-unknown*/, &maintenance_set_cmdlist);
+  add_basic_prefix_cmd ("ada", class_maintenance,
+                       _("Set Ada maintenance-related variables."),
+                       &maint_set_ada_cmdlist, "maintenance set ada ",
+                       0/*allow-unknown*/, &maintenance_set_cmdlist);
 
-  add_prefix_cmd ("ada", class_maintenance, maint_show_ada_cmd,
-                 _("Show Ada maintenance-related variables."),
-                  &maint_show_ada_cmdlist, "maintenance show ada ",
-                  0/*allow-unknown*/, &maintenance_show_cmdlist);
+  add_show_prefix_cmd ("ada", class_maintenance,
+                      _("Show Ada maintenance-related variables."),
+                      &maint_show_ada_cmdlist, "maintenance show ada ",
+                      0/*allow-unknown*/, &maintenance_show_cmdlist);
 
   add_setshow_boolean_cmd
     ("ignore-descriptive-types", class_maintenance,
index 3020099c3351c7bb56142463623c5addf4ce12be..b690e6e24b675b0e1a66bcd0158191cc4ffd851a 100644 (file)
@@ -2111,14 +2111,6 @@ arc_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
   fprintf_unfiltered (file, "arc_dump_tdep: jb_pc = %i\n", tdep->jb_pc);
 }
 
-/* Wrapper for "maintenance print arc" list of commands.  */
-
-static void
-maintenance_print_arc_command (const char *args, int from_tty)
-{
-  cmd_show_list (maintenance_print_arc_list, from_tty, "");
-}
-
 /* This command accepts single argument - address of instruction to
    disassemble.  */
 
@@ -2180,11 +2172,11 @@ _initialize_arc_tdep ()
   /* Register ARC-specific commands with gdb.  */
 
   /* Add root prefix command for "maintenance print arc" commands.  */
-  add_prefix_cmd ("arc", class_maintenance, maintenance_print_arc_command,
-                 _("ARC-specific maintenance commands for printing GDB "
-                   "internal state."),
-                 &maintenance_print_arc_list, "maintenance print arc ", 0,
-                 &maintenanceprintlist);
+  add_show_prefix_cmd ("arc", class_maintenance,
+                      _("ARC-specific maintenance commands for printing GDB "
+                        "internal state."),
+                      &maintenance_print_arc_list, "maintenance print arc ",
+                      0, &maintenanceprintlist);
 
   add_cmd ("arc-instruction", class_maintenance,
           dump_arc_instruction_command,
index 44c439a85f56e3d2d03b07f88b50817863d85622..d881791bf20c45e6b89c9ad0fd0b4e877ed91ccd 100644 (file)
@@ -8325,20 +8325,6 @@ arm_skip_stub (struct frame_info *frame, CORE_ADDR pc)
   return 0;                    /* not a stub */
 }
 
-static void
-set_arm_command (const char *args, int from_tty)
-{
-  printf_unfiltered (_("\
-\"set arm\" must be followed by an apporpriate subcommand.\n"));
-  help_list (setarmcmdlist, "set arm ", all_commands, gdb_stdout);
-}
-
-static void
-show_arm_command (const char *args, int from_tty)
-{
-  cmd_show_list (showarmcmdlist, from_tty, "");
-}
-
 static void
 arm_update_current_architecture (void)
 {
@@ -9517,13 +9503,13 @@ _initialize_arm_tdep ()
                                  arm_elf_osabi_sniffer);
 
   /* Add root prefix command for all "set arm"/"show arm" commands.  */
-  add_prefix_cmd ("arm", no_class, set_arm_command,
-                 _("Various ARM-specific commands."),
-                 &setarmcmdlist, "set arm ", 0, &setlist);
+  add_basic_prefix_cmd ("arm", no_class,
+                       _("Various ARM-specific commands."),
+                       &setarmcmdlist, "set arm ", 0, &setlist);
 
-  add_prefix_cmd ("arm", no_class, show_arm_command,
-                 _("Various ARM-specific commands."),
-                 &showarmcmdlist, "show arm ", 0, &showlist);
+  add_show_prefix_cmd ("arm", no_class,
+                      _("Various ARM-specific commands."),
+                      &showarmcmdlist, "show arm ", 0, &showlist);
 
 
   arm_disassembler_options = xstrdup ("reg-names-std");
index 36ec0d11b4038b0c3b0508d394dbfd25e55bba6a..99bd96b971af98d67f19893fcf13ea059cc9ece0 100644 (file)
@@ -1460,15 +1460,6 @@ automatic loading of Python scripts."),
   return &retval;
 }
 
-/* Command "show auto-load" displays summary of all the current
-   "show auto-load " settings.  */
-
-static void
-show_auto_load_cmd (const char *args, int from_tty)
-{
-  cmd_show_list (*auto_load_show_cmdlist_get (), from_tty, "");
-}
-
 /* Initialize "show auto-load " commands prefix and return it.  */
 
 struct cmd_list_element **
@@ -1477,12 +1468,12 @@ auto_load_show_cmdlist_get (void)
   static struct cmd_list_element *retval;
 
   if (retval == NULL)
-    add_prefix_cmd ("auto-load", class_maintenance, show_auto_load_cmd, _("\
+    add_show_prefix_cmd ("auto-load", class_maintenance, _("\
 Show auto-loading specific settings.\n\
 Show configuration of various auto-load-specific variables such as\n\
 automatic loading of Python scripts."),
-                   &retval, "show auto-load ",
-                   0/*allow-unknown*/, &showlist);
+                        &retval, "show auto-load ",
+                        0/*allow-unknown*/, &showlist);
 
   return &retval;
 }
index e49025461babed20dfa43e60554c799ae9814b6e..89eb29628b1efb63bc3c2941ca747e4254d1d534 100644 (file)
@@ -15118,14 +15118,6 @@ add_catch_command (const char *name, const char *docstring,
   set_cmd_completer (command, completer);
 }
 
-static void
-save_command (const char *arg, int from_tty)
-{
-  printf_unfiltered (_("\"save\" must be followed by "
-                      "the name of a save subcommand.\n"));
-  help_list (save_cmdlist, "save ", all_commands, gdb_stdout);
-}
-
 struct breakpoint *
 iterate_over_breakpoints (gdb::function_view<bool (breakpoint *)> callback)
 {
@@ -15785,10 +15777,10 @@ The trace will end when the tracepoint has been passed 'count' times.\n\
 Usage: passcount COUNT TPNUM, where TPNUM may also be \"all\";\n\
 if TPNUM is omitted, passcount refers to the last tracepoint defined."));
 
-  add_prefix_cmd ("save", class_breakpoint, save_command,
-                 _("Save breakpoint definitions as a script."),
-                 &save_cmdlist, "save ",
-                 0/*allow-unknown*/, &cmdlist);
+  add_basic_prefix_cmd ("save", class_breakpoint,
+                       _("Save breakpoint definitions as a script."),
+                       &save_cmdlist, "save ",
+                       0/*allow-unknown*/, &cmdlist);
 
   c = add_cmd ("breakpoints", class_breakpoint, save_breakpoints_command, _("\
 Save current breakpoint definitions as a script.\n\
index bbf874964973fc17cd9ae2919af4e244b074df9f..9f90d59e2b587b214fe3704eb12cdb721d55a9f9 100644 (file)
@@ -3358,51 +3358,6 @@ maint_btrace_clear_cmd (const char *args, int from_tty)
   btrace_clear (tp);
 }
 
-/* The "maintenance btrace" command.  */
-
-static void
-maint_btrace_cmd (const char *args, int from_tty)
-{
-  help_list (maint_btrace_cmdlist, "maintenance btrace ", all_commands,
-            gdb_stdout);
-}
-
-/* The "maintenance set btrace" command.  */
-
-static void
-maint_btrace_set_cmd (const char *args, int from_tty)
-{
-  help_list (maint_btrace_set_cmdlist, "maintenance set btrace ", all_commands,
-            gdb_stdout);
-}
-
-/* The "maintenance show btrace" command.  */
-
-static void
-maint_btrace_show_cmd (const char *args, int from_tty)
-{
-  help_list (maint_btrace_show_cmdlist, "maintenance show btrace ",
-            all_commands, gdb_stdout);
-}
-
-/* The "maintenance set btrace pt" command.  */
-
-static void
-maint_btrace_pt_set_cmd (const char *args, int from_tty)
-{
-  help_list (maint_btrace_pt_set_cmdlist, "maintenance set btrace pt ",
-            all_commands, gdb_stdout);
-}
-
-/* The "maintenance show btrace pt" command.  */
-
-static void
-maint_btrace_pt_show_cmd (const char *args, int from_tty)
-{
-  help_list (maint_btrace_pt_show_cmdlist, "maintenance show btrace pt ",
-            all_commands, gdb_stdout);
-}
-
 /* The "maintenance info btrace" command.  */
 
 static void
@@ -3478,30 +3433,32 @@ _initialize_btrace ()
   add_cmd ("btrace", class_maintenance, maint_info_btrace_cmd,
           _("Info about branch tracing data."), &maintenanceinfolist);
 
-  add_prefix_cmd ("btrace", class_maintenance, maint_btrace_cmd,
-                 _("Branch tracing maintenance commands."),
-                 &maint_btrace_cmdlist, "maintenance btrace ",
-                 0, &maintenancelist);
+  add_basic_prefix_cmd ("btrace", class_maintenance,
+                       _("Branch tracing maintenance commands."),
+                       &maint_btrace_cmdlist, "maintenance btrace ",
+                       0, &maintenancelist);
 
-  add_prefix_cmd ("btrace", class_maintenance, maint_btrace_set_cmd, _("\
+  add_basic_prefix_cmd ("btrace", class_maintenance, _("\
 Set branch tracing specific variables."),
-                  &maint_btrace_set_cmdlist, "maintenance set btrace ",
-                  0, &maintenance_set_cmdlist);
+                       &maint_btrace_set_cmdlist, "maintenance set btrace ",
+                       0, &maintenance_set_cmdlist);
 
-  add_prefix_cmd ("pt", class_maintenance, maint_btrace_pt_set_cmd, _("\
+  add_basic_prefix_cmd ("pt", class_maintenance, _("\
 Set Intel Processor Trace specific variables."),
-                  &maint_btrace_pt_set_cmdlist, "maintenance set btrace pt ",
-                  0, &maint_btrace_set_cmdlist);
+                       &maint_btrace_pt_set_cmdlist,
+                       "maintenance set btrace pt ",
+                       0, &maint_btrace_set_cmdlist);
 
-  add_prefix_cmd ("btrace", class_maintenance, maint_btrace_show_cmd, _("\
+  add_show_prefix_cmd ("btrace", class_maintenance, _("\
 Show branch tracing specific variables."),
-                  &maint_btrace_show_cmdlist, "maintenance show btrace ",
-                  0, &maintenance_show_cmdlist);
+                      &maint_btrace_show_cmdlist, "maintenance show btrace ",
+                      0, &maintenance_show_cmdlist);
 
-  add_prefix_cmd ("pt", class_maintenance, maint_btrace_pt_show_cmd, _("\
+  add_show_prefix_cmd ("pt", class_maintenance, _("\
 Show Intel Processor Trace specific variables."),
-                  &maint_btrace_pt_show_cmdlist, "maintenance show btrace pt ",
-                  0, &maint_btrace_show_cmdlist);
+                      &maint_btrace_pt_show_cmdlist,
+                      "maintenance show btrace pt ",
+                      0, &maint_btrace_show_cmdlist);
 
   add_setshow_boolean_cmd ("skip-pad", class_maintenance,
                           &maint_btrace_pt_skip_pad, _("\
index 6f324410e169bbaca5a3cc447248d0def950d2ee..f7178510878b2abb1894c15a1a2b745a89aa311a 100644 (file)
@@ -191,26 +191,6 @@ error_no_arg (const char *why)
   error (_("Argument required (%s)."), why);
 }
 
-/* The "info" command is defined as a prefix, with allow_unknown = 0.
-   Therefore, its own definition is called only for "info" with no
-   args.  */
-
-static void
-info_command (const char *arg, int from_tty)
-{
-  printf_unfiltered (_("\"info\" must be followed by "
-                      "the name of an info command.\n"));
-  help_list (infolist, "info ", all_commands, gdb_stdout);
-}
-
-/* The "show" command with no arguments shows all the settings.  */
-
-static void
-show_command (const char *arg, int from_tty)
-{
-  cmd_show_list (showlist, from_tty, "");
-}
-
 /* See cli/cli-cmds.h.  */
 
 void
@@ -1852,20 +1832,6 @@ filter_sals (std::vector<symtab_and_line> &sals)
   sals.erase (from, sals.end ());
 }
 
-static void
-set_debug (const char *arg, int from_tty)
-{
-  printf_unfiltered (_("\"set debug\" must be followed by "
-                      "the name of a debug subcommand.\n"));
-  help_list (setdebuglist, "set debug ", all_commands, gdb_stdout);
-}
-
-static void
-show_debug (const char *args, int from_tty)
-{
-  cmd_show_list (showdebuglist, from_tty, "");
-}
-
 void
 init_cmd_lists (void)
 {
@@ -2208,12 +2174,12 @@ Show verbosity."), NULL,
                           show_info_verbose,
                           &setlist, &showlist);
 
-  add_prefix_cmd ("history", class_support, set_history,
-                 _("Generic command for setting command history parameters."),
-                 &sethistlist, "set history ", 0, &setlist);
-  add_prefix_cmd ("history", class_support, show_history,
-                 _("Generic command for showing command history parameters."),
-                 &showhistlist, "show history ", 0, &showlist);
+  add_basic_prefix_cmd ("history", class_support, _("\
+Generic command for setting command history parameters."),
+                       &sethistlist, "set history ", 0, &setlist);
+  add_show_prefix_cmd ("history", class_support, _("\
+Generic command for showing command history parameters."),
+                      &showhistlist, "show history ", 0, &showlist);
 
   add_setshow_boolean_cmd ("expansion", no_class, &history_expansion_p, _("\
 Set history expansion on command input."), _("\
@@ -2223,20 +2189,21 @@ Without an argument, history expansion is enabled."),
                           show_history_expansion_p,
                           &sethistlist, &showhistlist);
 
-  add_prefix_cmd ("info", class_info, info_command, _("\
+  add_basic_prefix_cmd ("info", class_info, _("\
 Generic command for showing things about the program being debugged."),
-                 &infolist, "info ", 0, &cmdlist);
+                       &infolist, "info ", 0, &cmdlist);
   add_com_alias ("i", "info", class_info, 1);
   add_com_alias ("inf", "info", class_info, 1);
 
   add_com ("complete", class_obscure, complete_command,
           _("List the completions for the rest of the line as a command."));
 
-  add_prefix_cmd ("show", class_info, show_command, _("\
+  add_show_prefix_cmd ("show", class_info, _("\
 Generic command for showing things about the debugger."),
-                 &showlist, "show ", 0, &cmdlist);
+                      &showlist, "show ", 0, &cmdlist);
   /* Another way to get at the same thing.  */
-  add_info ("set", show_command, _("Show all GDB settings."));
+  add_show_prefix_cmd ("set", class_info, _("Show all GDB settings."),
+                      &showlist, "info set ", 0, &infolist);
 
   c = add_com ("with", class_vars, with_command, _("\
 Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING.\n\
@@ -2324,13 +2291,13 @@ from the target."),
                                       show_remote_timeout,
                                       &setlist, &showlist);
 
-  add_prefix_cmd ("debug", no_class, set_debug,
-                 _("Generic command for setting gdb debugging flags."),
-                 &setdebuglist, "set debug ", 0, &setlist);
+  add_basic_prefix_cmd ("debug", no_class,
+                       _("Generic command for setting gdb debugging flags."),
+                       &setdebuglist, "set debug ", 0, &setlist);
 
-  add_prefix_cmd ("debug", no_class, show_debug,
-                 _("Generic command for showing gdb debugging flags."),
-                 &showdebuglist, "show debug ", 0, &showlist);
+  add_show_prefix_cmd ("debug", no_class,
+                      _("Generic command for showing gdb debugging flags."),
+                      &showdebuglist, "show debug ", 0, &showlist);
 
   c = add_com ("shell", class_support, shell_command, _("\
 Execute the rest of the line as a shell command.\n\
index 7aecd9897e2deb8603d8ae5a27fb5dbfa44bf208..17f49ec80e49f368afd24a1f0ddb03f2bb28da9a 100644 (file)
@@ -380,6 +380,58 @@ add_prefix_cmd (const char *name, enum command_class theclass,
   return c;
 }
 
+/* A helper function for add_basic_prefix_cmd.  This is a command
+   function that just forwards to help_list.  */
+
+static void
+do_prefix_cmd (const char *args, int from_tty, struct cmd_list_element *c)
+{
+  /* Look past all aliases.  */
+  while (c->cmd_pointer != nullptr)
+    c = c->cmd_pointer;
+
+  help_list (*c->prefixlist, c->prefixname, all_commands, gdb_stdout);
+}
+
+/* See command.h.  */
+
+struct cmd_list_element *
+add_basic_prefix_cmd (const char *name, enum command_class theclass,
+                     const char *doc, struct cmd_list_element **prefixlist,
+                     const char *prefixname, int allow_unknown,
+                     struct cmd_list_element **list)
+{
+  struct cmd_list_element *cmd = add_prefix_cmd (name, theclass, nullptr,
+                                                doc, prefixlist, prefixname,
+                                                allow_unknown, list);
+  set_cmd_sfunc (cmd, do_prefix_cmd);
+  return cmd;
+}
+
+/* A helper function for add_show_prefix_cmd.  This is a command
+   function that just forwards to cmd_show_list.  */
+
+static void
+do_show_prefix_cmd (const char *args, int from_tty, struct cmd_list_element *c)
+{
+  cmd_show_list (*c->prefixlist, from_tty, "");
+}
+
+/* See command.h.  */
+
+struct cmd_list_element *
+add_show_prefix_cmd (const char *name, enum command_class theclass,
+                    const char *doc, struct cmd_list_element **prefixlist,
+                    const char *prefixname, int allow_unknown,
+                    struct cmd_list_element **list)
+{
+  struct cmd_list_element *cmd = add_prefix_cmd (name, theclass, nullptr,
+                                                doc, prefixlist, prefixname,
+                                                allow_unknown, list);
+  set_cmd_sfunc (cmd, do_show_prefix_cmd);
+  return cmd;
+}
+
 /* Like ADD_PREFIX_CMD but sets the suppress_notification pointer on the
    new command list element.  */
 
index ae047ac75de8187483829a52923da61aaec775fe..567ef2eeded00002a902221b38226a23e2364004 100644 (file)
@@ -128,20 +128,6 @@ static struct cmd_list_element *tekhex_cmdlist;
 static struct cmd_list_element *binary_dump_cmdlist;
 static struct cmd_list_element *binary_append_cmdlist;
 
-static void
-dump_command (const char *cmd, int from_tty)
-{
-  printf_unfiltered (_("\"dump\" must be followed by a subcommand.\n\n"));
-  help_list (dump_cmdlist, "dump ", all_commands, gdb_stdout);
-}
-
-static void
-append_command (const char *cmd, int from_tty)
-{
-  printf_unfiltered (_("\"append\" must be followed by a subcommand.\n\n"));
-  help_list (dump_cmdlist, "append ", all_commands, gdb_stdout);
-}
-
 static void
 dump_binary_file (const char *filename, const char *mode, 
                  const bfd_byte *buf, ULONGEST len)
@@ -579,65 +565,22 @@ restore_command (const char *args, int from_tty)
     }
 }
 
-static void
-srec_dump_command (const char *cmd, int from_tty)
-{
-  printf_unfiltered (_("\"dump srec\" must be followed by a subcommand.\n"));
-  help_list (srec_cmdlist, "dump srec ", all_commands, gdb_stdout);
-}
-
-static void
-ihex_dump_command (const char *cmd, int from_tty)
-{
-  printf_unfiltered (_("\"dump ihex\" must be followed by a subcommand.\n"));
-  help_list (ihex_cmdlist, "dump ihex ", all_commands, gdb_stdout);
-}
-
-static void
-verilog_dump_command (const char *cmd, int from_tty)
-{
-  printf_unfiltered (_("\"dump verilog\" must be followed by a subcommand.\n"));
-  help_list (verilog_cmdlist, "dump verilog ", all_commands, gdb_stdout);
-}
-
-static void
-tekhex_dump_command (const char *cmd, int from_tty)
-{
-  printf_unfiltered (_("\"dump tekhex\" must be followed by a subcommand.\n"));
-  help_list (tekhex_cmdlist, "dump tekhex ", all_commands, gdb_stdout);
-}
-
-static void
-binary_dump_command (const char *cmd, int from_tty)
-{
-  printf_unfiltered (_("\"dump binary\" must be followed by a subcommand.\n"));
-  help_list (binary_dump_cmdlist, "dump binary ", all_commands, gdb_stdout);
-}
-
-static void
-binary_append_command (const char *cmd, int from_tty)
-{
-  printf_unfiltered (_("\"append binary\" must be followed by a subcommand.\n"));
-  help_list (binary_append_cmdlist, "append binary ", all_commands,
-            gdb_stdout);
-}
-
 void _initialize_cli_dump ();
 void
 _initialize_cli_dump ()
 {
   struct cmd_list_element *c;
 
-  add_prefix_cmd ("dump", class_vars, dump_command,
-                 _("Dump target code/data to a local file."),
-                 &dump_cmdlist, "dump ",
-                 0/*allow-unknown*/,
-                 &cmdlist);
-  add_prefix_cmd ("append", class_vars, append_command,
-                 _("Append target code/data to a local file."),
-                 &append_cmdlist, "append ",
-                 0/*allow-unknown*/,
-                 &cmdlist);
+  add_basic_prefix_cmd ("dump", class_vars,
+                       _("Dump target code/data to a local file."),
+                       &dump_cmdlist, "dump ",
+                       0/*allow-unknown*/,
+                       &cmdlist);
+  add_basic_prefix_cmd ("append", class_vars,
+                       _("Append target code/data to a local file."),
+                       &append_cmdlist, "append ",
+                       0/*allow-unknown*/,
+                       &cmdlist);
 
   add_dump_command ("memory", dump_memory_command, "\
 Write contents of memory to a raw binary file.\n\
@@ -649,41 +592,41 @@ Write the value of an expression to a raw binary file.\n\
 Arguments are FILE EXPRESSION.  Writes the value of EXPRESSION to\n\
 the specified FILE in raw target ordered bytes.");
 
-  add_prefix_cmd ("srec", all_commands, srec_dump_command,
-                 _("Write target code/data to an srec file."),
-                 &srec_cmdlist, "dump srec ", 
-                 0 /*allow-unknown*/, 
-                 &dump_cmdlist);
-
-  add_prefix_cmd ("ihex", all_commands, ihex_dump_command,
-                 _("Write target code/data to an intel hex file."),
-                 &ihex_cmdlist, "dump ihex ", 
-                 0 /*allow-unknown*/, 
-                 &dump_cmdlist);
-
-  add_prefix_cmd ("verilog", all_commands, verilog_dump_command,
-                 _("Write target code/data to a verilog hex file."),
-                 &verilog_cmdlist, "dump verilog ",
-                 0 /*allow-unknown*/,
-                 &dump_cmdlist);
-
-  add_prefix_cmd ("tekhex", all_commands, tekhex_dump_command,
-                 _("Write target code/data to a tekhex file."),
-                 &tekhex_cmdlist, "dump tekhex ", 
-                 0 /*allow-unknown*/, 
-                 &dump_cmdlist);
-
-  add_prefix_cmd ("binary", all_commands, binary_dump_command,
-                 _("Write target code/data to a raw binary file."),
-                 &binary_dump_cmdlist, "dump binary ", 
-                 0 /*allow-unknown*/, 
-                 &dump_cmdlist);
-
-  add_prefix_cmd ("binary", all_commands, binary_append_command,
-                 _("Append target code/data to a raw binary file."),
-                 &binary_append_cmdlist, "append binary ", 
-                 0 /*allow-unknown*/, 
-                 &append_cmdlist);
+  add_basic_prefix_cmd ("srec", all_commands,
+                       _("Write target code/data to an srec file."),
+                       &srec_cmdlist, "dump srec ", 
+                       0 /*allow-unknown*/, 
+                       &dump_cmdlist);
+
+  add_basic_prefix_cmd ("ihex", all_commands,
+                       _("Write target code/data to an intel hex file."),
+                       &ihex_cmdlist, "dump ihex ", 
+                       0 /*allow-unknown*/, 
+                       &dump_cmdlist);
+
+  add_basic_prefix_cmd ("verilog", all_commands,
+                       _("Write target code/data to a verilog hex file."),
+                       &verilog_cmdlist, "dump verilog ",
+                       0 /*allow-unknown*/,
+                       &dump_cmdlist);
+
+  add_basic_prefix_cmd ("tekhex", all_commands,
+                       _("Write target code/data to a tekhex file."),
+                       &tekhex_cmdlist, "dump tekhex ", 
+                       0 /*allow-unknown*/, 
+                       &dump_cmdlist);
+
+  add_basic_prefix_cmd ("binary", all_commands,
+                       _("Write target code/data to a raw binary file."),
+                       &binary_dump_cmdlist, "dump binary ", 
+                       0 /*allow-unknown*/, 
+                       &dump_cmdlist);
+
+  add_basic_prefix_cmd ("binary", all_commands,
+                       _("Append target code/data to a raw binary file."),
+                       &binary_append_cmdlist, "append binary ", 
+                       0 /*allow-unknown*/, 
+                       &append_cmdlist);
 
   add_cmd ("memory", all_commands, dump_srec_memory, _("\
 Write contents of memory to an srec file.\n\
index d2d9928acd5c1f01744f404e067fd282806f4c6b..a0c3cc518015ae1dc18346819c68b281888bfa23 100644 (file)
@@ -215,20 +215,16 @@ void
 cli_style_option::add_setshow_commands (enum command_class theclass,
                                        const char *prefix_doc,
                                        struct cmd_list_element **set_list,
-                                       void (*do_set) (const char *args,
-                                                       int from_tty),
                                        struct cmd_list_element **show_list,
-                                       void (*do_show) (const char *args,
-                                                        int from_tty),
                                        bool skip_intensity)
 {
   m_set_prefix = std::string ("set style ") + m_name + " ";
   m_show_prefix = std::string ("show style ") + m_name + " ";
 
-  add_prefix_cmd (m_name, no_class, do_set, prefix_doc, &m_set_list,
-                 m_set_prefix.c_str (), 0, set_list);
-  add_prefix_cmd (m_name, no_class, do_show, prefix_doc, &m_show_list,
-                 m_show_prefix.c_str (), 0, show_list);
+  add_basic_prefix_cmd (m_name, no_class, prefix_doc, &m_set_list,
+                       m_set_prefix.c_str (), 0, set_list);
+  add_show_prefix_cmd (m_name, no_class, prefix_doc, &m_show_list,
+                      m_show_prefix.c_str (), 0, show_list);
 
   add_setshow_enum_cmd ("foreground", theclass, cli_colors,
                        &m_foreground,
@@ -260,20 +256,6 @@ cli_style_option::add_setshow_commands (enum command_class theclass,
 static cmd_list_element *style_set_list;
 static cmd_list_element *style_show_list;
 
-static void
-set_style (const char *arg, int from_tty)
-{
-  printf_unfiltered (_("\"set style\" must be followed "
-                      "by an appropriate subcommand.\n"));
-  help_list (style_set_list, "set style ", all_commands, gdb_stdout);
-}
-
-static void
-show_style (const char *arg, int from_tty)
-{
-  cmd_show_list (style_show_list, from_tty, "");
-}
-
 static void
 set_style_enabled  (const char *args, int from_tty, struct cmd_list_element *c)
 {
@@ -301,27 +283,15 @@ show_style_sources (struct ui_file *file, int from_tty,
     fprintf_filtered (file, _("Source code styling is disabled.\n"));
 }
 
-/* Builds the "set style NAME " prefix.  */
-
-static std::string
-set_style_name (const char *name)
-{
-  std::string result ("set style ");
-
-  result += name;
-  result += " ";
-  return result;
-}
-
 void _initialize_cli_style ();
 void
 _initialize_cli_style ()
 {
-  add_prefix_cmd ("style", no_class, set_style, _("\
+  add_basic_prefix_cmd ("style", no_class, _("\
 Style-specific settings.\n\
 Configure various style-related variables, such as colors"),
                  &style_set_list, "set style ", 0, &setlist);
-  add_prefix_cmd ("style", no_class, show_style, _("\
+  add_show_prefix_cmd ("style", no_class, _("\
 Style-specific settings.\n\
 Configure various style-related variables, such as colors"),
                  &style_show_list, "show style ", 0, &showlist);
@@ -348,78 +318,68 @@ available if the appropriate extension is available at runtime."
                           ), set_style_enabled, show_style_sources,
                           &style_set_list, &style_show_list);
 
-#define STYLE_ADD_SETSHOW_COMMANDS(STYLE, PREFIX_DOC, SKIP)            \
-  STYLE.add_setshow_commands (no_class, PREFIX_DOC,            \
-                             &style_set_list,                          \
-                             [] (const char *args, int from_tty)       \
-                             {                                         \
-                               help_list                               \
-                                 (STYLE.set_list (),                   \
-                                  set_style_name (STYLE.name ()).c_str (), \
-                                  all_commands,                        \
-                                  gdb_stdout);                         \
-                             },                                        \
-                             &style_show_list,                         \
-                             [] (const char *args, int from_tty)       \
-                             {                                         \
-                               cmd_show_list                           \
-                                 (STYLE.show_list (),                  \
-                                  from_tty,                            \
-                                  "");                                 \
-                             }, SKIP)
-
-  STYLE_ADD_SETSHOW_COMMANDS (file_name_style,
-                             _("\
+  file_name_style.add_setshow_commands (no_class, _("\
 Filename display styling.\n\
-Configure filename colors and display intensity."), false);
+Configure filename colors and display intensity."),
+                                       &style_set_list, &style_show_list,
+                                       false);
 
-  STYLE_ADD_SETSHOW_COMMANDS (function_name_style,
-                             _("\
+  function_name_style.add_setshow_commands (no_class, _("\
 Function name display styling.\n\
-Configure function name colors and display intensity"), false);
+Configure function name colors and display intensity"),
+                                           &style_set_list, &style_show_list,
+                                           false);
 
-  STYLE_ADD_SETSHOW_COMMANDS (variable_name_style,
-                             _("\
+  variable_name_style.add_setshow_commands (no_class, _("\
 Variable name display styling.\n\
-Configure variable name colors and display intensity"), false);
+Configure variable name colors and display intensity"),
+                                           &style_set_list, &style_show_list,
+                                           false);
 
-  STYLE_ADD_SETSHOW_COMMANDS (address_style,
-                             _("\
+  address_style.add_setshow_commands (no_class, _("\
 Address display styling.\n\
-Configure address colors and display intensity"), false);
+Configure address colors and display intensity"),
+                                     &style_set_list, &style_show_list,
+                                     false);
 
-  STYLE_ADD_SETSHOW_COMMANDS (title_style,
-                             _("\
+  title_style.add_setshow_commands (no_class, _("\
 Title display styling.\n\
 Configure title colors and display intensity\n\
 Some commands (such as \"apropos -v REGEXP\") use the title style to improve\n\
-readability."), false);
+readability."),
+                                   &style_set_list, &style_show_list,
+                                   false);
 
-  STYLE_ADD_SETSHOW_COMMANDS (highlight_style,
-                             _("\
+  highlight_style.add_setshow_commands (no_class, _("\
 Highlight display styling.\n\
 Configure highlight colors and display intensity\n\
 Some commands use the highlight style to draw the attention to a part\n\
-of their output."), false);
+of their output."),
+                                       &style_set_list, &style_show_list,
+                                       false);
 
-  STYLE_ADD_SETSHOW_COMMANDS (metadata_style,
-                             _("\
+  metadata_style.add_setshow_commands (no_class, _("\
 Metadata display styling.\n\
 Configure metadata colors and display intensity\n\
 The \"metadata\" style is used when GDB displays information about\n\
-your data, for example \"<unavailable>\""), false);
+your data, for example \"<unavailable>\""),
+                                      &style_set_list, &style_show_list,
+                                      false);
 
-  STYLE_ADD_SETSHOW_COMMANDS (tui_border_style,
-                             _("\
+  tui_border_style.add_setshow_commands (no_class, _("\
 TUI border display styling.\n\
 Configure TUI border colors\n\
 The \"tui-border\" style is used when GDB displays the border of a\n\
-TUI window that does not have the focus."), true);
+TUI window that does not have the focus."),
+                                        &style_set_list, &style_show_list,
+                                        true);
 
-  STYLE_ADD_SETSHOW_COMMANDS (tui_active_border_style,
-                             _("\
+  tui_active_border_style.add_setshow_commands (no_class, _("\
 TUI active border display styling.\n\
 Configure TUI active border colors\n\
 The \"tui-active-border\" style is used when GDB displays the border of a\n\
-TUI window that does have the focus."), true);
+TUI window that does have the focus."),
+                                               &style_set_list,
+                                               &style_show_list,
+                                               true);
 }
index 04009aa36151720e558fccf0281a779f66671c01..6422e5296a3507289137bcc1a712cc22b903e204 100644 (file)
@@ -46,9 +46,7 @@ public:
   void add_setshow_commands (enum command_class theclass,
                             const char *prefix_doc,
                             struct cmd_list_element **set_list,
-                            void (*do_set) (const char *args, int from_tty),
                             struct cmd_list_element **show_list,
-                            void (*do_show) (const char *args, int from_tty),
                             bool skip_intensity);
 
   /* Return the 'set style NAME' command list, that can be used
index 7f436c72c9809fc58d5055a2db0bfab94f21016f..b9b94227b9fd325611523ce964833bfa4d035df1 100644 (file)
@@ -179,6 +179,20 @@ extern struct cmd_list_element *add_prefix_cmd (const char *, enum command_class
                                                const char *, int,
                                                struct cmd_list_element **);
 
+/* Like add_prefix_cmd, but sets the callback to a function that
+   simply calls help_list.  */
+
+extern struct cmd_list_element *add_basic_prefix_cmd
+  (const char *, enum command_class, const char *, struct cmd_list_element **,
+   const char *, int, struct cmd_list_element **);
+
+/* Like add_prefix_cmd, but useful for "show" prefixes.  This sets the
+   callback to a function that simply calls cmd_show_list.  */
+
+extern struct cmd_list_element *add_show_prefix_cmd
+  (const char *, enum command_class, const char *, struct cmd_list_element **,
+   const char *, int, struct cmd_list_element **);
+
 extern struct cmd_list_element *add_prefix_cmd_suppress_notification
                        (const char *name, enum command_class theclass,
                         cmd_const_cfunc_ftype *fun,
index 91e7d2ddc686415dbbebf6e9ffcf18de1ffa704b..6601272e717ccfd53269c945543ad60ab0044a14 100644 (file)
@@ -2118,18 +2118,6 @@ test_cp_remove_params ()
 
 #endif /* GDB_SELF_CHECK */
 
-/* Don't allow just "maintenance cplus".  */
-
-static  void
-maint_cplus_command (const char *arg, int from_tty)
-{
-  printf_unfiltered (_("\"maintenance cplus\" must be followed "
-                      "by the name of a command.\n"));
-  help_list (maint_cplus_cmd_list,
-            "maintenance cplus ",
-            all_commands, gdb_stdout);
-}
-
 /* This is a front end for cp_find_first_component, for unit testing.
    Be careful when using it: see the NOTE above
    cp_find_first_component.  */
@@ -2167,12 +2155,11 @@ void _initialize_cp_support ();
 void
 _initialize_cp_support ()
 {
-  add_prefix_cmd ("cplus", class_maintenance,
-                 maint_cplus_command,
-                 _("C++ maintenance commands."),
-                 &maint_cplus_cmd_list,
-                 "maintenance cplus ",
-                 0, &maintenancelist);
+  add_basic_prefix_cmd ("cplus", class_maintenance,
+                       _("C++ maintenance commands."),
+                       &maint_cplus_cmd_list,
+                       "maintenance cplus ",
+                       0, &maintenancelist);
   add_alias_cmd ("cp", "cplus",
                 class_maintenance, 1,
                 &maintenancelist);
index f018882bf95db897cedf527a4d4590edbf045f53..c0c26998c9538ab95965a73b1ef6347e2af7fc70 100644 (file)
@@ -670,20 +670,6 @@ set_dcache_line_size (const char *args, int from_tty,
   target_dcache_invalidate ();
 }
 
-static void
-set_dcache_command (const char *arg, int from_tty)
-{
-  printf_unfiltered (
-     "\"set dcache\" must be followed by the name of a subcommand.\n");
-  help_list (dcache_set_list, "set dcache ", all_commands, gdb_stdout);
-}
-
-static void
-show_dcache_command (const char *args, int from_tty)
-{
-  cmd_show_list (dcache_show_list, from_tty, "");
-}
-
 void _initialize_dcache ();
 void
 _initialize_dcache ()
@@ -708,12 +694,14 @@ 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_prefix_cmd ("dcache", class_obscure, set_dcache_command, _("\
+  add_basic_prefix_cmd ("dcache", class_obscure, _("\
 Use this command to set number of lines in dcache and line-size."),
-                 &dcache_set_list, "set dcache ", /*allow_unknown*/0, &setlist);
-  add_prefix_cmd ("dcache", class_obscure, show_dcache_command, _("\
+                       &dcache_set_list, "set dcache ", /*allow_unknown*/0,
+                       &setlist);
+  add_show_prefix_cmd ("dcache", class_obscure, _("\
 Show dcachesettings."),
-                 &dcache_show_list, "show dcache ", /*allow_unknown*/0, &showlist);
+                      &dcache_show_list, "show dcache ", /*allow_unknown*/0,
+                      &showlist);
 
   add_setshow_zuinteger_cmd ("line-size", class_obscure,
                             &dcache_line_size, _("\
index 4910c9b6fc7ca0952133baa9e37b628b52aba0eb..9cc0e1b59ed50f152abe18da9ecd9f033bf00e59 100644 (file)
@@ -23481,19 +23481,6 @@ partial_die_eq (const void *item_lhs, const void *item_rhs)
 struct cmd_list_element *set_dwarf_cmdlist;
 struct cmd_list_element *show_dwarf_cmdlist;
 
-static void
-set_dwarf_cmd (const char *args, int from_tty)
-{
-  help_list (set_dwarf_cmdlist, "maintenance set dwarf ", all_commands,
-            gdb_stdout);
-}
-
-static void
-show_dwarf_cmd (const char *args, int from_tty)
-{
-  cmd_show_list (show_dwarf_cmdlist, from_tty, "");
-}
-
 static void
 show_check_physname (struct ui_file *file, int from_tty,
                     struct cmd_list_element *c, const char *value)
@@ -23507,17 +23494,17 @@ void _initialize_dwarf2_read ();
 void
 _initialize_dwarf2_read ()
 {
-  add_prefix_cmd ("dwarf", class_maintenance, set_dwarf_cmd, _("\
+  add_basic_prefix_cmd ("dwarf", class_maintenance, _("\
 Set DWARF specific variables.\n\
 Configure DWARF variables such as the cache size."),
-                  &set_dwarf_cmdlist, "maintenance set dwarf ",
-                  0/*allow-unknown*/, &maintenance_set_cmdlist);
+                       &set_dwarf_cmdlist, "maintenance set dwarf ",
+                       0/*allow-unknown*/, &maintenance_set_cmdlist);
 
-  add_prefix_cmd ("dwarf", class_maintenance, show_dwarf_cmd, _("\
+  add_show_prefix_cmd ("dwarf", class_maintenance, _("\
 Show DWARF specific variables.\n\
 Show DWARF variables such as the cache size."),
-                  &show_dwarf_cmdlist, "maintenance show dwarf ",
-                  0/*allow-unknown*/, &maintenance_show_cmdlist);
+                      &show_dwarf_cmdlist, "maintenance show dwarf ",
+                      0/*allow-unknown*/, &maintenance_show_cmdlist);
 
   add_setshow_zinteger_cmd ("max-cache-age", class_obscure,
                            &dwarf_max_cache_age, _("\
index d74d1d5c7c5d57c1e455ad379415873fe25447c0..ac1016b083fc17a51373d51b875cb03bf5bc2b56 100644 (file)
@@ -2913,19 +2913,6 @@ frame_prepare_for_sniffer (struct frame_info *frame,
 static struct cmd_list_element *set_backtrace_cmdlist;
 static struct cmd_list_element *show_backtrace_cmdlist;
 
-static void
-set_backtrace_cmd (const char *args, int from_tty)
-{
-  help_list (set_backtrace_cmdlist, "set backtrace ", all_commands,
-            gdb_stdout);
-}
-
-static void
-show_backtrace_cmd (const char *args, int from_tty)
-{
-  cmd_show_list (show_backtrace_cmdlist, from_tty, "");
-}
-
 /* Definition of the "set backtrace" settings that are exposed as
    "backtrace" command options.  */
 
@@ -2969,16 +2956,16 @@ _initialize_frame ()
 
   gdb::observers::target_changed.attach (frame_observer_target_changed);
 
-  add_prefix_cmd ("backtrace", class_maintenance, set_backtrace_cmd, _("\
+  add_basic_prefix_cmd ("backtrace", class_maintenance, _("\
 Set backtrace specific variables.\n\
 Configure backtrace variables such as the backtrace limit"),
-                 &set_backtrace_cmdlist, "set backtrace ",
-                 0/*allow-unknown*/, &setlist);
-  add_prefix_cmd ("backtrace", class_maintenance, show_backtrace_cmd, _("\
+                       &set_backtrace_cmdlist, "set backtrace ",
+                       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, "show backtrace ",
-                 0/*allow-unknown*/, &showlist);
+                      &show_backtrace_cmdlist, "show backtrace ",
+                      0/*allow-unknown*/, &showlist);
 
   add_setshow_uinteger_cmd ("limit", class_obscure,
                            &user_set_backtrace_options.backtrace_limit, _("\
index b3ebd6cf22956c3ff7df27194a441d3edb643ed8..881decf078904c6eee60b180d455249159e573d4 100644 (file)
@@ -2075,12 +2075,6 @@ go32_pte_for_address (const char *arg, int from_tty)
 
 static struct cmd_list_element *info_dos_cmdlist = NULL;
 
-static void
-go32_info_dos_command (const char *args, int from_tty)
-{
-  help_list (info_dos_cmdlist, "info dos ", class_info, gdb_stdout);
-}
-
 void _initialize_go32_nat ();
 void
 _initialize_go32_nat ()
@@ -2107,9 +2101,9 @@ _initialize_go32_nat ()
   /* We are always processing GCC-compiled programs.  */
   processing_gcc_compilation = 2;
 
-  add_prefix_cmd ("dos", class_info, go32_info_dos_command, _("\
+  add_basic_prefix_cmd ("dos", class_info, _("\
 Print information specific to DJGPP (aka MS-DOS) debugging."),
-                 &info_dos_cmdlist, "info dos ", 0, &infolist);
+                       &info_dos_cmdlist, "info dos ", 0, &infolist);
 
   add_cmd ("sysinfo", class_info, go32_sysinfo, _("\
 Display information about the target system, including CPU, OS, DPMI, etc."),
index 4b0103c93464b784dc16023fd6492670524ec3fb..2b82f82820fe3612451214f1c1b5f6c625a55d56 100644 (file)
@@ -396,33 +396,6 @@ static struct cmd_list_element *set_guile_list;
 static struct cmd_list_element *show_guile_list;
 static struct cmd_list_element *info_guile_list;
 
-/* Function for use by 'set guile' prefix command.  */
-
-static void
-set_guile_command (const char *args, int from_tty)
-{
-  help_list (set_guile_list, "set guile ", all_commands, gdb_stdout);
-}
-
-/* Function for use by 'show guile' prefix command.  */
-
-static void
-show_guile_command (const char *args, int from_tty)
-{
-  cmd_show_list (show_guile_list, from_tty, "");
-}
-
-/* The "info scheme" command is defined as a prefix, with
-   allow_unknown 0.  Therefore, its own definition is called only for
-   "info scheme" with no args.  */
-
-static void
-info_guile_command (const char *args, int from_tty)
-{
-  printf_unfiltered (_("\"info guile\" must be followed"
-                      " by the name of an info command.\n"));
-  help_list (info_guile_list, "info guile ", all_commands, gdb_stdout);
-}
 \f
 /* Initialization.  */
 
@@ -761,22 +734,22 @@ This command is only a placeholder.")
           );
   add_com_alias ("gu", "guile", class_obscure, 1);
 
-  add_prefix_cmd ("guile", class_obscure, set_guile_command,
-                 _("Prefix command for Guile preference settings."),
-                 &set_guile_list, "set guile ", 0,
-                 &setlist);
+  add_basic_prefix_cmd ("guile", class_obscure,
+                       _("Prefix command for Guile preference settings."),
+                       &set_guile_list, "set guile ", 0,
+                       &setlist);
   add_alias_cmd ("gu", "guile", class_obscure, 1, &setlist);
 
-  add_prefix_cmd ("guile", class_obscure, show_guile_command,
-                 _("Prefix command for Guile preference settings."),
-                 &show_guile_list, "show guile ", 0,
-                 &showlist);
+  add_show_prefix_cmd ("guile", class_obscure,
+                      _("Prefix command for Guile preference settings."),
+                      &show_guile_list, "show guile ", 0,
+                      &showlist);
   add_alias_cmd ("gu", "guile", class_obscure, 1, &showlist);
 
-  add_prefix_cmd ("guile", class_obscure, info_guile_command,
-                 _("Prefix command for Guile info displays."),
-                 &info_guile_list, "info guile ", 0,
-                 &infolist);
+  add_basic_prefix_cmd ("guile", class_obscure,
+                       _("Prefix command for Guile info displays."),
+                       &info_guile_list, "info guile ", 0,
+                       &infolist);
   add_info_alias ("gu", "guile", 1);
 
   /* The name "print-stack" is carried over from Python.
index 19876c35535a07d5a3d2039d2624499a34b927bc..84edb3649e90baa6bdbd0f810238e9f319f5cebe 100644 (file)
@@ -9018,22 +9018,6 @@ i386_mpx_set_bounds (const char *args, int from_tty)
 
 static struct cmd_list_element *mpx_set_cmdlist, *mpx_show_cmdlist;
 
-/* Helper function for the CLI commands.  */
-
-static void
-set_mpx_cmd (const char *args, int from_tty)
-{
-  help_list (mpx_set_cmdlist, "set mpx ", all_commands, gdb_stdout);
-}
-
-/* Helper function for the CLI commands.  */
-
-static void
-show_mpx_cmd (const char *args, int from_tty)
-{
-  cmd_show_list (mpx_show_cmdlist, from_tty, "");
-}
-
 void _initialize_i386_tdep ();
 void
 _initialize_i386_tdep ()
@@ -9064,17 +9048,17 @@ is \"default\"."),
 
   /* Add "mpx" prefix for the set commands.  */
 
-  add_prefix_cmd ("mpx", class_support, set_mpx_cmd, _("\
+  add_basic_prefix_cmd ("mpx", class_support, _("\
 Set Intel Memory Protection Extensions specific variables."),
-                 &mpx_set_cmdlist, "set mpx ",
-                 0 /* allow-unknown */, &setlist);
+                       &mpx_set_cmdlist, "set mpx ",
+                       0 /* allow-unknown */, &setlist);
 
   /* Add "mpx" prefix for the show commands.  */
 
-  add_prefix_cmd ("mpx", class_support, show_mpx_cmd, _("\
+  add_show_prefix_cmd ("mpx", class_support, _("\
 Show Intel Memory Protection Extensions specific variables."),
-                 &mpx_show_cmdlist, "show mpx ",
-                 0 /* allow-unknown */, &showlist);
+                      &mpx_show_cmdlist, "show mpx ",
+                      0 /* allow-unknown */, &showlist);
 
   /* Add "bound" command for the show mpx commands list.  */
 
index d78374c6deb52073a3930652d95bdaf7e5a288bf..9bbb413d4e494cf3b79040e27afde3607281a695 100644 (file)
@@ -3041,14 +3041,6 @@ info_float_command (const char *args, int from_tty)
   gdbarch_print_float_info (get_frame_arch (frame), gdb_stdout, frame, args);
 }
 \f
-static void
-unset_command (const char *args, int from_tty)
-{
-  printf_filtered (_("\"unset\" must be followed by the "
-                    "name of an unset subcommand.\n"));
-  help_list (unsetlist, "unset ", all_commands, gdb_stdout);
-}
-
 /* Implement `info proc' family of commands.  */
 
 static void
@@ -3229,9 +3221,9 @@ give the program being debugged.  With no arguments, prints the entire\n\
 environment to be given to the program."), &showlist);
   set_cmd_completer (c, noop_completer);
 
-  add_prefix_cmd ("unset", no_class, unset_command,
-                 _("Complement to certain \"set\" commands."),
-                 &unsetlist, "unset ", 0, &cmdlist);
+  add_basic_prefix_cmd ("unset", no_class,
+                       _("Complement to certain \"set\" commands."),
+                       &unsetlist, "unset ", 0, &cmdlist);
 
   c = add_cmd ("environment", class_run, unset_environment_command, _("\
 Cancel environment variable VAR for the program.\n\
index c13fd1a406a5bbf987b641fbc6ebcf7a5e4d9280..769b3299793d95fa2ec655a623416deb0805f755 100644 (file)
@@ -500,19 +500,6 @@ language_str (enum language lang)
   return languages[lang]->la_name;
 }
 
-static void
-set_check (const char *ignore, int from_tty)
-{
-  printf_unfiltered (
-     "\"set check\" must be followed by the name of a check subcommand.\n");
-  help_list (setchecklist, "set check ", all_commands, gdb_stdout);
-}
-
-static void
-show_check (const char *ignore, int from_tty)
-{
-  cmd_show_list (showchecklist, from_tty, "");
-}
 \f
 
 /* Build and install the "set language LANG" command.  */
@@ -1149,15 +1136,15 @@ _initialize_language ()
 
   /* GDB commands for language specific stuff.  */
 
-  add_prefix_cmd ("check", no_class, set_check,
-                 _("Set the status of the type/range checker."),
-                 &setchecklist, "set check ", 0, &setlist);
+  add_basic_prefix_cmd ("check", no_class,
+                       _("Set the status of the type/range checker."),
+                       &setchecklist, "set check ", 0, &setlist);
   add_alias_cmd ("c", "check", no_class, 1, &setlist);
   add_alias_cmd ("ch", "check", no_class, 1, &setlist);
 
-  add_prefix_cmd ("check", no_class, show_check,
-                 _("Show the status of the type/range checker."),
-                 &showchecklist, "show check ", 0, &showlist);
+  add_show_prefix_cmd ("check", no_class,
+                      _("Show the status of the type/range checker."),
+                      &showchecklist, "show check ", 0, &showlist);
   add_alias_cmd ("c", "check", no_class, 1, &showlist);
   add_alias_cmd ("ch", "check", no_class, 1, &showlist);
 
index 54aa35e72fe00e8a10bcdeed30d2636d8e540aa2..42915db904423932cedbdceeb9412dabecb54537 100644 (file)
 
 static struct cmd_list_element *macrolist;
 
-static void
-macro_command (const char *arg, int from_tty)
-{
-  printf_unfiltered
-    ("\"macro\" must be followed by the name of a macro command.\n");
-  help_list (macrolist, "macro ", all_commands, gdb_stdout);
-}
-
-
 \f
 /* Macro expansion commands.  */
 
@@ -464,9 +455,9 @@ _initialize_macrocmd ()
 {
   /* We introduce a new command prefix, `macro', under which we'll put
      the various commands for working with preprocessor macros.  */
-  add_prefix_cmd ("macro", class_info, macro_command,
-                 _("Prefix for commands dealing with C preprocessor macros."),
-                 &macrolist, "macro ", 0, &cmdlist);
+  add_basic_prefix_cmd ("macro", class_info,
+                       _("Prefix for commands dealing with C preprocessor macros."),
+                       &macrolist, "macro ", 0, &cmdlist);
 
   add_cmd ("expand", no_class, macro_expand_command, _("\
 Fully expand any C/C++ preprocessor macro invocations in EXPRESSION.\n\
index 2cbdc7c1a202a2fd365dec6631ccf2f78e0d2264..df75e37361ff24e33ed6d977ccc8eeee96458fcd 100644 (file)
@@ -411,18 +411,6 @@ maintenance_test_options_unknown_is_operand_command_completer
 /* Command list for maint test-options.  */
 struct cmd_list_element *maintenance_test_options_list;
 
-/* The "maintenance test-options" prefix command.  */
-
-static void
-maintenance_test_options_command (const char *arg, int from_tty)
-{
-  printf_unfiltered
-    (_("\"maintenance test-options\" must be followed "
-       "by the name of a subcommand.\n"));
-  help_list (maintenance_test_options_list, "maintenance test-options ",
-            all_commands, gdb_stdout);
-}
-
 \f
 void _initialize_maint_test_options ();
 void
@@ -430,12 +418,12 @@ _initialize_maint_test_options ()
 {
   cmd_list_element *cmd;
 
-  add_prefix_cmd ("test-options", no_class, maintenance_test_options_command,
-                 _("\
+  add_basic_prefix_cmd ("test-options", no_class,
+                       _("\
 Generic command for testing the options infrastructure."),
-                 &maintenance_test_options_list,
-                 "maintenance test-options ", 0,
-                 &maintenancelist);
+                       &maintenance_test_options_list,
+                       "maintenance test-options ", 0,
+                       &maintenancelist);
 
   const auto def_group = make_test_options_options_def_group (nullptr);
 
index e8e8874e9a84eb629f4f76ac042df91ffa67fde1..48333e55c51b3640eeedfc77703419acfeffb916 100644 (file)
@@ -27,26 +27,6 @@ static cmd_list_element *maintenance_set_test_settings_list;
 /* Command list for "maint show test-settings".  */
 static cmd_list_element *maintenance_show_test_settings_list;
 
-/* The "maintenance set test-settings" prefix command.  */
-
-static void
-maintenance_set_test_settings_cmd (const char *args, int from_tty)
-{
-  printf_unfiltered (_("\"maintenance set test-settings\" must be followed "
-                      "by the name of a set command.\n"));
-  help_list (maintenance_set_test_settings_list,
-            "maintenance set test-settings ",
-            all_commands, gdb_stdout);
-}
-
-/* The "maintenance show test-settings" prefix command.  */
-
-static void
-maintenance_show_test_settings_cmd (const char *args, int from_tty)
-{
-  cmd_show_list (maintenance_show_test_settings_list, from_tty, "");
-}
-
 /* Control variables for all the "maintenance set/show test-settings
    xxx" commands.  */
 
@@ -105,21 +85,21 @@ _initialize_maint_test_settings ()
 {
   maintenance_test_settings_filename = xstrdup ("/foo/bar");
 
-  add_prefix_cmd ("test-settings", class_maintenance,
-                 maintenance_set_test_settings_cmd, _("\
+  add_basic_prefix_cmd ("test-settings", class_maintenance,
+                       _("\
 Set GDB internal variables used for set/show command infrastructure testing."),
-                 &maintenance_set_test_settings_list,
-                 "maintenance set test-settings ",
-                 0/*allow-unknown*/,
-                 &maintenance_set_cmdlist);
+                       &maintenance_set_test_settings_list,
+                       "maintenance set test-settings ",
+                       0/*allow-unknown*/,
+                       &maintenance_set_cmdlist);
 
-  add_prefix_cmd ("test-settings", class_maintenance,
-                 maintenance_show_test_settings_cmd, _("\
+  add_show_prefix_cmd ("test-settings", class_maintenance,
+                      _("\
 Show GDB internal variables used for set/show command infrastructure testing."),
-                 &maintenance_show_test_settings_list,
-                 "maintenance show test-settings ",
-                 0/*allow-unknown*/,
-                 &maintenance_show_cmdlist);
+                      &maintenance_show_test_settings_list,
+                      "maintenance show test-settings ",
+                      0/*allow-unknown*/,
+                      &maintenance_show_cmdlist);
 
   add_setshow_boolean_cmd ("boolean", class_maintenance,
                           &maintenance_test_settings_boolean, _("\
index e8e0f287731f87c90953df5036abbaafe1411e41..b4890c34cab9bc1694bf7a14e0d27547026116d8 100644 (file)
 
 static void maintenance_do_deprecate (const char *, int);
 
-/* Access the maintenance subcommands.  */
-
-static void
-maintenance_command (const char *args, int from_tty)
-{
-  printf_unfiltered (_("\"maintenance\" must be followed by "
-                      "the name of a maintenance command.\n"));
-  help_list (maintenancelist, "maintenance ", all_commands, gdb_stdout);
-}
-
 #ifndef _WIN32
 static void
 maintenance_dump_me (const char *args, int from_tty)
@@ -139,32 +129,6 @@ maintenance_space_display (const char *args, int from_tty)
     set_per_command_space (strtol (args, NULL, 10));
 }
 
-/* The "maintenance info" command is defined as a prefix, with
-   allow_unknown 0.  Therefore, its own definition is called only for
-   "maintenance info" with no args.  */
-
-static void
-maintenance_info_command (const char *arg, int from_tty)
-{
-  printf_unfiltered (_("\"maintenance info\" must be followed "
-                      "by the name of an info command.\n"));
-  help_list (maintenanceinfolist, "maintenance info ", all_commands,
-            gdb_stdout);
-}
-
-/* The "maintenance check" command is defined as a prefix, with
-   allow_unknown 0.  Therefore, its own definition is called only for
-   "maintenance check" with no args.  */
-
-static void
-maintenance_check_command (const char *arg, int from_tty)
-{
-  printf_unfiltered (_("\"maintenance check\" must be followed "
-                      "by the name of a check command.\n"));
-  help_list (maintenancechecklist, "maintenance check ", all_commands,
-            gdb_stdout);
-}
-
 /* Mini tokenizing lexer for 'maint info sections' command.  */
 
 static int
@@ -511,19 +475,6 @@ maintenance_print_architecture (const char *args, int from_tty)
     }
 }
 
-/* The "maintenance print" command is defined as a prefix, with
-   allow_unknown 0.  Therefore, its own definition is called only for
-   "maintenance print" with no args.  */
-
-static void
-maintenance_print_command (const char *arg, int from_tty)
-{
-  printf_unfiltered (_("\"maintenance print\" must be followed "
-                      "by the name of a print command.\n"));
-  help_list (maintenanceprintlist, "maintenance print ", all_commands,
-            gdb_stdout);
-}
-
 /* The "maintenance translate-address" command converts a section and address
    to a symbol.  This can be called in two ways:
    maintenance translate-address <secname> <addr>
@@ -739,21 +690,6 @@ maintenance_do_deprecate (const char *text, int deprecate)
 struct cmd_list_element *maintenance_set_cmdlist;
 struct cmd_list_element *maintenance_show_cmdlist;
 
-static void
-maintenance_set_cmd (const char *args, int from_tty)
-{
-  printf_unfiltered (_("\"maintenance set\" must be followed "
-                      "by the name of a set command.\n"));
-  help_list (maintenance_set_cmdlist, "maintenance set ", all_commands,
-            gdb_stdout);
-}
-
-static void
-maintenance_show_cmd (const char *args, int from_tty)
-{
-  cmd_show_list (maintenance_show_cmdlist, from_tty, "");
-}
-
 /* "maintenance with" command.  */
 
 static void
@@ -1097,14 +1033,6 @@ set_per_command_cmd (const char *args, int from_tty)
       }
 }
 
-/* Command "show per-command" displays summary of all the current
-   "show per-command " settings.  */
-
-static void
-show_per_command_cmd (const char *args, int from_tty)
-{
-  cmd_show_list (per_command_showlist, from_tty, "");
-}
 \f
 
 /* The "maintenance selftest" command.  */
@@ -1141,19 +1069,19 @@ _initialize_maint_cmds ()
 {
   struct cmd_list_element *cmd;
 
-  add_prefix_cmd ("maintenance", class_maintenance, maintenance_command, _("\
+  add_basic_prefix_cmd ("maintenance", class_maintenance, _("\
 Commands for use by GDB maintainers.\n\
 Includes commands to dump specific internal GDB structures in\n\
 a human readable form, to cause GDB to deliberately dump core, etc."),
-                 &maintenancelist, "maintenance ", 0,
-                 &cmdlist);
+                       &maintenancelist, "maintenance ", 0,
+                       &cmdlist);
 
   add_com_alias ("mt", "maintenance", class_maintenance, 1);
 
-  add_prefix_cmd ("info", class_maintenance, maintenance_info_command, _("\
+  add_basic_prefix_cmd ("info", class_maintenance, _("\
 Commands for showing internal info about the program being debugged."),
-                 &maintenanceinfolist, "maintenance info ", 0,
-                 &maintenancelist);
+                       &maintenanceinfolist, "maintenance info ", 0,
+                       &maintenancelist);
   add_alias_cmd ("i", "info", class_maintenance, 1, &maintenancelist);
 
   add_cmd ("sections", class_maintenance, maintenance_info_sections, _("\
@@ -1168,24 +1096,24 @@ implies all sections).  In addition, the special argument\n\
 lists all sections from all object files, including shared libraries."),
           &maintenanceinfolist);
 
-  add_prefix_cmd ("print", class_maintenance, maintenance_print_command,
-                 _("Maintenance command for printing GDB internal state."),
-                 &maintenanceprintlist, "maintenance print ", 0,
-                 &maintenancelist);
+  add_basic_prefix_cmd ("print", class_maintenance,
+                       _("Maintenance command for printing GDB internal state."),
+                       &maintenanceprintlist, "maintenance print ", 0,
+                       &maintenancelist);
 
-  add_prefix_cmd ("set", class_maintenance, maintenance_set_cmd, _("\
+  add_basic_prefix_cmd ("set", class_maintenance, _("\
 Set GDB internal variables used by the GDB maintainer.\n\
 Configure variables internal to GDB that aid in GDB's maintenance"),
-                 &maintenance_set_cmdlist, "maintenance set ",
-                 0/*allow-unknown*/,
-                 &maintenancelist);
+                       &maintenance_set_cmdlist, "maintenance set ",
+                       0/*allow-unknown*/,
+                       &maintenancelist);
 
-  add_prefix_cmd ("show", class_maintenance, maintenance_show_cmd, _("\
+  add_show_prefix_cmd ("show", class_maintenance, _("\
 Show GDB internal variables used by the GDB maintainer.\n\
 Configure variables internal to GDB that aid in GDB's maintenance"),
-                 &maintenance_show_cmdlist, "maintenance show ",
-                 0/*allow-unknown*/,
-                 &maintenancelist);
+                      &maintenance_show_cmdlist, "maintenance show ",
+                      0/*allow-unknown*/,
+                      &maintenancelist);
 
   cmd = add_cmd ("with", class_maintenance, maintenance_with_cmd, _("\
 Like \"with\", but works with \"maintenance set\" variables.\n\
@@ -1232,10 +1160,10 @@ Per-command statistics settings."),
                    &per_command_setlist, "maintenance set per-command ",
                    1/*allow-unknown*/, &maintenance_set_cmdlist);
 
-  add_prefix_cmd ("per-command", class_maintenance, show_per_command_cmd, _("\
+  add_show_prefix_cmd ("per-command", class_maintenance, _("\
 Show per-command statistics settings."),
-                   &per_command_showlist, "maintenance show per-command ",
-                   0/*allow-unknown*/, &maintenance_show_cmdlist);
+                      &per_command_showlist, "maintenance show per-command ",
+                      0/*allow-unknown*/, &maintenance_show_cmdlist);
 
   add_setshow_boolean_cmd ("time", class_maintenance,
                           &per_command_time, _("\
@@ -1299,10 +1227,10 @@ Print the internal architecture configuration.\n\
 Takes an optional file parameter."),
           &maintenanceprintlist);
 
-  add_prefix_cmd ("check", class_maintenance, maintenance_check_command, _("\
+  add_basic_prefix_cmd ("check", class_maintenance, _("\
 Commands for checking internal gdb state."),
-                 &maintenancechecklist, "maintenance check ", 0,
-                 &maintenancelist);
+                       &maintenancechecklist, "maintenance check ", 0,
+                       &maintenancelist);
 
   add_cmd ("translate-address", class_maintenance,
           maintenance_translate_address,
index c6952a5ba3f1ccc2db77d983d17e54575bbeb69a..2e93f9e5fd3c096d76c131a26e9f570ec03e5839 100644 (file)
@@ -6877,23 +6877,6 @@ mips_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
     return mips32_stack_frame_destroyed_p (gdbarch, pc);
 }
 
-/* Root of all "set mips "/"show mips " commands.  This will eventually be
-   used for all MIPS-specific commands.  */
-
-static void
-show_mips_command (const char *args, int from_tty)
-{
-  help_list (showmipscmdlist, "show mips ", all_commands, gdb_stdout);
-}
-
-static void
-set_mips_command (const char *args, int from_tty)
-{
-  printf_unfiltered
-    ("\"set mips\" must be followed by an appropriate subcommand.\n");
-  help_list (setmipscmdlist, "set mips ", all_commands, gdb_stdout);
-}
-
 /* Commands to show/set the MIPS FPU type.  */
 
 static void
@@ -8990,13 +8973,13 @@ _initialize_mips_tdep ()
   set_tdesc_property (mips_tdesc_gp64, PROPERTY_GP64, "");
 
   /* Add root prefix command for all "set mips"/"show mips" commands.  */
-  add_prefix_cmd ("mips", no_class, set_mips_command,
-                 _("Various MIPS specific commands."),
-                 &setmipscmdlist, "set mips ", 0, &setlist);
+  add_basic_prefix_cmd ("mips", no_class,
+                       _("Various MIPS specific commands."),
+                       &setmipscmdlist, "set mips ", 0, &setlist);
 
-  add_prefix_cmd ("mips", no_class, show_mips_command,
-                 _("Various MIPS specific commands."),
-                 &showmipscmdlist, "show mips ", 0, &showlist);
+  add_show_prefix_cmd ("mips", no_class,
+                      _("Various MIPS specific commands."),
+                      &showmipscmdlist, "show mips ", 0, &showlist);
 
   /* Allow the user to override the ABI.  */
   add_setshow_enum_cmd ("abi", class_obscure, mips_abi_strings,
index e56520ab11a13c7325765b10daeca04841ce35b3..d252646c02cfd4bde41582a7695402a8c7b49f5b 100644 (file)
@@ -1590,23 +1590,6 @@ python_command (const char *arg, int from_tty)
 static struct cmd_list_element *user_set_python_list;
 static struct cmd_list_element *user_show_python_list;
 
-/* Function for use by 'set python' prefix command.  */
-
-static void
-user_set_python (const char *args, int from_tty)
-{
-  help_list (user_set_python_list, "set python ", all_commands,
-            gdb_stdout);
-}
-
-/* Function for use by 'show python' prefix command.  */
-
-static void
-user_show_python (const char *args, int from_tty)
-{
-  cmd_show_list (user_show_python_list, from_tty, "");
-}
-
 /* Initialize the Python code.  */
 
 #ifdef HAVE_PYTHON
@@ -1871,15 +1854,15 @@ This command is only a placeholder.")
   add_com_alias ("py", "python", class_obscure, 1);
 
   /* Add set/show python print-stack.  */
-  add_prefix_cmd ("python", no_class, user_show_python,
-                 _("Prefix command for python preference settings."),
-                 &user_show_python_list, "show python ", 0,
-                 &showlist);
-
-  add_prefix_cmd ("python", no_class, user_set_python,
-                 _("Prefix command for python preference settings."),
-                 &user_set_python_list, "set python ", 0,
-                 &setlist);
+  add_basic_prefix_cmd ("python", no_class,
+                       _("Prefix command for python preference settings."),
+                       &user_show_python_list, "show python ", 0,
+                       &showlist);
+
+  add_show_prefix_cmd ("python", no_class,
+                      _("Prefix command for python preference settings."),
+                      &user_set_python_list, "set python ", 0,
+                      &setlist);
 
   add_setshow_enum_cmd ("print-stack", no_class, python_excp_enums,
                        &gdbpy_should_print_stack, _("\
index fd3beb03ec3eb13ad292f368889f7d6f49af3971..f3b4ecf8706ad84ce9b20272b755b0a2fbbf6ab1 100644 (file)
@@ -563,24 +563,6 @@ ravenscar_thread_target::get_ada_task_ptid (long lwp, long thread)
 static struct cmd_list_element *set_ravenscar_list;
 static struct cmd_list_element *show_ravenscar_list;
 
-/* Implement the "set ravenscar" prefix command.  */
-
-static void
-set_ravenscar_command (const char *arg, int from_tty)
-{
-  printf_unfiltered (_(\
-"\"set ravenscar\" must be followed by the name of a setting.\n"));
-  help_list (set_ravenscar_list, "set ravenscar ", all_commands, gdb_stdout);
-}
-
-/* Implement the "show ravenscar" prefix command.  */
-
-static void
-show_ravenscar_command (const char *args, int from_tty)
-{
-  cmd_show_list (show_ravenscar_list, from_tty, "");
-}
-
 /* Implement the "show ravenscar task-switching" command.  */
 
 static void
@@ -607,13 +589,13 @@ _initialize_ravenscar ()
      ravenscar ops if needed.  */
   gdb::observers::inferior_created.attach (ravenscar_inferior_created);
 
-  add_prefix_cmd ("ravenscar", no_class, set_ravenscar_command,
-                  _("Prefix command for changing Ravenscar-specific settings."),
-                  &set_ravenscar_list, "set ravenscar ", 0, &setlist);
+  add_basic_prefix_cmd ("ravenscar", no_class,
+                       _("Prefix command for changing Ravenscar-specific settings."),
+                       &set_ravenscar_list, "set ravenscar ", 0, &setlist);
 
-  add_prefix_cmd ("ravenscar", no_class, show_ravenscar_command,
-                  _("Prefix command for showing Ravenscar-specific settings."),
-                  &show_ravenscar_list, "show ravenscar ", 0, &showlist);
+  add_show_prefix_cmd ("ravenscar", no_class,
+                      _("Prefix command for showing Ravenscar-specific settings."),
+                      &show_ravenscar_list, "show ravenscar ", 0, &showlist);
 
   add_setshow_boolean_cmd ("task-switching", class_obscure,
                            &ravenscar_task_support, _("\
index 2ca9a61457a3af2e0ac99e39a5214624a88f02d2..fe2ab8ad9a9e2a7c71202b714d333454c0ab4a7d 100644 (file)
@@ -2962,25 +2962,6 @@ cmd_record_btrace_start (const char *args, int from_tty)
     }
 }
 
-/* The "set record btrace" command.  */
-
-static void
-cmd_set_record_btrace (const char *args, int from_tty)
-{
-  printf_unfiltered (_("\"set record btrace\" must be followed "
-                      "by an appropriate subcommand.\n"));
-  help_list (set_record_btrace_cmdlist, "set record btrace ",
-            all_commands, gdb_stdout);
-}
-
-/* The "show record btrace" command.  */
-
-static void
-cmd_show_record_btrace (const char *args, int from_tty)
-{
-  cmd_show_list (show_record_btrace_cmdlist, from_tty, "");
-}
-
 /* The "show record btrace replay-memory-access" command.  */
 
 static void
@@ -3095,44 +3076,6 @@ cmd_show_record_btrace_cpu (const char *args, int from_tty)
   error (_("Internal error: bad cpu state."));
 }
 
-/* The "s record btrace bts" command.  */
-
-static void
-cmd_set_record_btrace_bts (const char *args, int from_tty)
-{
-  printf_unfiltered (_("\"set record btrace bts\" must be followed "
-                      "by an appropriate subcommand.\n"));
-  help_list (set_record_btrace_bts_cmdlist, "set record btrace bts ",
-            all_commands, gdb_stdout);
-}
-
-/* The "show record btrace bts" command.  */
-
-static void
-cmd_show_record_btrace_bts (const char *args, int from_tty)
-{
-  cmd_show_list (show_record_btrace_bts_cmdlist, from_tty, "");
-}
-
-/* The "set record btrace pt" command.  */
-
-static void
-cmd_set_record_btrace_pt (const char *args, int from_tty)
-{
-  printf_unfiltered (_("\"set record btrace pt\" must be followed "
-                      "by an appropriate subcommand.\n"));
-  help_list (set_record_btrace_pt_cmdlist, "set record btrace pt ",
-            all_commands, gdb_stdout);
-}
-
-/* The "show record btrace pt" command.  */
-
-static void
-cmd_show_record_btrace_pt (const char *args, int from_tty)
-{
-  cmd_show_list (show_record_btrace_pt_cmdlist, from_tty, "");
-}
-
 /* The "record bts buffer-size" show value function.  */
 
 static void
@@ -3181,13 +3124,13 @@ This format may not be available on all processors."),
           &record_btrace_cmdlist);
   add_alias_cmd ("pt", "btrace pt", class_obscure, 1, &record_cmdlist);
 
-  add_prefix_cmd ("btrace", class_support, cmd_set_record_btrace,
-                 _("Set record options."), &set_record_btrace_cmdlist,
-                 "set record btrace ", 0, &set_record_cmdlist);
+  add_basic_prefix_cmd ("btrace", class_support,
+                       _("Set record options."), &set_record_btrace_cmdlist,
+                       "set record btrace ", 0, &set_record_cmdlist);
 
-  add_prefix_cmd ("btrace", class_support, cmd_show_record_btrace,
-                 _("Show record options."), &show_record_btrace_cmdlist,
-                 "show record btrace ", 0, &show_record_cmdlist);
+  add_show_prefix_cmd ("btrace", class_support,
+                      _("Show record options."), &show_record_btrace_cmdlist,
+                      "show record btrace ", 0, &show_record_cmdlist);
 
   add_setshow_enum_cmd ("replay-memory-access", no_class,
                        replay_memory_access_types, &replay_memory_access, _("\
@@ -3230,15 +3173,17 @@ Do not enable errata workarounds for trace decode."),
 Show the cpu to be used for trace decode."),
           &show_record_btrace_cmdlist);
 
-  add_prefix_cmd ("bts", class_support, cmd_set_record_btrace_bts,
-                 _("Set record btrace bts options."),
-                 &set_record_btrace_bts_cmdlist,
-                 "set record btrace bts ", 0, &set_record_btrace_cmdlist);
+  add_basic_prefix_cmd ("bts", class_support,
+                       _("Set record btrace bts options."),
+                       &set_record_btrace_bts_cmdlist,
+                       "set record btrace bts ", 0,
+                       &set_record_btrace_cmdlist);
 
-  add_prefix_cmd ("bts", class_support, cmd_show_record_btrace_bts,
-                 _("Show record btrace bts options."),
-                 &show_record_btrace_bts_cmdlist,
-                 "show record btrace bts ", 0, &show_record_btrace_cmdlist);
+  add_show_prefix_cmd ("bts", class_support,
+                      _("Show record btrace bts options."),
+                      &show_record_btrace_bts_cmdlist,
+                      "show record btrace bts ", 0,
+                      &show_record_btrace_cmdlist);
 
   add_setshow_uinteger_cmd ("buffer-size", no_class,
                            &record_btrace_conf.bts.size,
@@ -3254,15 +3199,17 @@ The trace buffer size may not be changed while recording."), NULL,
                            &set_record_btrace_bts_cmdlist,
                            &show_record_btrace_bts_cmdlist);
 
-  add_prefix_cmd ("pt", class_support, cmd_set_record_btrace_pt,
-                 _("Set record btrace pt options."),
-                 &set_record_btrace_pt_cmdlist,
-                 "set record btrace pt ", 0, &set_record_btrace_cmdlist);
-
-  add_prefix_cmd ("pt", class_support, cmd_show_record_btrace_pt,
-                 _("Show record btrace pt options."),
-                 &show_record_btrace_pt_cmdlist,
-                 "show record btrace pt ", 0, &show_record_btrace_cmdlist);
+  add_basic_prefix_cmd ("pt", class_support,
+                       _("Set record btrace pt options."),
+                       &set_record_btrace_pt_cmdlist,
+                       "set record btrace pt ", 0,
+                       &set_record_btrace_cmdlist);
+
+  add_show_prefix_cmd ("pt", class_support,
+                      _("Show record btrace pt options."),
+                      &show_record_btrace_pt_cmdlist,
+                      "show record btrace pt ", 0,
+                      &show_record_btrace_cmdlist);
 
   add_setshow_uinteger_cmd ("buffer-size", no_class,
                            &record_btrace_conf.pt.size,
index 9c8bd18149bcc0e7aabdc2ce9eabe19195280861..9d6e403e57611562a47419ffdcaa5d97d84d222e 100644 (file)
@@ -2794,25 +2794,6 @@ set_record_full_insn_max_num (const char *args, int from_tty,
     }
 }
 
-/* The "set record full" command.  */
-
-static void
-set_record_full_command (const char *args, int from_tty)
-{
-  printf_unfiltered (_("\"set record full\" must be followed "
-                      "by an appropriate subcommand.\n"));
-  help_list (set_record_full_cmdlist, "set record full ", all_commands,
-            gdb_stdout);
-}
-
-/* The "show record full" command.  */
-
-static void
-show_record_full_command (const char *args, int from_tty)
-{
-  cmd_show_list (show_record_full_cmdlist, from_tty, "");
-}
-
 void _initialize_record_full ();
 void
 _initialize_record_full ()
@@ -2844,13 +2825,13 @@ Argument is filename.  File must be created with 'record save'."),
   set_cmd_completer (c, filename_completer);
   deprecate_cmd (c, "record full restore");
 
-  add_prefix_cmd ("full", class_support, set_record_full_command,
-                 _("Set record options."), &set_record_full_cmdlist,
-                 "set record full ", 0, &set_record_cmdlist);
+  add_basic_prefix_cmd ("full", class_support,
+                       _("Set record options."), &set_record_full_cmdlist,
+                       "set record full ", 0, &set_record_cmdlist);
 
-  add_prefix_cmd ("full", class_support, show_record_full_command,
-                 _("Show record options."), &show_record_full_cmdlist,
-                 "show record full ", 0, &show_record_cmdlist);
+  add_show_prefix_cmd ("full", class_support,
+                      _("Show record options."), &show_record_full_cmdlist,
+                      "show record full ", 0, &show_record_cmdlist);
 
   /* Record instructions number limit command.  */
   add_setshow_boolean_cmd ("stop-at-limit", no_class,
index 94600eb5e7ee48ed1ee4b8ab79406eb1112fbdd2..759395d5bcd865e1a22654538c514e546835cb75 100644 (file)
@@ -314,23 +314,6 @@ cmd_record_stop (const char *args, int from_tty)
   gdb::observers::record_changed.notify (current_inferior (), 0, NULL, NULL);
 }
 
-/* The "set record" command.  */
-
-static void
-set_record_command (const char *args, int from_tty)
-{
-  printf_unfiltered (_("\"set record\" must be followed "
-                      "by an appropriate subcommand.\n"));
-  help_list (set_record_cmdlist, "set record ", all_commands, gdb_stdout);
-}
-
-/* The "show record" command.  */
-
-static void
-show_record_command (const char *args, int from_tty)
-{
-  cmd_show_list (show_record_cmdlist, from_tty, "");
-}
 
 /* The "info record" command.  */
 
@@ -808,13 +791,13 @@ A size of \"unlimited\" means unlimited lines.  The default is 10."),
   set_cmd_completer (c, filename_completer);
 
   add_com_alias ("rec", "record", class_obscure, 1);
-  add_prefix_cmd ("record", class_support, set_record_command,
-                 _("Set record options."), &set_record_cmdlist,
-                 "set record ", 0, &setlist);
+  add_basic_prefix_cmd ("record", class_support,
+                       _("Set record options."), &set_record_cmdlist,
+                       "set record ", 0, &setlist);
   add_alias_cmd ("rec", "record", class_obscure, 1, &setlist);
-  add_prefix_cmd ("record", class_support, show_record_command,
-                 _("Show record options."), &show_record_cmdlist,
-                 "show record ", 0, &showlist);
+  add_show_prefix_cmd ("record", class_support,
+                      _("Show record options."), &show_record_cmdlist,
+                      "show record ", 0, &showlist);
   add_alias_cmd ("rec", "record", class_obscure, 1, &showlist);
   add_prefix_cmd ("record", class_support, info_record_command,
                  _("Info record options."), &info_record_cmdlist,
index 495f9680c1ef54da11b9375a96eb9d141e0ce666..5db406e045c171abda255a38a654c864aeb21ca2 100644 (file)
@@ -12700,12 +12700,6 @@ remote_delete_command (const char *args, int from_tty)
   remote_file_delete (argv[0], from_tty);
 }
 
-static void
-remote_command (const char *args, int from_tty)
-{
-  help_list (remote_cmdlist, "remote ", all_commands, gdb_stdout);
-}
-
 bool
 remote_target::can_execute_reverse ()
 {
@@ -14224,12 +14218,6 @@ remote_target::thread_events (int enable)
     }
 }
 
-static void
-set_remote_cmd (const char *args, int from_tty)
-{
-  help_list (remote_set_cmdlist, "set remote ", all_commands, gdb_stdout);
-}
-
 static void
 show_remote_cmd (const char *args, int from_tty)
 {
@@ -14382,12 +14370,12 @@ _initialize_remote ()
 
   /* set/show remote ...  */
 
-  add_prefix_cmd ("remote", class_maintenance, set_remote_cmd, _("\
+  add_basic_prefix_cmd ("remote", class_maintenance, _("\
 Remote protocol specific variables.\n\
 Configure various remote-protocol specific variables such as\n\
 the packets being used."),
-                 &remote_set_cmdlist, "set remote ",
-                 0 /* allow-unknown */, &setlist);
+                       &remote_set_cmdlist, "set remote ",
+                       0 /* allow-unknown */, &setlist);
   add_prefix_cmd ("remote", class_maintenance, show_remote_cmd, _("\
 Remote protocol specific variables.\n\
 Configure various remote-protocol specific variables such as\n\
@@ -14808,11 +14796,11 @@ packets."),
                                   `Z' packets is %s.  */
                                &remote_set_cmdlist, &remote_show_cmdlist);
 
-  add_prefix_cmd ("remote", class_files, remote_command, _("\
+  add_basic_prefix_cmd ("remote", class_files, _("\
 Manipulate files on the remote system.\n\
 Transfer files to and from the remote target system."),
-                 &remote_cmdlist, "remote ",
-                 0 /* allow-unknown */, &cmdlist);
+                       &remote_cmdlist, "remote ",
+                       0 /* allow-unknown */, &cmdlist);
 
   add_cmd ("put", class_files, remote_put_command,
           _("Copy a local file to the remote system."),
index 0423e6abf30733988bc81c200f10f39175c6935c..1bb824eef54716c4c5ea8ebe8d8a1133d6f3d5b4 100644 (file)
@@ -284,47 +284,11 @@ show_use_compressed_breakpoints (struct ui_file *file, int from_tty,
 static struct cmd_list_element *setriscvcmdlist = NULL;
 static struct cmd_list_element *showriscvcmdlist = NULL;
 
-/* The show callback for the 'show riscv' prefix command.  */
-
-static void
-show_riscv_command (const char *args, int from_tty)
-{
-  help_list (showriscvcmdlist, "show riscv ", all_commands, gdb_stdout);
-}
-
-/* The set callback for the 'set riscv' prefix command.  */
-
-static void
-set_riscv_command (const char *args, int from_tty)
-{
-  printf_unfiltered
-    (_("\"set riscv\" must be followed by an appropriate subcommand.\n"));
-  help_list (setriscvcmdlist, "set riscv ", all_commands, gdb_stdout);
-}
-
 /* The set and show lists for 'set riscv' and 'show riscv' prefixes.  */
 
 static struct cmd_list_element *setdebugriscvcmdlist = NULL;
 static struct cmd_list_element *showdebugriscvcmdlist = NULL;
 
-/* The show callback for the 'show debug riscv' prefix command.  */
-
-static void
-show_debug_riscv_command (const char *args, int from_tty)
-{
-  help_list (showdebugriscvcmdlist, "show debug riscv ", all_commands, gdb_stdout);
-}
-
-/* The set callback for the 'set debug riscv' prefix command.  */
-
-static void
-set_debug_riscv_command (const char *args, int from_tty)
-{
-  printf_unfiltered
-    (_("\"set debug riscv\" must be followed by an appropriate subcommand.\n"));
-  help_list (setdebugriscvcmdlist, "set debug riscv ", all_commands, gdb_stdout);
-}
-
 /* The show callback for all 'show debug riscv VARNAME' variables.  */
 
 static void
@@ -3527,15 +3491,15 @@ _initialize_riscv_tdep ()
 
   /* Add root prefix command for all "set debug riscv" and "show debug
      riscv" commands.  */
-  add_prefix_cmd ("riscv", no_class, set_debug_riscv_command,
-                 _("RISC-V specific debug commands."),
-                 &setdebugriscvcmdlist, "set debug riscv ", 0,
-                 &setdebuglist);
+  add_basic_prefix_cmd ("riscv", no_class,
+                       _("RISC-V specific debug commands."),
+                       &setdebugriscvcmdlist, "set debug riscv ", 0,
+                       &setdebuglist);
 
-  add_prefix_cmd ("riscv", no_class, show_debug_riscv_command,
-                 _("RISC-V specific debug commands."),
-                 &showdebugriscvcmdlist, "show debug riscv ", 0,
-                 &showdebuglist);
+  add_show_prefix_cmd ("riscv", no_class,
+                      _("RISC-V specific debug commands."),
+                      &showdebugriscvcmdlist, "show debug riscv ", 0,
+                      &showdebuglist);
 
   add_setshow_zuinteger_cmd ("breakpoints", class_maintenance,
                             &riscv_debug_breakpoints,  _("\
@@ -3578,13 +3542,13 @@ initialisation process."),
                             &setdebugriscvcmdlist, &showdebugriscvcmdlist);
 
   /* Add root prefix command for all "set riscv" and "show riscv" commands.  */
-  add_prefix_cmd ("riscv", no_class, set_riscv_command,
-                 _("RISC-V specific commands."),
-                 &setriscvcmdlist, "set riscv ", 0, &setlist);
+  add_basic_prefix_cmd ("riscv", no_class,
+                       _("RISC-V specific commands."),
+                       &setriscvcmdlist, "set riscv ", 0, &setlist);
 
-  add_prefix_cmd ("riscv", no_class, show_riscv_command,
-                 _("RISC-V specific commands."),
-                 &showriscvcmdlist, "show riscv ", 0, &showlist);
+  add_show_prefix_cmd ("riscv", no_class,
+                      _("RISC-V specific commands."),
+                      &showriscvcmdlist, "show riscv ", 0, &showlist);
 
 
   use_compressed_breakpoints = AUTO_BOOLEAN_AUTO;
index 2c41e1c858b491137c4c043ecae2674fa31d642f..1e1fbc7022b4bf2b99609101ff80ce202baf4f59 100644 (file)
@@ -7172,22 +7172,6 @@ rs6000_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
   /* FIXME: Dump gdbarch_tdep.  */
 }
 
-/* PowerPC-specific commands.  */
-
-static void
-set_powerpc_command (const char *args, int from_tty)
-{
-  printf_unfiltered (_("\
-\"set powerpc\" must be followed by an appropriate subcommand.\n"));
-  help_list (setpowerpccmdlist, "set powerpc ", all_commands, gdb_stdout);
-}
-
-static void
-show_powerpc_command (const char *args, int from_tty)
-{
-  cmd_show_list (showpowerpccmdlist, from_tty, "");
-}
-
 static void
 powerpc_set_soft_float (const char *args, int from_tty,
                        struct cmd_list_element *c)
@@ -7338,13 +7322,13 @@ _initialize_rs6000_tdep ()
 
   /* Add root prefix command for all "set powerpc"/"show powerpc"
      commands.  */
-  add_prefix_cmd ("powerpc", no_class, set_powerpc_command,
-                 _("Various PowerPC-specific commands."),
-                 &setpowerpccmdlist, "set powerpc ", 0, &setlist);
+  add_basic_prefix_cmd ("powerpc", no_class,
+                       _("Various PowerPC-specific commands."),
+                       &setpowerpccmdlist, "set powerpc ", 0, &setlist);
 
-  add_prefix_cmd ("powerpc", no_class, show_powerpc_command,
-                 _("Various PowerPC-specific commands."),
-                 &showpowerpccmdlist, "show powerpc ", 0, &showlist);
+  add_show_prefix_cmd ("powerpc", no_class,
+                      _("Various PowerPC-specific commands."),
+                      &showpowerpccmdlist, "show powerpc ", 0, &showlist);
 
   /* Add a command to allow the user to force the ABI.  */
   add_setshow_auto_boolean_cmd ("soft-float", class_support,
index 1c6d5a346c6dda20b58f98dd09571ca79d7846bf..7dd903dfaad6bd9ecf06a20e31f021f32e3aff8c 100644 (file)
@@ -424,20 +424,6 @@ ser_tcp_send_break (struct serial *scb)
   return (serial_write (scb, "\377\363", 2));
 }
 
-/* Support for "set tcp" and "show tcp" commands.  */
-
-static void
-set_tcp_cmd (const char *args, int from_tty)
-{
-  help_list (tcp_set_cmdlist, "set tcp ", all_commands, gdb_stdout);
-}
-
-static void
-show_tcp_cmd (const char *args, int from_tty)
-{
-  help_list (tcp_show_cmdlist, "show tcp ", all_commands, gdb_stdout);
-}
-
 #ifndef USE_WIN32API
 
 /* The TCP ops.  */
@@ -480,16 +466,16 @@ _initialize_ser_tcp ()
   serial_add_interface (&tcp_ops);
 #endif /* USE_WIN32API */
 
-  add_prefix_cmd ("tcp", class_maintenance, set_tcp_cmd, _("\
+  add_basic_prefix_cmd ("tcp", class_maintenance, _("\
 TCP protocol specific variables.\n\
 Configure variables specific to remote TCP connections."),
-                 &tcp_set_cmdlist, "set tcp ",
-                 0 /* allow-unknown */, &setlist);
-  add_prefix_cmd ("tcp", class_maintenance, show_tcp_cmd, _("\
+                       &tcp_set_cmdlist, "set tcp ",
+                       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, "show tcp ",
-                 0 /* allow-unknown */, &showlist);
+                      &tcp_show_cmdlist, "show tcp ",
+                      0 /* allow-unknown */, &showlist);
 
   add_setshow_boolean_cmd ("auto-retry", class_obscure,
                           &tcp_auto_retry, _("\
index e0d64dd627f1279e654d580c08a537dadb6baac4..e253c0ec44af0cc28e79ecee963f896b21ec223d 100644 (file)
@@ -623,20 +623,6 @@ serial_pipe (struct serial *scbs[2])
 static struct cmd_list_element *serial_set_cmdlist;
 static struct cmd_list_element *serial_show_cmdlist;
 
-static void
-serial_set_cmd (const char *args, int from_tty)
-{
-  printf_unfiltered ("\"set serial\" must be followed "
-                    "by the name of a command.\n");
-  help_list (serial_set_cmdlist, "set serial ", all_commands, gdb_stdout);
-}
-
-static void
-serial_show_cmd (const char *args, int from_tty)
-{
-  cmd_show_list (serial_show_cmdlist, from_tty, "");
-}
-
 /* Baud rate specified for talking to serial target systems.  Default
    is left as -1, so targets can choose their own defaults.  */
 /* FIXME: This means that "show serial baud" and gr_files_info can
@@ -686,17 +672,17 @@ Connect the terminal directly up to the command monitor.\n\
 Use <CR>~. or <CR>~^D to break out."));
 #endif /* 0 */
 
-  add_prefix_cmd ("serial", class_maintenance, serial_set_cmd, _("\
+  add_basic_prefix_cmd ("serial", class_maintenance, _("\
 Set default serial/parallel port configuration."),
-                 &serial_set_cmdlist, "set serial ",
-                 0/*allow-unknown*/,
-                 &setlist);
+                       &serial_set_cmdlist, "set serial ",
+                       0/*allow-unknown*/,
+                       &setlist);
 
-  add_prefix_cmd ("serial", class_maintenance, serial_show_cmd, _("\
+  add_show_prefix_cmd ("serial", class_maintenance, _("\
 Show default serial/parallel port configuration."),
-                 &serial_show_cmdlist, "show serial ",
-                 0/*allow-unknown*/,
-                 &showlist);
+                      &serial_show_cmdlist, "show serial ",
+                      0/*allow-unknown*/,
+                      &showlist);
 
   /* If target is open when baud changes, it doesn't take effect until
      the next open (I think, not sure).  */
index 9e831fb42e07d132e7865f863da3c6780febf07c..5b322ea2d5af3a6364c625e80a6645ef9da7b4b8 100644 (file)
@@ -2408,30 +2408,16 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   return gdbarch;
 }
 
-static void
-show_sh_command (const char *args, int from_tty)
-{
-  help_list (showshcmdlist, "show sh ", all_commands, gdb_stdout);
-}
-
-static void
-set_sh_command (const char *args, int from_tty)
-{
-  printf_unfiltered
-    ("\"set sh\" must be followed by an appropriate subcommand.\n");
-  help_list (setshcmdlist, "set sh ", all_commands, gdb_stdout);
-}
-
 void _initialize_sh_tdep ();
 void
 _initialize_sh_tdep ()
 {
   gdbarch_register (bfd_arch_sh, sh_gdbarch_init, NULL);
 
-  add_prefix_cmd ("sh", no_class, set_sh_command, "SH specific commands.",
-                  &setshcmdlist, "set sh ", 0, &setlist);
-  add_prefix_cmd ("sh", no_class, show_sh_command, "SH specific commands.",
-                  &showshcmdlist, "show sh ", 0, &showlist);
+  add_basic_prefix_cmd ("sh", no_class, "SH specific commands.",
+                       &setshcmdlist, "set sh ", 0, &setlist);
+  add_show_prefix_cmd ("sh", no_class, "SH specific commands.",
+                      &showshcmdlist, "show sh ", 0, &showlist);
   
   add_setshow_enum_cmd ("calling-convention", class_vars, sh_cc_enum,
                        &sh_active_calling_convention,
index ac915d468fd353167a557d120cd0cbe81bb2265c..593db3640031a8659870dd034a6622a036e45a3b 100644 (file)
@@ -186,14 +186,6 @@ sparc64_forget_process (pid_t pid)
 
 }
 
-static void
-info_adi_command (const char *args, int from_tty)
-{
-  printf_unfiltered ("\"adi\" must be followed by \"examine\" "
-                     "or \"assign\".\n");
-  help_list (sparc64adilist, "adi ", all_commands, gdb_stdout);
-}
-
 /* Read attributes of a maps entry in /proc/[pid]/adi/maps.  */
 
 static void
@@ -538,10 +530,9 @@ void _initialize_sparc64_adi_tdep ();
 void
 _initialize_sparc64_adi_tdep ()
 {
-
-  add_prefix_cmd ("adi", class_support, info_adi_command,
-                  _("ADI version related commands."),
-                  &sparc64adilist, "adi ", 0, &cmdlist);
+  add_basic_prefix_cmd ("adi", class_support,
+                       _("ADI version related commands."),
+                       &sparc64adilist, "adi ", 0, &cmdlist);
   add_cmd ("examine", class_support, adi_examine_command,
            _("Examine ADI versions."), &sparc64adilist);
   add_alias_cmd ("x", "examine", no_class, 1, &sparc64adilist);
index 8c002ebfabe91ca913f86d7a8e570c10d67bd757..407534445253b3467a6141855e5e44adc2a20372 100644 (file)
@@ -3349,20 +3349,9 @@ overlay_load_command (const char *args, int from_tty)
     error (_("This target does not know how to read its overlay state."));
 }
 
-/* Function: overlay_command
-   A place-holder for a mis-typed command.  */
-
 /* Command list chain containing all defined "overlay" subcommands.  */
 static struct cmd_list_element *overlaylist;
 
-static void
-overlay_command (const char *args, int from_tty)
-{
-  printf_unfiltered
-    ("\"overlay\" must be followed by the name of an overlay command.\n");
-  help_list (overlaylist, "overlay ", all_commands, gdb_stdout);
-}
-
 /* Target Overlays for the "Simplest" overlay manager:
 
    This is GDB's default target overlay layer.  It works with the
@@ -3913,9 +3902,9 @@ When OFFSET is provided, FILE must also be provided.  FILE can be provided\n\
 on its own."), &cmdlist);
   set_cmd_completer (c, filename_completer);
 
-  add_prefix_cmd ("overlay", class_support, overlay_command,
-                 _("Commands for debugging overlays."), &overlaylist,
-                 "overlay ", 0, &cmdlist);
+  add_basic_prefix_cmd ("overlay", class_support,
+                       _("Commands for debugging overlays."), &overlaylist,
+                       "overlay ", 0, &cmdlist);
 
   add_com_alias ("ovly", "overlay", class_alias, 1);
   add_com_alias ("ov", "overlay", class_alias, 1);
index 45d75a3cd1134721d4bed66afb0b20d9b13860bc..6354a8b0d20be06b711d247af064e01910d9d2bd 100644 (file)
@@ -6479,15 +6479,6 @@ get_msymbol_address (struct objfile *objf, const struct minimal_symbol *minsym)
 
 static struct cmd_list_element *info_module_cmdlist = NULL;
 
-/* Implement the 'info module' command, just displays some help text for
-   the available sub-commands.  */
-
-static void
-info_module_command (const char *args, int from_tty)
-{
-  help_list (info_module_cmdlist, "info module ", class_info, gdb_stdout);
-}
-
 /* See symtab.h.  */
 
 std::vector<module_symbol_search>
@@ -6846,10 +6837,10 @@ Options:\n\
                _("All module names, or those matching REGEXP."));
   set_cmd_completer_handle_brkchars (c, info_types_command_completer);
 
-  add_prefix_cmd ("module", class_info, info_module_command, _("\
+  add_basic_prefix_cmd ("module", class_info, _("\
 Print information about modules."),
-                 &info_module_cmdlist, "info module ",
-                 0, &infolist);
+                       &info_module_cmdlist, "info module ",
+                       0, &infolist);
 
   c = add_cmd ("functions", class_info, info_module_functions_command, _("\
 Display functions arranged by modules.\n\
index 4194819d9aba4e53d7044b76c14a6bb10af1ece2..2ec07a3e3bd62b0db01909cc00565067dffefef0 100644 (file)
@@ -1217,24 +1217,6 @@ static struct cmd_list_element *tdesc_unset_cmdlist;
 
 /* Helper functions for the CLI commands.  */
 
-static void
-set_tdesc_cmd (const char *args, int from_tty)
-{
-  help_list (tdesc_set_cmdlist, "set tdesc ", all_commands, gdb_stdout);
-}
-
-static void
-show_tdesc_cmd (const char *args, int from_tty)
-{
-  cmd_show_list (tdesc_show_cmdlist, from_tty, "");
-}
-
-static void
-unset_tdesc_cmd (const char *args, int from_tty)
-{
-  help_list (tdesc_unset_cmdlist, "unset tdesc ", all_commands, gdb_stdout);
-}
-
 static void
 set_tdesc_filename_cmd (const char *args, int from_tty,
                        struct cmd_list_element *c)
@@ -1831,18 +1813,18 @@ _initialize_target_descriptions ()
 {
   tdesc_data = gdbarch_data_register_pre_init (tdesc_data_init);
 
-  add_prefix_cmd ("tdesc", class_maintenance, set_tdesc_cmd, _("\
+  add_basic_prefix_cmd ("tdesc", class_maintenance, _("\
 Set target description specific variables."),
-                 &tdesc_set_cmdlist, "set tdesc ",
-                 0 /* allow-unknown */, &setlist);
-  add_prefix_cmd ("tdesc", class_maintenance, show_tdesc_cmd, _("\
+                       &tdesc_set_cmdlist, "set tdesc ",
+                       0 /* allow-unknown */, &setlist);
+  add_show_prefix_cmd ("tdesc", class_maintenance, _("\
 Show target description specific variables."),
-                 &tdesc_show_cmdlist, "show tdesc ",
-                 0 /* allow-unknown */, &showlist);
-  add_prefix_cmd ("tdesc", class_maintenance, unset_tdesc_cmd, _("\
+                      &tdesc_show_cmdlist, "show tdesc ",
+                      0 /* allow-unknown */, &showlist);
+  add_basic_prefix_cmd ("tdesc", class_maintenance, _("\
 Unset target description specific variables."),
-                 &tdesc_unset_cmdlist, "unset tdesc ",
-                 0 /* allow-unknown */, &unsetlist);
+                       &tdesc_unset_cmdlist, "unset tdesc ",
+                       0 /* allow-unknown */, &unsetlist);
 
   add_setshow_filename_cmd ("filename", class_obscure,
                            &tdesc_filename_cmd_string,
index eaa96b06e7620be1d02888487c3c4ed0eba25220..f26bb4c4d0d0f37f06760d1a152fcbe93d016fe2 100644 (file)
@@ -1,3 +1,12 @@
+2020-04-17  Tom Tromey  <tromey@adacore.com>
+
+       * gdb.cp/maint.exp (test_help): Simplify multiple_help_body.
+       Update tests.
+       * gdb.btrace/cpu.exp: Update tests.
+       * gdb.base/maint.exp: Update tests.
+       * gdb.base/default.exp: Update tests.
+       * gdb.base/completion.exp: Update tests.
+
 2020-04-16  Tom de Vries  <tdevries@suse.de>
 
        PR symtab/25791
index 998bf80abf007f7accb5ccfd98382d63c7e248de..ac7f61ddfbca131d0ee601cc266014de1e6e1a7e 100644 (file)
@@ -310,7 +310,7 @@ gdb_test_multiple "" "$test" {
     -re "^info $" {
        send_gdb "\n"
        gdb_test_multiple "" "$test" {
-           -re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands.*$gdb_prompt $" {
+           -re "List of info subcommands.*$gdb_prompt $" {
                pass "$test"
            }
        }
@@ -323,7 +323,7 @@ gdb_test_multiple "" "$test" {
     -re "^info \\\x07$" {
        send_gdb "\n"
        gdb_test_multiple "" "$test" {
-           -re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\n.*$gdb_prompt $" {
+           -re "List of info subcommands:\r\n\r\n.*$gdb_prompt $" {
                pass "$test"
            }
        }
@@ -339,7 +339,7 @@ gdb_test_multiple "" "$test" {
            -re "address.*types.*$gdb_prompt " {
                send_gdb "\n"
                gdb_test_multiple "" "$test" {
-                   -re "\"info\".*unambiguous\\..*$gdb_prompt $" {
+                   -re "allowed if unambiguous\\..*$gdb_prompt $" {
                        pass "$test"
                    }
                }
index c51ec63eccffc702f495614203ccc29858d77b44..846c91af6bc5cc56436349b055f2a9fe427a5d5f 100644 (file)
@@ -28,8 +28,8 @@ set timeout 60
 gdb_test "add-symbol-file" "add-symbol-file takes a file name and an address"
 
 # test append
-gdb_test "append" "\"append\" must be followed by a subcommand\.\[\r\n\]+List of append subcommands:.*" 
-gdb_test "append binary" "\"append binary\" must be followed by a subcommand\.\[\r\n\]+List of append binary subcommands:.*" 
+gdb_test "append" "List of append subcommands:.*" 
+gdb_test "append binary" "List of append binary subcommands:.*" 
 gdb_test "append memory" "Missing filename\." 
 gdb_test "append value"  "Missing filename\." 
 gdb_test "append binary memory" "Missing filename\." 
@@ -147,12 +147,12 @@ gdb_test "down" "No stack.*"
 #test down-silently
 gdb_test "down-silently" "No stack."
 # test dump
-gdb_test "dump" "\"dump\" must be followed by a subcommand\.\[\r\n\]+List of dump subcommands:.*" 
-gdb_test "dump binary" "\"dump binary\" must be followed by a subcommand\.\[\r\n\]+List of dump binary subcommands:.*" 
-gdb_test "dump ihex" "\"dump ihex\" must be followed by a subcommand\.\[\r\n\]+List of dump ihex subcommands:.*" 
+gdb_test "dump" "List of dump subcommands:.*" 
+gdb_test "dump binary" "List of dump binary subcommands:.*" 
+gdb_test "dump ihex" "List of dump ihex subcommands:.*" 
 gdb_test "dump memory" "Missing filename\." 
-gdb_test "dump srec" "\"dump srec\" must be followed by a subcommand\.\[\r\n\]+List of dump srec subcommands:.*" 
-gdb_test "dump tekhex" "\"dump tekhex\" must be followed by a subcommand\.\[\r\n\]+List of dump tekhex subcommands:.*" 
+gdb_test "dump srec" "List of dump srec subcommands:.*" 
+gdb_test "dump tekhex" "List of dump tekhex subcommands:.*" 
 gdb_test "dump value" "Missing filename\." 
 gdb_test "dump binary memory" "Missing filename\." 
 gdb_test "dump binary value"  "Missing filename\." 
@@ -253,9 +253,9 @@ gdb_test "help" "List of classes of commands:(\[^\r\n\]*\[\r\n\])+aliases -- Ali
 #test handle
 gdb_test "handle" "Argument required .signal to handle.*"
 #test info "i" abbreviation 
-gdb_test "i" "\"info\" must be followed by the name of an info command.(\[^\r\n\]*\[\r\n\])+List of info subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by info subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "info \"i\" abbreviation"
+gdb_test "i" "List of info subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by info subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "info \"i\" abbreviation"
 #test info
-gdb_test "info" "\"info\" must be followed by the name of an info command.(\[^\r\n\]*\[\r\n\])+List of info subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by info subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
+gdb_test "info" "List of info subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help info\" followed by info subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
 #test ignore
 gdb_test "ignore" "Argument required .a breakpoint number.*"
 #test info address
@@ -378,7 +378,7 @@ gdb_test "nexti" "The program is not being run."
 gdb_test "output" "Argument required .expression to compute.*"
 
 #test overlay
-gdb_test "overlay" "\"overlay\" must be followed by the name of .*"
+gdb_test "overlay" "List of overlay subcommands:.*"
 #test a non-existant overlay subcommand
 gdb_test "overlay on"     "Undefined overlay command.* Try \"help overlay\"."
 gdb_test_no_output "overlay manual" "overlay manual #1"
@@ -475,7 +475,7 @@ gdb_test_no_output "set args" "set args"
 
 # Test set check abbreviations
 foreach x {"c" "ch" "check"} {
-    gdb_test "set $x" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set strict type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." \
+    gdb_test "set $x" "List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set strict type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." \
        "set check \"$x\" abbreviation"
 }
 
@@ -505,17 +505,17 @@ gdb_test_no_output "set history save" "set history save"
 #test set history size
 gdb_test "set history size" "Argument required .integer to set it to.*"
 #test set history
-gdb_test "set history" "\"set history\" must be followed by the name of a history subcommand.(\[^\r\n\]*\[\r\n\])+List of set history subcommands:(\[^\r\n\]*\[\r\n\])+set history expansion -- Set history expansion on command input(\[^\r\n\]*\[\r\n\])+set history filename -- Set the filename in which to record the command history(\[^\r\n\]*\[\r\n\])+set history save -- Set saving of the history record on exit(\[^\r\n\]*\[\r\n\])+set history size -- Set the size of the command history(\[^\r\n\]*\[\r\n\])+Type \"help set history\" followed by set history subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
+gdb_test "set history" "List of set history subcommands:(\[^\r\n\]*\[\r\n\])+set history expansion -- Set history expansion on command input(\[^\r\n\]*\[\r\n\])+set history filename -- Set the filename in which to record the command history(\[^\r\n\]*\[\r\n\])+set history save -- Set saving of the history record on exit(\[^\r\n\]*\[\r\n\])+set history size -- Set the size of the command history(\[^\r\n\]*\[\r\n\])+Type \"help set history\" followed by set history subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
 #test set language
 gdb_test "set language" "Requires an argument. Valid arguments are auto, local, unknown, ada, asm, c, c.., d, fortran, go, minimal, modula-2, objective-c, opencl, pascal, rust."
 #test set listsize
 gdb_test "set listsize" "Argument required .integer to set it to.*"
 #test set print "p" abbreviation
-gdb_test "set p" "\"set print\" must be followed by the name of a print subcommand.(\[^\r\n\]*\[\r\n\])+List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"p\" abbreviation"
+gdb_test "set p" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"p\" abbreviation"
 #test set print "pr" abbreviation
-gdb_test "set pr" "\"set print\" must be followed by the name of a print subcommand.(\[^\r\n\]*\[\r\n\])+List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"pr\" abbreviation"
+gdb_test "set pr" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set print \"pr\" abbreviation"
 #test set print
-gdb_test "set print" "\"set print\" must be followed by the name of a print subcommand.(\[^\r\n\]*\[\r\n\])+List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
+gdb_test "set print" "List of set print subcommands:(\[^\r\n\]*\[\r\n\])+Type \"help set print\" followed by set print subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
 #test set print address
 gdb_test_no_output "set print address" "set print address"
 #test set print array
@@ -827,7 +827,7 @@ gdb_test "unset environment" \
     "y"
 
 #test unset
-gdb_test "unset" "\"unset\" must be followed by the name of an unset subcommand.(\[^\r\n\]*\[\r\n\])+List of unset subcommands:(\[^\r\n\]*\[\r\n\])+unset environment -- Cancel environment variable VAR for the program(\[^\r\n\]*\[\r\n\])+Type \"help unset\" followed by unset subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
+gdb_test "unset" "List of unset subcommands:(\[^\r\n\]*\[\r\n\])+unset environment -- Cancel environment variable VAR for the program(\[^\r\n\]*\[\r\n\])+Type \"help unset\" followed by unset subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous."
 #test up
 #test up-silently
 gdb_test "up-silently" "No stack."
index 3431f2c6dc54436ec1bc0de53ba63b0f50e181b1..00fe8c296cdaadf894f8a2c346e453cab6344b6c 100644 (file)
@@ -487,15 +487,15 @@ gdb_test_multiple "maint info breakpoints" "maint info breakpoints" {
 }
 
 gdb_test "maint print" \
-    "\"maintenance print\" must be followed by the name of a print command\\.\r\nList.*unambiguous\\..*" \
+    "List.*unambiguous\\..*" \
     "maint print w/o args" 
 
 gdb_test "maint info" \
-    "\"maintenance info\" must be followed by the name of an info command\\.\r\nList.*unambiguous\\..*" \
+    "List.*unambiguous\\..*" \
     "maint info w/o args"
 
 gdb_test "maint" \
-    "\"maintenance\" must be followed by the name of a maintenance command\\.\r\nList.*unambiguous\\..*" \
+    "List.*unambiguous\\..*" \
     "maint w/o args"
 
 # Test that "main info line-table" w/o a file name shows the symtab for
index 23e896d5cfadfe6b384b545faa64d233c5c38e4b..a3f7317915bf2261f5aeae1b707f016647e342fd 100644 (file)
@@ -42,9 +42,9 @@ proc test_junk { arg junk current } {
 gdb_test "show record btrace cpu" "btrace cpu is 'auto'\." "default cpu"
 
 gdb_test "set record" \
-    "\"set record\" must be followed by an appropriate subcommand.*"
+    "List of set record subcommands.*"
 gdb_test "set record btrace" \
-    "\"set record btrace\" must be followed by an appropriate subcommand.*"
+    "List of set record btrace subcommands.*"
 test_bad "" "auto"
 
 test_good "intel: 0/0"
index df0a143480a5977baeb9a8a6f90ad67b0c9aa635..5d0eabe42dcf18d75f10ac5056b38117449e5795 100644 (file)
@@ -32,9 +32,9 @@ proc test_help {} {
         "C\\+\\+ maintenance commands.\r\n\r\n"
     }
 
-    set multiple_help_body "List of maintenance cplus subcommands:\r\n\r\nmaintenance cplus first_component -- ${first_component_help}\r\nmaintenance cplus namespace -- ${namespace_help}\r\n\r\nType \"help maintenance cplus\" followed by maintenance cplus subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous."
+    set multiple_help_body "List of maintenance cplus subcommands:.*Command name abbreviations are allowed if unambiguous."
 
-    gdb_test "maint cp" "\"maintenance cplus\" must be followed by the name of a command.\r\n.*"
+    gdb_test "maint cp" $multiple_help_body
 
     gdb_test "help maint cp first_component" "${first_component_help}."
     gdb_test "help maint cp namespace" "${namespace_help}."
index 8b82bd3c038b521ae66c6ecdd2578d88f6e9535b..9fb9d5cb5c7eeb3b9378b92291b34eef07230c88 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1949,20 +1949,6 @@ set_history_size_command (const char *args,
   set_readline_history_size (history_size_setshow_var);
 }
 
-void
-set_history (const char *args, int from_tty)
-{
-  printf_unfiltered (_("\"set history\" must be followed "
-                      "by the name of a history subcommand.\n"));
-  help_list (sethistlist, "set history ", all_commands, gdb_stdout);
-}
-
-void
-show_history (const char *args, int from_tty)
-{
-  cmd_show_list (showhistlist, from_tty, "");
-}
-
 bool info_verbose = false;     /* Default verbose msgs off.  */
 
 /* Called by do_set_command.  An elaborate joke.  */
index 2147e2d4b482425d0defbe7019d05ee1586f3e29..0cbb244c5515c9bd4d2b09e8bf91c65f0a377a55 100644 (file)
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -288,10 +288,6 @@ extern void gdb_add_history (const char *);
 
 extern void show_commands (const char *args, int from_tty);
 
-extern void set_history (const char *, int);
-
-extern void show_history (const char *, int);
-
 extern void set_verbose (const char *, int, struct cmd_list_element *);
 
 extern char *handle_line_of_input (struct buffer *cmd_line_buffer,
index 9014889a7650f47b9c93f49683107188a7956697..491ce275acbed2756e8fbeac341f607d42cef85e 100644 (file)
@@ -45,7 +45,6 @@
 #include "tui/tui-source.h"
 #include "gdb_curses.h"
 
-static void tui_layout_command (const char *, int);
 static void extract_display_start_addr (struct gdbarch **, CORE_ADDR *);
 
 /* The layouts.  */
@@ -1023,14 +1022,6 @@ tui_new_layout_command (const char *spec, int from_tty)
   new_layout.release ();
 }
 
-/* Base command for "layout".  */
-
-static void
-tui_layout_command (const char *layout_name, int from_tty)
-{
-  help_list (layout_list, "layout ", all_commands, gdb_stdout);
-}
-
 /* Function to initialize gdb commands, for tui window layout
    manipulation.  */
 
@@ -1038,10 +1029,10 @@ void _initialize_tui_layout ();
 void
 _initialize_tui_layout ()
 {
-  add_prefix_cmd ("layout", class_tui, tui_layout_command, _("\
+  add_basic_prefix_cmd ("layout", class_tui, _("\
 Change the layout of windows.\n\
 Usage: layout prev | next | LAYOUT-NAME"),
-                 &layout_list, "layout ", 0, &cmdlist);
+                       &layout_list, "layout ", 0, &cmdlist);
 
   add_cmd ("next", class_tui, tui_next_layout_command,
           _("Apply the next TUI layout."),
index 7cb4aa9bbd4f7a9b2808036f4e7368b1da1613e7..6546793d6bd87ab0585df2f1d23946163f459902 100644 (file)
@@ -310,21 +310,13 @@ show_tui_cmd (const char *args, int from_tty)
 
 static struct cmd_list_element *tuilist;
 
-static void
-tui_command (const char *args, int from_tty)
-{
-  printf_unfiltered (_("\"tui\" must be followed by the name of a "
-                     "tui command.\n"));
-  help_list (tuilist, "tui ", all_commands, gdb_stdout);
-}
-
 struct cmd_list_element **
 tui_get_cmd_list (void)
 {
   if (tuilist == 0)
-    add_prefix_cmd ("tui", class_tui, tui_command,
-                    _("Text User Interface commands."),
-                    &tuilist, "tui ", 0, &cmdlist);
+    add_basic_prefix_cmd ("tui", class_tui,
+                         _("Text User Interface commands."),
+                         &tuilist, "tui ", 0, &cmdlist);
   return &tuilist;
 }
 
index e58cd5da289c86a996149c27e0653e38ad916fa6..87da8e3e932ad297bfad9cf632802ea5d8d37b6b 100644 (file)
@@ -715,20 +715,6 @@ struct cmd_list_element *setprinttypelist;
 
 struct cmd_list_element *showprinttypelist;
 
-static void
-set_print_type (const char *arg, int from_tty)
-{
-  printf_unfiltered (
-     "\"set print type\" must be followed by the name of a subcommand.\n");
-  help_list (setprintlist, "set print type ", all_commands, gdb_stdout);
-}
-
-static void
-show_print_type (const char *args, int from_tty)
-{
-  cmd_show_list (showprinttypelist, from_tty, "");
-}
-
 static bool print_methods = true;
 
 static void
@@ -827,12 +813,14 @@ Available FLAGS are:\n\
 Only one level of typedefs is unrolled.  See also \"ptype\"."));
   set_cmd_completer (c, expression_completer);
 
-  add_prefix_cmd ("type", no_class, show_print_type,
-                 _("Generic command for showing type-printing settings."),
-                 &showprinttypelist, "show print type ", 0, &showprintlist);
-  add_prefix_cmd ("type", no_class, set_print_type,
-                 _("Generic command for setting how types print."),
-                 &setprinttypelist, "set print type ", 0, &setprintlist);
+  add_show_prefix_cmd ("type", no_class,
+                      _("Generic command for showing type-printing settings."),
+                      &showprinttypelist, "show print type ", 0,
+                      &showprintlist);
+  add_basic_prefix_cmd ("type", no_class,
+                       _("Generic command for setting how types print."),
+                       &setprinttypelist, "set print type ", 0,
+                       &setprintlist);
 
   add_setshow_boolean_cmd ("methods", no_class, &print_methods,
                           _("\
index 80b7514b7e3b8fdef98f1acc91a381a0bbb92a37..0be7c6071b7efad74600f93ffc7f6e99ec29dab8 100644 (file)
@@ -2942,34 +2942,6 @@ show_radix (const char *arg, int from_tty)
 }
 \f
 
-static void
-set_print (const char *arg, int from_tty)
-{
-  printf_unfiltered (
-     "\"set print\" must be followed by the name of a print subcommand.\n");
-  help_list (setprintlist, "set print ", all_commands, gdb_stdout);
-}
-
-static void
-show_print (const char *args, int from_tty)
-{
-  cmd_show_list (showprintlist, from_tty, "");
-}
-
-static void
-set_print_raw (const char *arg, int from_tty)
-{
-  printf_unfiltered (
-     "\"set print raw\" must be followed by the name of a \"print raw\" subcommand.\n");
-  help_list (setprintrawlist, "set print raw ", all_commands, gdb_stdout);
-}
-
-static void
-show_print_raw (const char *args, int from_tty)
-{
-  cmd_show_list (showprintrawlist, from_tty, "");
-}
-
 /* Controls printing of vtbl's.  */
 static void
 show_vtblprint (struct ui_file *file, int from_tty,
@@ -3161,30 +3133,30 @@ _initialize_valprint ()
 {
   cmd_list_element *cmd;
 
-  add_prefix_cmd ("print", no_class, set_print,
-                 _("Generic command for setting how things print."),
-                 &setprintlist, "set print ", 0, &setlist);
+  add_basic_prefix_cmd ("print", no_class,
+                       _("Generic command for setting how things print."),
+                       &setprintlist, "set print ", 0, &setlist);
   add_alias_cmd ("p", "print", no_class, 1, &setlist);
   /* Prefer set print to set prompt.  */
   add_alias_cmd ("pr", "print", no_class, 1, &setlist);
 
-  add_prefix_cmd ("print", no_class, show_print,
-                 _("Generic command for showing print settings."),
-                 &showprintlist, "show print ", 0, &showlist);
+  add_show_prefix_cmd ("print", no_class,
+                      _("Generic command for showing print settings."),
+                      &showprintlist, "show print ", 0, &showlist);
   add_alias_cmd ("p", "print", no_class, 1, &showlist);
   add_alias_cmd ("pr", "print", no_class, 1, &showlist);
 
-  cmd = add_prefix_cmd ("raw", no_class, set_print_raw,
-                       _("\
+  cmd = add_basic_prefix_cmd ("raw", no_class,
+                             _("\
 Generic command for setting what things to print in \"raw\" mode."),
-                       &setprintrawlist, "set print raw ", 0,
-                       &setprintlist);
+                             &setprintrawlist, "set print raw ", 0,
+                             &setprintlist);
   deprecate_cmd (cmd, nullptr);
 
-  cmd = add_prefix_cmd ("raw", no_class, show_print_raw,
-                       _("Generic command for showing \"print raw\" settings."),
-                       &showprintrawlist, "show print raw ", 0,
-                       &showprintlist);
+  cmd = add_show_prefix_cmd ("raw", no_class,
+                            _("Generic command for showing \"print raw\" settings."),
+                            &showprintrawlist, "show print raw ", 0,
+                            &showprintlist);
   deprecate_cmd (cmd, nullptr);
 
   gdb::option::add_setshow_cmds_for_options
index 13eaf8f1cabd636ad549d03baac83bfb628f5983..4af797f946960c3ee9b793ca8af15cfffcecea60 100644 (file)
@@ -602,25 +602,6 @@ show_maint_show_all_tib (struct ui_file *file, int from_tty,
                            "Thread Information Block is %s.\n"), value);
 }
 
-static void
-info_w32_command (const char *args, int from_tty)
-{
-  help_list (info_w32_cmdlist, "info w32 ", class_info, gdb_stdout);
-}
-
-static int w32_prefix_command_valid = 0;
-void
-init_w32_command_list (void)
-{
-  if (!w32_prefix_command_valid)
-    {
-      add_prefix_cmd ("w32", class_info, info_w32_command,
-                     _("Print information specific to Win32 debugging."),
-                     &info_w32_cmdlist, "info w32 ", 0, &infolist);
-      w32_prefix_command_valid = 1;
-    }
-}
-
 /* Implementation of `gdbarch_gdb_signal_to_target' for Windows.  */
 
 static int
@@ -1096,7 +1077,10 @@ _initialize_windows_tdep ()
   windows_gdbarch_data_handle
     = gdbarch_data_register_post_init (init_windows_gdbarch_data);
 
-  init_w32_command_list ();
+  add_basic_prefix_cmd ("w32", class_info,
+                       _("Print information specific to Win32 debugging."),
+                       &info_w32_cmdlist, "info w32 ", 0, &infolist);
+
   add_cmd ("thread-information-block", class_info, display_tib,
           _("Display thread information block."),
           &info_w32_cmdlist);