aboutsummaryrefslogtreecommitdiff
path: root/gdb/command.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-05-27 13:59:00 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-05-27 14:00:07 -0400
commitaf7f8f52dd6024951577cfc328c318fdd4089623 (patch)
treee22264c4479004aef1f6ed7bbe609e3a0207009b /gdb/command.h
parent868027a48b613b9024a0da835b920a6e2ec2528c (diff)
downloadgdb-af7f8f52dd6024951577cfc328c318fdd4089623.zip
gdb-af7f8f52dd6024951577cfc328c318fdd4089623.tar.gz
gdb-af7f8f52dd6024951577cfc328c318fdd4089623.tar.bz2
gdb: make add_setshow commands return set_show_commands
Some add_set_show commands return a single cmd_list_element, the one for the "set" command. A subsequent patch will need to access the show command's cmd_list_element as well. Change these functions to return a new structure type that holds both pointers. I initially only modified add_setshow_boolean_cmd (the one I needed), but I think it's better to change the whole chain to keep everything in sync. gdb/ChangeLog: * command.h (set_show_commands): New. (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd, add_setshow_filename_cmd, add_setshow_string_cmd, add_setshow_string_noescape_cmd, add_setshow_optional_filename_cmd, add_setshow_integer_cmd, add_setshow_uinteger_cmd, add_setshow_zinteger_cmd, add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd): Return set_show_commands. Adjust callers. * cli/cli-decode.c (add_setshow_cmd_full): Return set_show_commands, remove result parameters, adjust callers. Change-Id: I17492b01b76002d09effc84830f9c6db26f1db7a
Diffstat (limited to 'gdb/command.h')
-rw-r--r--gdb/command.h214
1 files changed, 79 insertions, 135 deletions
diff --git a/gdb/command.h b/gdb/command.h
index 6850387..e82f2ea 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -398,141 +398,85 @@ typedef void (show_value_ftype) (struct ui_file *file,
instead print the value out directly. */
extern show_value_ftype deprecated_show_value_hack;
-extern void add_setshow_enum_cmd (const char *name,
- enum command_class theclass,
- const char *const *enumlist,
- const char **var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list,
- void *context = nullptr);
-
-extern void add_setshow_auto_boolean_cmd (const char *name,
- enum command_class theclass,
- enum auto_boolean *var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
-
-extern cmd_list_element *
- add_setshow_boolean_cmd (const char *name,
- enum command_class theclass,
- bool *var,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
-
-extern void add_setshow_filename_cmd (const char *name,
- enum command_class theclass,
- char **var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
-
-extern void add_setshow_string_cmd (const char *name,
- enum command_class theclass,
- char **var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
-
-extern struct cmd_list_element *add_setshow_string_noescape_cmd
- (const char *name,
- enum command_class theclass,
- char **var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
-
-extern void add_setshow_optional_filename_cmd (const char *name,
- enum command_class theclass,
- char **var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
-
-extern void add_setshow_integer_cmd (const char *name,
- enum command_class theclass,
- int *var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
-
-extern void add_setshow_uinteger_cmd (const char *name,
- enum command_class theclass,
- unsigned int *var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
-
-extern void add_setshow_zinteger_cmd (const char *name,
- enum command_class theclass,
- int *var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
-
-extern void add_setshow_zuinteger_cmd (const char *name,
- enum command_class theclass,
- unsigned int *var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
-
-extern void
- add_setshow_zuinteger_unlimited_cmd (const char *name,
- enum command_class theclass,
- int *var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_const_sfunc_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
+/* 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,
+ const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list, void *context = nullptr);
+
+extern set_show_commands add_setshow_auto_boolean_cmd
+ (const char *name, command_class theclass, auto_boolean *var,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_boolean_cmd
+ (const char *name, command_class theclass, bool *var, const char *set_doc,
+ const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_filename_cmd
+ (const char *name, command_class theclass, char **var, const char *set_doc,
+ const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_string_cmd
+ (const char *name, command_class theclass, char **var, const char *set_doc,
+ const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_string_noescape_cmd
+ (const char *name, command_class theclass, char **var, const char *set_doc,
+ const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_optional_filename_cmd
+ (const char *name, command_class theclass, char **var, const char *set_doc,
+ const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_integer_cmd
+ (const char *name, command_class theclass, int *var, const char *set_doc,
+ const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_uinteger_cmd
+ (const char *name, command_class theclass, unsigned int *var,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_zinteger_cmd
+ (const char *name, command_class theclass, int *var, const char *set_doc,
+ const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_zuinteger_cmd
+ (const char *name, command_class theclass, unsigned int *var,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_zuinteger_unlimited_cmd
+ (const char *name, command_class theclass, int *var, const char *set_doc,
+ const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
/* Do a "show" command for each thing on a command list. */