gdb: add add_setshow_prefix_cmd

There's a common pattern to call add_basic_prefix_cmd and
add_show_prefix_cmd to add matching set and show commands.  Add the
add_setshow_prefix_cmd function to factor that out and use it at a few
places.

Change-Id: I6e9e90a30e9efb7b255bf839cac27b85d7069cfd
This commit is contained in:
Simon Marchi 2021-09-22 13:43:25 -04:00 committed by Simon Marchi
parent 5ad2694b1e
commit f54bdb6d27
34 changed files with 276 additions and 325 deletions

View File

@ -13508,13 +13508,12 @@ _initialize_ada_language ()
{
initialize_ada_catchpoint_ops ();
add_basic_prefix_cmd ("ada", no_class,
_("Prefix command for changing Ada-specific settings."),
&set_ada_list, 0, &setlist);
add_show_prefix_cmd ("ada", no_class,
_("Generic command for showing Ada-specific settings."),
&show_ada_list, 0, &showlist);
add_setshow_prefix_cmd
("ada", no_class,
_("Prefix command for changing Ada-specific settings."),
_("Generic command for showing Ada-specific settings."),
&set_ada_list, &show_ada_list,
&setlist, &showlist);
add_setshow_boolean_cmd ("trust-PAD-over-XVS", class_obscure,
&trust_pad_over_xvs, _("\
@ -13582,15 +13581,11 @@ Usage: info exceptions [REGEXP]\n\
If a regular expression is passed as an argument, only those matching\n\
the regular expression are listed."));
add_basic_prefix_cmd ("ada", class_maintenance,
_("Set Ada maintenance-related variables."),
&maint_set_ada_cmdlist,
0/*allow-unknown*/, &maintenance_set_cmdlist);
add_show_prefix_cmd ("ada", class_maintenance,
_("Show Ada maintenance-related variables."),
&maint_show_ada_cmdlist,
0/*allow-unknown*/, &maintenance_show_cmdlist);
add_setshow_prefix_cmd ("ada", class_maintenance,
_("Set Ada maintenance-related variables."),
_("Show Ada maintenance-related variables."),
&maint_set_ada_cmdlist, &maint_show_ada_cmdlist,
&maintenance_set_cmdlist, &maintenance_show_cmdlist);
add_setshow_boolean_cmd
("ignore-descriptive-types", class_maintenance,

View File

@ -9759,14 +9759,11 @@ _initialize_arm_tdep ()
arm_elf_osabi_sniffer);
/* Add root prefix command for all "set arm"/"show arm" commands. */
add_basic_prefix_cmd ("arm", no_class,
_("Various ARM-specific commands."),
&setarmcmdlist, 0, &setlist);
add_show_prefix_cmd ("arm", no_class,
_("Various ARM-specific commands."),
&showarmcmdlist, 0, &showlist);
add_setshow_prefix_cmd ("arm", no_class,
_("Various ARM-specific commands."),
_("Various ARM-specific commands."),
&setarmcmdlist, &showarmcmdlist,
&setlist, &showlist);
arm_disassembler_options = xstrdup ("reg-names-std");
const disasm_options_t *disasm_options

View File

@ -15881,18 +15881,17 @@ Use the 'source' command in another debug session to restore them."),
c = add_com_alias ("save-tracepoints", save_tracepoints_cmd, class_trace, 0);
deprecate_cmd (c, "save tracepoints");
add_basic_prefix_cmd ("breakpoint", class_maintenance, _("\
add_setshow_prefix_cmd ("breakpoint", class_maintenance,
_("\
Breakpoint specific settings.\n\
Configure various breakpoint-specific variables such as\n\
pending breakpoint behavior."),
&breakpoint_set_cmdlist,
0/*allow-unknown*/, &setlist);
add_show_prefix_cmd ("breakpoint", class_maintenance, _("\
_("\
Breakpoint specific settings.\n\
Configure various breakpoint-specific variables such as\n\
pending breakpoint behavior."),
&breakpoint_show_cmdlist,
0/*allow-unknown*/, &showlist);
&breakpoint_set_cmdlist, &breakpoint_show_cmdlist,
&setlist, &showlist);
add_setshow_auto_boolean_cmd ("pending", no_class,
&pending_break_support, _("\

View File

@ -3455,25 +3455,21 @@ _initialize_btrace ()
_("Branch tracing maintenance commands."),
&maint_btrace_cmdlist, 0, &maintenancelist);
add_basic_prefix_cmd ("btrace", class_maintenance, _("\
Set branch tracing specific variables."),
&maint_btrace_set_cmdlist,
0, &maintenance_set_cmdlist);
add_setshow_prefix_cmd ("btrace", class_maintenance,
_("Set branch tracing specific variables."),
_("Show branch tracing specific variables."),
&maint_btrace_set_cmdlist,
&maint_btrace_show_cmdlist,
&maintenance_set_cmdlist,
&maintenance_show_cmdlist);
add_basic_prefix_cmd ("pt", class_maintenance, _("\
Set Intel Processor Trace specific variables."),
&maint_btrace_pt_set_cmdlist,
0, &maint_btrace_set_cmdlist);
add_show_prefix_cmd ("btrace", class_maintenance, _("\
Show branch tracing specific variables."),
&maint_btrace_show_cmdlist,
0, &maintenance_show_cmdlist);
add_show_prefix_cmd ("pt", class_maintenance, _("\
Show Intel Processor Trace specific variables."),
&maint_btrace_pt_show_cmdlist,
0, &maint_btrace_show_cmdlist);
add_setshow_prefix_cmd ("pt", class_maintenance,
_("Set Intel Processor Trace specific variables."),
_("Show Intel Processor Trace specific variables."),
&maint_btrace_pt_set_cmdlist,
&maint_btrace_pt_show_cmdlist,
&maint_btrace_set_cmdlist,
&maint_btrace_show_cmdlist);
add_setshow_boolean_cmd ("skip-pad", class_maintenance,
&maint_btrace_pt_skip_pad, _("\

View File

@ -2394,12 +2394,11 @@ Show verbosity."), NULL,
show_info_verbose,
&setlist, &showlist);
add_basic_prefix_cmd ("history", class_support, _("\
Generic command for setting command history parameters."),
&sethistlist, 0, &setlist);
add_show_prefix_cmd ("history", class_support, _("\
Generic command for showing command history parameters."),
&showhistlist, 0, &showlist);
add_setshow_prefix_cmd
("history", class_support,
_("Generic command for setting command history parameters."),
_("Generic command for showing command history parameters."),
&sethistlist, &showhistlist, &setlist, &showlist);
add_setshow_boolean_cmd ("expansion", no_class, &history_expansion_p, _("\
Set history expansion on command input."), _("\
@ -2493,13 +2492,11 @@ the previous command number shown."),
add_cmd ("configuration", no_set_class, show_configuration,
_("Show how GDB was configured at build time."), &showlist);
add_basic_prefix_cmd ("debug", no_class,
_("Generic command for setting gdb debugging flags."),
&setdebuglist, 0, &setlist);
add_show_prefix_cmd ("debug", no_class,
_("Generic command for showing gdb debugging flags."),
&showdebuglist, 0, &showlist);
add_setshow_prefix_cmd ("debug", no_class,
_("Generic command for setting gdb debugging flags."),
_("Generic command for showing gdb debugging flags."),
&setdebuglist, &showdebuglist,
&setlist, &showlist);
cmd_list_element *shell_cmd
= add_com ("shell", class_support, shell_command, _("\

View File

@ -407,6 +407,28 @@ add_show_prefix_cmd (const char *name, enum command_class theclass,
return cmd;
}
/* See command.h. */
set_show_commands
add_setshow_prefix_cmd (const char *name, command_class theclass,
const char *set_doc, const char *show_doc,
cmd_list_element **set_subcommands_list,
cmd_list_element **show_subcommands_list,
cmd_list_element **set_list,
cmd_list_element **show_list)
{
set_show_commands cmds;
cmds.set = add_basic_prefix_cmd (name, theclass, set_doc,
set_subcommands_list, 0,
set_list);
cmds.show = add_show_prefix_cmd (name, theclass, show_doc,
show_subcommands_list, 0,
show_list);
return cmds;
}
/* Like ADD_PREFIX_CMD but sets the suppress_notification pointer on the
new command list element. */

View File

@ -169,12 +169,12 @@ _initialize_cli_logging ()
{
static struct cmd_list_element *set_logging_cmdlist, *show_logging_cmdlist;
add_basic_prefix_cmd ("logging", class_support,
_("Set logging options."), &set_logging_cmdlist,
0, &setlist);
add_show_prefix_cmd ("logging", class_support,
_("Show logging options."), &show_logging_cmdlist,
0, &showlist);
add_setshow_prefix_cmd ("logging", class_support,
_("Set logging options."),
_("Show logging options."),
&set_logging_cmdlist, &show_logging_cmdlist,
&setlist, &showlist);
add_setshow_boolean_cmd ("overwrite", class_support, &logging_overwrite, _("\
Set whether logging overwrites or appends to the log file."), _("\
Show whether logging overwrites or appends to the log file."), _("\

View File

@ -226,10 +226,9 @@ cli_style_option::add_setshow_commands (enum command_class theclass,
struct cmd_list_element **show_list,
bool skip_intensity)
{
add_basic_prefix_cmd (m_name, no_class, prefix_doc, &m_set_list,
0, set_list);
add_show_prefix_cmd (m_name, no_class, prefix_doc, &m_show_list,
0, show_list);
add_setshow_prefix_cmd (m_name, theclass, prefix_doc, prefix_doc,
&m_set_list, &m_show_list, set_list, show_list);
set_show_commands commands;
commands = add_setshow_enum_cmd
@ -306,14 +305,15 @@ void _initialize_cli_style ();
void
_initialize_cli_style ()
{
add_basic_prefix_cmd ("style", no_class, _("\
add_setshow_prefix_cmd ("style", no_class,
_("\
Style-specific settings.\n\
Configure various style-related variables, such as colors"),
&style_set_list, 0, &setlist);
add_show_prefix_cmd ("style", no_class, _("\
_("\
Style-specific settings.\n\
Configure various style-related variables, such as colors"),
&style_show_list, 0, &showlist);
&style_set_list, &style_show_list,
&setlist, &showlist);
add_setshow_boolean_cmd ("enabled", no_class, &cli_styling, _("\
Set whether CLI styling is enabled."), _("\

View File

@ -382,6 +382,13 @@ extern bool valid_user_defined_cmd_name_p (const char *name);
extern bool valid_cmd_char_p (int c);
/* Return value type for the add_setshow_* functions. */
struct set_show_commands
{
cmd_list_element *set, *show;
};
/* Const-correct variant of the above. */
extern struct cmd_list_element *add_cmd (const char *, enum command_class,
@ -428,6 +435,17 @@ extern struct cmd_list_element *add_show_prefix_cmd
(const char *, enum command_class, const char *, struct cmd_list_element **,
int, struct cmd_list_element **);
/* Add matching set and show commands using add_basic_prefix_cmd and
add_show_prefix_cmd. */
extern set_show_commands add_setshow_prefix_cmd
(const char *name, command_class theclass, const char *set_doc,
const char *show_doc,
cmd_list_element **set_subcommands_list,
cmd_list_element **show_subcommands_list,
cmd_list_element **set_list,
cmd_list_element **show_list);
extern struct cmd_list_element *add_prefix_cmd_suppress_notification
(const char *name, enum command_class theclass,
cmd_simple_func_ftype *fun,
@ -616,13 +634,6 @@ typedef void (show_value_ftype) (struct ui_file *file,
instead print the value out directly. */
extern show_value_ftype deprecated_show_value_hack;
/* Return value type for the add_setshow_* functions. */
struct set_show_commands
{
cmd_list_element *set, *show;
};
extern set_show_commands add_setshow_enum_cmd
(const char *name, command_class theclass, const char *const *enumlist,
const char **var, const char *set_doc, const char *show_doc,

View File

@ -702,13 +702,12 @@ With no arguments, this command prints the cache configuration and a\n\
summary of each line in the cache. With an argument, dump\"\n\
the contents of the given line."));
add_basic_prefix_cmd ("dcache", class_obscure, _("\
add_setshow_prefix_cmd ("dcache", class_obscure,
_("\
Use this command to set number of lines in dcache and line-size."),
&dcache_set_list, /*allow_unknown*/0, &setlist);
add_show_prefix_cmd ("dcache", class_obscure, _("\
Show dcachesettings."),
&dcache_show_list, /*allow_unknown*/0,
&showlist);
("Show dcache settings."),
&dcache_set_list, &dcache_show_list,
&setlist, &showlist);
add_setshow_zuinteger_cmd ("line-size", class_obscure,
&dcache_line_size, _("\

View File

@ -24889,17 +24889,15 @@ void _initialize_dwarf2_read ();
void
_initialize_dwarf2_read ()
{
add_basic_prefix_cmd ("dwarf", class_maintenance, _("\
add_setshow_prefix_cmd ("dwarf", class_maintenance,
_("\
Set DWARF specific variables.\n\
Configure DWARF variables such as the cache size."),
&set_dwarf_cmdlist,
0/*allow-unknown*/, &maintenance_set_cmdlist);
add_show_prefix_cmd ("dwarf", class_maintenance, _("\
_("\
Show DWARF specific variables.\n\
Show DWARF variables such as the cache size."),
&show_dwarf_cmdlist,
0/*allow-unknown*/, &maintenance_show_cmdlist);
&set_dwarf_cmdlist, &show_dwarf_cmdlist,
&maintenance_set_cmdlist, &maintenance_show_cmdlist);
add_setshow_zinteger_cmd ("max-cache-age", class_obscure,
&dwarf_max_cache_age, _("\

View File

@ -1681,13 +1681,12 @@ _initialize_f_language ()
{
f_type_data = gdbarch_data_register_post_init (build_fortran_types);
add_basic_prefix_cmd ("fortran", no_class,
_("Prefix command for changing Fortran-specific settings."),
&set_fortran_list, 0, &setlist);
add_show_prefix_cmd ("fortran", no_class,
_("Generic command for showing Fortran-specific settings."),
&show_fortran_list, 0, &showlist);
add_setshow_prefix_cmd
("fortran", no_class,
_("Prefix command for changing Fortran-specific settings."),
_("Generic command for showing Fortran-specific settings."),
&set_fortran_list, &show_fortran_list,
&setlist, &showlist);
add_setshow_boolean_cmd ("repack-array-slices", class_vars,
&repack_array_slices, _("\

View File

@ -3129,16 +3129,15 @@ _initialize_frame ()
gdb::observers::target_changed.attach (frame_observer_target_changed,
"frame");
add_basic_prefix_cmd ("backtrace", class_maintenance, _("\
add_setshow_prefix_cmd ("backtrace", class_maintenance,
_("\
Set backtrace specific variables.\n\
Configure backtrace variables such as the backtrace limit"),
&set_backtrace_cmdlist,
0/*allow-unknown*/, &setlist);
add_show_prefix_cmd ("backtrace", class_maintenance, _("\
_("\
Show backtrace specific variables.\n\
Show backtrace variables such as the backtrace limit."),
&show_backtrace_cmdlist,
0/*allow-unknown*/, &showlist);
&set_backtrace_cmdlist, &show_backtrace_cmdlist,
&setlist, &showlist);
add_setshow_uinteger_cmd ("limit", class_obscure,
&user_set_backtrace_options.backtrace_limit, _("\

View File

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

View File

@ -9043,19 +9043,13 @@ is \"default\"."),
NULL, /* FIXME: i18n: */
&setlist, &showlist);
/* Add "mpx" prefix for the set commands. */
/* Add "mpx" prefix for the set and show commands. */
add_basic_prefix_cmd ("mpx", class_support, _("\
Set Intel Memory Protection Extensions specific variables."),
&mpx_set_cmdlist,
0 /* allow-unknown */, &setlist);
/* Add "mpx" prefix for the show commands. */
add_show_prefix_cmd ("mpx", class_support, _("\
Show Intel Memory Protection Extensions specific variables."),
&mpx_show_cmdlist,
0 /* allow-unknown */, &showlist);
add_setshow_prefix_cmd
("mpx", class_support,
_("Set Intel Memory Protection Extensions specific variables."),
_("Show Intel Memory Protection Extensions specific variables."),
&mpx_set_cmdlist, &mpx_show_cmdlist, &setlist, &showlist);
/* Add "bound" command for the show mpx commands list. */

View File

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

View File

@ -85,19 +85,14 @@ _initialize_maint_test_settings ()
{
maintenance_test_settings_filename = xstrdup ("/foo/bar");
add_basic_prefix_cmd ("test-settings", class_maintenance,
_("\
add_setshow_prefix_cmd ("test-settings", class_maintenance,
_("\
Set GDB internal variables used for set/show command infrastructure testing."),
&maintenance_set_test_settings_list,
0/*allow-unknown*/,
&maintenance_set_cmdlist);
add_show_prefix_cmd ("test-settings", class_maintenance,
_("\
_("\
Show GDB internal variables used for set/show command infrastructure testing."),
&maintenance_show_test_settings_list,
0/*allow-unknown*/,
&maintenance_show_cmdlist);
&maintenance_set_test_settings_list,
&maintenance_show_test_settings_list,
&maintenance_set_cmdlist, &maintenance_show_cmdlist);
add_setshow_boolean_cmd ("boolean", class_maintenance,
&maintenance_test_settings_boolean, _("\

View File

@ -623,14 +623,11 @@ Do \"info mem\" to see current list of IDs."), &deletelist);
add_info ("mem", info_mem_command,
_("Memory region attributes."));
add_basic_prefix_cmd ("mem", class_vars, _("\
Memory regions settings."),
&mem_set_cmdlist,
0/* allow-unknown */, &setlist);
add_show_prefix_cmd ("mem", class_vars, _("\
Memory regions settings."),
&mem_show_cmdlist,
0/* allow-unknown */, &showlist);
add_setshow_prefix_cmd ("mem", class_vars,
_("Memory regions settings."),
_("Memory regions settings."),
&mem_set_cmdlist, &mem_show_cmdlist,
&setlist, &showlist);
add_setshow_boolean_cmd ("inaccessible-by-default", no_class,
&inaccessible_by_default, _("\

View File

@ -8942,13 +8942,11 @@ _initialize_mips_tdep ()
set_tdesc_property (mips_tdesc_gp64, PROPERTY_GP64, "");
/* Add root prefix command for all "set mips"/"show mips" commands. */
add_basic_prefix_cmd ("mips", no_class,
_("Various MIPS specific commands."),
&setmipscmdlist, 0, &setlist);
add_show_prefix_cmd ("mips", no_class,
_("Various MIPS specific commands."),
&showmipscmdlist, 0, &showlist);
add_setshow_prefix_cmd ("mips", no_class,
_("Various MIPS specific commands."),
_("Various MIPS specific commands."),
&setmipscmdlist, &showmipscmdlist,
&setlist, &showlist);
/* Allow the user to override the ABI. */
add_setshow_enum_cmd ("abi", class_obscure, mips_abi_strings,

View File

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

View File

@ -718,13 +718,12 @@ _initialize_ravenscar ()
gdb::observers::inferior_created.attach (ravenscar_inferior_created,
"ravenscar-thread");
add_basic_prefix_cmd ("ravenscar", no_class,
_("Prefix command for changing Ravenscar-specific settings."),
&set_ravenscar_list, 0, &setlist);
add_show_prefix_cmd ("ravenscar", no_class,
_("Prefix command for showing Ravenscar-specific settings."),
&show_ravenscar_list, 0, &showlist);
add_setshow_prefix_cmd
("ravenscar", no_class,
_("Prefix command for changing Ravenscar-specific settings."),
_("Prefix command for showing Ravenscar-specific settings."),
&set_ravenscar_list, &show_ravenscar_list,
&setlist, &showlist);
add_setshow_boolean_cmd ("task-switching", class_obscure,
&ravenscar_task_support, _("\

View File

@ -3132,13 +3132,12 @@ This format may not be available on all processors."),
&record_btrace_cmdlist);
add_alias_cmd ("pt", record_btrace_pt_cmd, class_obscure, 1, &record_cmdlist);
add_basic_prefix_cmd ("btrace", class_support,
_("Set record options."), &set_record_btrace_cmdlist,
0, &set_record_cmdlist);
add_show_prefix_cmd ("btrace", class_support,
_("Show record options."), &show_record_btrace_cmdlist,
0, &show_record_cmdlist);
add_setshow_prefix_cmd ("btrace", class_support,
_("Set record options."),
_("Show record options."),
&set_record_btrace_cmdlist,
&show_record_btrace_cmdlist,
&set_record_cmdlist, &show_record_cmdlist);
add_setshow_enum_cmd ("replay-memory-access", no_class,
replay_memory_access_types, &replay_memory_access, _("\
@ -3181,17 +3180,13 @@ Do not enable errata workarounds for trace decode."),
Show the cpu to be used for trace decode."),
&show_record_btrace_cmdlist);
add_basic_prefix_cmd ("bts", class_support,
_("Set record btrace bts options."),
&set_record_btrace_bts_cmdlist,
0,
&set_record_btrace_cmdlist);
add_show_prefix_cmd ("bts", class_support,
_("Show record btrace bts options."),
&show_record_btrace_bts_cmdlist,
0,
&show_record_btrace_cmdlist);
add_setshow_prefix_cmd ("bts", class_support,
_("Set record btrace bts options."),
_("Show record btrace bts options."),
&set_record_btrace_bts_cmdlist,
&show_record_btrace_bts_cmdlist,
&set_record_btrace_cmdlist,
&show_record_btrace_cmdlist);
add_setshow_uinteger_cmd ("buffer-size", no_class,
&record_btrace_conf.bts.size,
@ -3207,17 +3202,13 @@ The trace buffer size may not be changed while recording."), NULL,
&set_record_btrace_bts_cmdlist,
&show_record_btrace_bts_cmdlist);
add_basic_prefix_cmd ("pt", class_support,
_("Set record btrace pt options."),
&set_record_btrace_pt_cmdlist,
0,
&set_record_btrace_cmdlist);
add_show_prefix_cmd ("pt", class_support,
_("Show record btrace pt options."),
&show_record_btrace_pt_cmdlist,
0,
&show_record_btrace_cmdlist);
add_setshow_prefix_cmd ("pt", class_support,
_("Set record btrace pt options."),
_("Show record btrace pt options."),
&set_record_btrace_pt_cmdlist,
&show_record_btrace_pt_cmdlist,
&set_record_btrace_cmdlist,
&show_record_btrace_cmdlist);
add_setshow_uinteger_cmd ("buffer-size", no_class,
&record_btrace_conf.pt.size,

View File

@ -2804,13 +2804,13 @@ Argument is filename. File must be created with 'record save'."),
set_cmd_completer (c, filename_completer);
deprecate_cmd (c, "record full restore");
add_basic_prefix_cmd ("full", class_support,
_("Set record options."), &set_record_full_cmdlist,
0, &set_record_cmdlist);
add_show_prefix_cmd ("full", class_support,
_("Show record options."), &show_record_full_cmdlist,
0, &show_record_cmdlist);
add_setshow_prefix_cmd ("full", class_support,
_("Set record options."),
_("Show record options."),
&set_record_full_cmdlist,
&show_record_full_cmdlist,
&set_record_cmdlist,
&show_record_cmdlist);
/* Record instructions number limit command. */
set_show_commands set_record_full_stop_at_limit_cmds

View File

@ -793,17 +793,16 @@ A size of \"unlimited\" means unlimited lines. The default is 10."),
add_com_alias ("rec", record_cmd, class_obscure, 1);
cmd_list_element *set_record_cmd
= add_basic_prefix_cmd ("record", class_support,
_("Set record options."), &set_record_cmdlist,
0, &setlist);
add_alias_cmd ("rec", set_record_cmd, class_obscure, 1, &setlist);
set_show_commands setshow_record_cmds
= add_setshow_prefix_cmd ("record", class_support,
_("Set record options."),
_("Show record options."),
&set_record_cmdlist, &show_record_cmdlist,
&setlist, &showlist);
cmd_list_element *show_record_cmd
= add_show_prefix_cmd ("record", class_support,
_("Show record options."), &show_record_cmdlist,
0, &showlist);
add_alias_cmd ("rec", show_record_cmd, class_obscure, 1, &showlist);
add_alias_cmd ("rec", setshow_record_cmds.set, class_obscure, 1, &setlist);
add_alias_cmd ("rec", setshow_record_cmds.show, class_obscure, 1, &showlist);
cmd_list_element *info_record_cmd
= add_prefix_cmd ("record", class_support, info_record_command,

View File

@ -4018,15 +4018,11 @@ _initialize_riscv_tdep ()
/* Add root prefix command for all "set debug riscv" and "show debug
riscv" commands. */
add_basic_prefix_cmd ("riscv", no_class,
_("RISC-V specific debug commands."),
&setdebugriscvcmdlist, 0,
&setdebuglist);
add_show_prefix_cmd ("riscv", no_class,
_("RISC-V specific debug commands."),
&showdebugriscvcmdlist, 0,
&showdebuglist);
add_setshow_prefix_cmd ("riscv", no_class,
_("RISC-V specific debug commands."),
_("RISC-V specific debug commands."),
&setdebugriscvcmdlist, &showdebugriscvcmdlist,
&setdebuglist, &showdebuglist);
add_setshow_zuinteger_cmd ("breakpoints", class_maintenance,
&riscv_debug_breakpoints, _("\
@ -4069,13 +4065,11 @@ initialisation process."),
&setdebugriscvcmdlist, &showdebugriscvcmdlist);
/* Add root prefix command for all "set riscv" and "show riscv" commands. */
add_basic_prefix_cmd ("riscv", no_class,
_("RISC-V specific commands."),
&setriscvcmdlist, 0, &setlist);
add_show_prefix_cmd ("riscv", no_class,
_("RISC-V specific commands."),
&showriscvcmdlist, 0, &showlist);
add_setshow_prefix_cmd ("riscv", no_class,
_("RISC-V specific commands."),
_("RISC-V specific commands."),
&setriscvcmdlist, &showriscvcmdlist,
&setlist, &showlist);
use_compressed_breakpoints = AUTO_BOOLEAN_AUTO;

View File

@ -7411,13 +7411,11 @@ _initialize_rs6000_tdep ()
/* Add root prefix command for all "set powerpc"/"show powerpc"
commands. */
add_basic_prefix_cmd ("powerpc", no_class,
_("Various PowerPC-specific commands."),
&setpowerpccmdlist, 0, &setlist);
add_show_prefix_cmd ("powerpc", no_class,
_("Various PowerPC-specific commands."),
&showpowerpccmdlist, 0, &showlist);
add_setshow_prefix_cmd ("powerpc", no_class,
_("Various PowerPC-specific commands."),
_("Various PowerPC-specific commands."),
&setpowerpccmdlist, &showpowerpccmdlist,
&setlist, &showlist);
/* Add a command to allow the user to force the ABI. */
add_setshow_auto_boolean_cmd ("soft-float", class_support,

View File

@ -466,16 +466,15 @@ _initialize_ser_tcp ()
serial_add_interface (&tcp_ops);
#endif /* USE_WIN32API */
add_basic_prefix_cmd ("tcp", class_maintenance, _("\
add_setshow_prefix_cmd ("tcp", class_maintenance,
_("\
TCP protocol specific variables.\n\
Configure variables specific to remote TCP connections."),
&tcp_set_cmdlist,
0 /* allow-unknown */, &setlist);
add_show_prefix_cmd ("tcp", class_maintenance, _("\
_("\
TCP protocol specific variables.\n\
Configure variables specific to remote TCP connections."),
&tcp_show_cmdlist,
0 /* allow-unknown */, &showlist);
&tcp_set_cmdlist, &tcp_show_cmdlist,
&setlist, &showlist);
add_setshow_boolean_cmd ("auto-retry", class_obscure,
&tcp_auto_retry, _("\

View File

@ -669,17 +669,11 @@ Connect the terminal directly up to the command monitor.\n\
Use <CR>~. or <CR>~^D to break out."));
#endif /* 0 */
add_basic_prefix_cmd ("serial", class_maintenance, _("\
Set default serial/parallel port configuration."),
&serial_set_cmdlist,
0/*allow-unknown*/,
&setlist);
add_show_prefix_cmd ("serial", class_maintenance, _("\
Show default serial/parallel port configuration."),
&serial_show_cmdlist,
0/*allow-unknown*/,
&showlist);
add_setshow_prefix_cmd ("serial", class_maintenance,
_("Set default serial/parallel port configuration."),
_("Show default serial/parallel port configuration."),
&serial_set_cmdlist, &serial_show_cmdlist,
&setlist, &showlist);
/* If target is open when baud changes, it doesn't take effect until
the next open (I think, not sure). */

View File

@ -2416,10 +2416,11 @@ _initialize_sh_tdep ()
{
gdbarch_register (bfd_arch_sh, sh_gdbarch_init, NULL);
add_basic_prefix_cmd ("sh", no_class, "SH specific commands.",
&setshcmdlist, 0, &setlist);
add_show_prefix_cmd ("sh", no_class, "SH specific commands.",
&showshcmdlist, 0, &showlist);
add_setshow_prefix_cmd ("sh", no_class,
_("SH specific commands."),
_("SH specific commands."),
&setshcmdlist, &showshcmdlist,
&setlist, &showlist);
add_setshow_enum_cmd ("calling-convention", class_vars, sh_cc_enum,
&sh_active_calling_convention,

View File

@ -1962,14 +1962,12 @@ _initialize_target_descriptions ()
tdesc_data = gdbarch_data_register_pre_init (tdesc_data_init);
add_basic_prefix_cmd ("tdesc", class_maintenance, _("\
Set target description specific variables."),
&tdesc_set_cmdlist,
0 /* allow-unknown */, &setlist);
add_show_prefix_cmd ("tdesc", class_maintenance, _("\
Show target description specific variables."),
&tdesc_show_cmdlist,
0 /* allow-unknown */, &showlist);
add_setshow_prefix_cmd ("tdesc", class_maintenance,
_("Set target description specific variables."),
_("Show target description specific variables."),
&tdesc_set_cmdlist, &tdesc_show_cmdlist,
&setlist, &showlist);
add_basic_prefix_cmd ("tdesc", class_maintenance, _("\
Unset target description specific variables."),
&tdesc_unset_cmdlist,

View File

@ -987,12 +987,11 @@ _initialize_tui_win ()
/* Define the classes of commands.
They will appear in the help list in the reverse of this order. */
add_basic_prefix_cmd ("tui", class_tui,
_("TUI configuration variables."),
&tui_setlist, 0 /* allow-unknown */, &setlist);
add_show_prefix_cmd ("tui", class_tui,
_("TUI configuration variables."),
&tui_showlist, 0 /* allow-unknown */, &showlist);
add_setshow_prefix_cmd ("tui", class_tui,
_("TUI configuration variables."),
_("TUI configuration variables."),
&tui_setlist, &tui_showlist,
&setlist, &showlist);
add_com ("refresh", class_tui, tui_refresh_all_command,
_("Refresh the terminal display."));

View File

@ -851,12 +851,11 @@ Available FLAGS are:\n\
Only one level of typedefs is unrolled. See also \"ptype\"."));
set_cmd_completer (c, expression_completer);
add_show_prefix_cmd ("type", no_class,
_("Generic command for showing type-printing settings."),
&showprinttypelist, 0, &showprintlist);
add_basic_prefix_cmd ("type", no_class,
_("Generic command for setting how types print."),
&setprinttypelist, 0, &setprintlist);
add_setshow_prefix_cmd ("type", no_class,
_("Generic command for showing type-printing settings."),
_("Generic command for setting how types print."),
&setprinttypelist, &showprinttypelist,
&setprintlist, &showprintlist);
add_setshow_boolean_cmd ("methods", no_class, &print_methods,
_("\

View File

@ -539,13 +539,9 @@ add_internal_problem_command (struct internal_problem *problem)
= xstrprintf (_("Show what GDB does when %s is detected."),
problem->name);
add_basic_prefix_cmd (problem->name, class_maintenance, set_doc,
set_cmd_list,
0/*allow-unknown*/, &maintenance_set_cmdlist);
add_show_prefix_cmd (problem->name, class_maintenance, show_doc,
show_cmd_list,
0/*allow-unknown*/, &maintenance_show_cmdlist);
add_setshow_prefix_cmd (problem->name, class_maintenance,
set_doc, show_doc, set_cmd_list, show_cmd_list,
&maintenance_set_cmdlist, &maintenance_show_cmdlist);
if (problem->user_settable_should_quit)
{

View File

@ -3173,33 +3173,26 @@ _initialize_valprint ()
selftests::register_test_foreach_arch ("print-flags", test_print_flags);
#endif
cmd_list_element *cmd;
cmd_list_element *set_print_cmd
= add_basic_prefix_cmd ("print", no_class,
_("Generic command for setting how things print."),
&setprintlist, 0, &setlist);
add_alias_cmd ("p", set_print_cmd, no_class, 1, &setlist);
set_show_commands setshow_print_cmds
= add_setshow_prefix_cmd ("print", no_class,
_("Generic command for setting how things print."),
_("Generic command for showing print settings."),
&setprintlist, &showprintlist,
&setlist, &showlist);
add_alias_cmd ("p", setshow_print_cmds.set, no_class, 1, &setlist);
/* Prefer set print to set prompt. */
add_alias_cmd ("pr", set_print_cmd, no_class, 1, &setlist);
add_alias_cmd ("pr", setshow_print_cmds.set, no_class, 1, &setlist);
add_alias_cmd ("p", setshow_print_cmds.show, no_class, 1, &showlist);
add_alias_cmd ("pr", setshow_print_cmds.show, no_class, 1, &showlist);
cmd_list_element *show_print_cmd
= add_show_prefix_cmd ("print", no_class,
_("Generic command for showing print settings."),
&showprintlist, 0, &showlist);
add_alias_cmd ("p", show_print_cmd, no_class, 1, &showlist);
add_alias_cmd ("pr", show_print_cmd, no_class, 1, &showlist);
cmd = add_basic_prefix_cmd ("raw", no_class,
_("\
Generic command for setting what things to print in \"raw\" mode."),
&setprintrawlist, 0, &setprintlist);
deprecate_cmd (cmd, nullptr);
cmd = add_show_prefix_cmd ("raw", no_class,
_("Generic command for showing \"print raw\" settings."),
&showprintrawlist, 0, &showprintlist);
deprecate_cmd (cmd, nullptr);
set_show_commands setshow_print_raw_cmds
= add_setshow_prefix_cmd
("raw", no_class,
_("Generic command for setting what things to print in \"raw\" mode."),
_("Generic command for showing \"print raw\" settings."),
&setprintrawlist, &showprintrawlist, &setprintlist, &showprintlist);
deprecate_cmd (setshow_print_raw_cmds.set, nullptr);
deprecate_cmd (setshow_print_raw_cmds.show, nullptr);
gdb::option::add_setshow_cmds_for_options
(class_support, &user_print_options, value_print_option_defs,