diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-09-22 13:43:25 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2021-10-28 10:44:18 -0400 |
commit | f54bdb6d2799c658e076f10e42222949dc51032d (patch) | |
tree | bd9804255bf472e93740a8b47b2f90d5bde939c3 /gdb/command.h | |
parent | 5ad2694b1ebe123ea92fcee094a69bcdc9769985 (diff) | |
download | gdb-f54bdb6d2799c658e076f10e42222949dc51032d.zip gdb-f54bdb6d2799c658e076f10e42222949dc51032d.tar.gz gdb-f54bdb6d2799c658e076f10e42222949dc51032d.tar.bz2 |
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
Diffstat (limited to 'gdb/command.h')
-rw-r--r-- | gdb/command.h | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/gdb/command.h b/gdb/command.h index 0049ab6..9afe70c 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -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, |