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

@ -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. */