diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-27 13:59:00 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-27 14:00:07 -0400 |
commit | af7f8f52dd6024951577cfc328c318fdd4089623 (patch) | |
tree | e22264c4479004aef1f6ed7bbe609e3a0207009b /gdb | |
parent | 868027a48b613b9024a0da835b920a6e2ec2528c (diff) | |
download | gdb-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')
-rw-r--r-- | gdb/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/cli/cli-decode.c | 220 | ||||
-rw-r--r-- | gdb/command.h | 214 | ||||
-rw-r--r-- | gdb/corefile.c | 12 | ||||
-rw-r--r-- | gdb/disasm.c | 9 | ||||
-rw-r--r-- | gdb/stack.c | 15 | ||||
-rw-r--r-- | gdb/top.c | 2 |
7 files changed, 221 insertions, 264 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6170d2d..8c17e20 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2021-05-27 Simon Marchi <simon.marchi@polymtl.ca> + + * 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. + 2021-05-27 Tom de Vries <tdevries@suse.de> PR symtab/27919 diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index fbead70..0482cca 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -531,11 +531,11 @@ add_set_or_show_cmd (const char *name, setting. VAR is address of the variable being controlled by this command. SET_FUNC and SHOW_FUNC are the callback functions (if non-NULL). SET_DOC, SHOW_DOC and HELP_DOC are the documentation - strings. PRINT the format string to print the value. SET_RESULT - and SHOW_RESULT, if not NULL, are set to the resulting command - structures. */ + strings. -static void + Return the newly created set and show commands. */ + +static set_show_commands add_setshow_cmd_full (const char *name, enum command_class theclass, var_types var_type, void *var, @@ -544,9 +544,7 @@ add_setshow_cmd_full (const char *name, cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, - struct cmd_list_element **show_list, - struct cmd_list_element **set_result, - struct cmd_list_element **show_result) + struct cmd_list_element **show_list) { struct cmd_list_element *set; struct cmd_list_element *show; @@ -578,10 +576,7 @@ add_setshow_cmd_full (const char *name, for the "show" command to complete on anything. */ set_cmd_completer (show, nullptr); - if (set_result != NULL) - *set_result = set; - if (show_result != NULL) - *show_result = show; + return {set, show}; } /* Add element named NAME to command list LIST (the list for set or @@ -589,7 +584,7 @@ add_setshow_cmd_full (const char *name, of strings which may follow NAME. VAR is address of the variable which will contain the matching string (from ENUMLIST). */ -void +set_show_commands add_setshow_enum_cmd (const char *name, enum command_class theclass, const char *const *enumlist, @@ -603,17 +598,17 @@ add_setshow_enum_cmd (const char *name, struct cmd_list_element **show_list, void *context) { - struct cmd_list_element *c, *show; + set_show_commands commands + = add_setshow_cmd_full (name, theclass, var_enum, var, + set_doc, show_doc, help_doc, + set_func, show_func, + set_list, show_list); + commands.set->enums = enumlist; - add_setshow_cmd_full (name, theclass, var_enum, var, - set_doc, show_doc, help_doc, - set_func, show_func, - set_list, show_list, - &c, &show); - c->enums = enumlist; + set_cmd_context (commands.set, context); + set_cmd_context (commands.show, context); - set_cmd_context (c, context); - set_cmd_context (show, context); + return commands; } /* See cli-decode.h. */ @@ -623,7 +618,8 @@ const char * const auto_boolean_enums[] = { "on", "off", "auto", NULL }; command list lists. CLASS is as in add_cmd. VAR is address of the variable which will contain the value. DOC is the documentation string. FUNC is the corresponding callback. */ -void + +set_show_commands add_setshow_auto_boolean_cmd (const char *name, enum command_class theclass, enum auto_boolean *var, @@ -634,14 +630,15 @@ add_setshow_auto_boolean_cmd (const char *name, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { - struct cmd_list_element *c; + set_show_commands commands + = add_setshow_cmd_full (name, theclass, var_auto_boolean, var, + set_doc, show_doc, help_doc, + set_func, show_func, + set_list, show_list); - add_setshow_cmd_full (name, theclass, var_auto_boolean, var, - set_doc, show_doc, help_doc, - set_func, show_func, - set_list, show_list, - &c, NULL); - c->enums = auto_boolean_enums; + commands.set->enums = auto_boolean_enums; + + return commands; } /* See cli-decode.h. */ @@ -653,7 +650,7 @@ const char * const boolean_enums[] = { "on", "off", NULL }; value. SET_DOC and SHOW_DOC are the documentation strings. Returns the new command element. */ -cmd_list_element * +set_show_commands 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, @@ -662,21 +659,21 @@ add_setshow_boolean_cmd (const char *name, enum command_class theclass, bool *va struct cmd_list_element **set_list, struct cmd_list_element **show_list) { - struct cmd_list_element *c; + set_show_commands commands + = add_setshow_cmd_full (name, theclass, var_boolean, var, + set_doc, show_doc, help_doc, + set_func, show_func, + set_list, show_list); - add_setshow_cmd_full (name, theclass, var_boolean, var, - set_doc, show_doc, help_doc, - set_func, show_func, - set_list, show_list, - &c, NULL); - c->enums = boolean_enums; + commands.set->enums = boolean_enums; - return c; + return commands; } /* Add element named NAME to both the set and show command LISTs (the list for set/show or some sublist thereof). */ -void + +set_show_commands add_setshow_filename_cmd (const char *name, enum command_class theclass, char **var, const char *set_doc, const char *show_doc, @@ -686,19 +683,21 @@ add_setshow_filename_cmd (const char *name, enum command_class theclass, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { - struct cmd_list_element *set_result; + set_show_commands commands + = add_setshow_cmd_full (name, theclass, var_filename, var, + set_doc, show_doc, help_doc, + set_func, show_func, + set_list, show_list); + + set_cmd_completer (commands.set, filename_completer); - add_setshow_cmd_full (name, theclass, var_filename, var, - set_doc, show_doc, help_doc, - set_func, show_func, - set_list, show_list, - &set_result, NULL); - set_cmd_completer (set_result, filename_completer); + return commands; } /* Add element named NAME to both the set and show command LISTs (the list for set/show or some sublist thereof). */ -void + +set_show_commands add_setshow_string_cmd (const char *name, enum command_class theclass, char **var, const char *set_doc, const char *show_doc, @@ -708,21 +707,22 @@ add_setshow_string_cmd (const char *name, enum command_class theclass, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { - cmd_list_element *set_cmd; - - add_setshow_cmd_full (name, theclass, var_string, var, - set_doc, show_doc, help_doc, - set_func, show_func, - set_list, show_list, - &set_cmd, NULL); + set_show_commands commands + = add_setshow_cmd_full (name, theclass, var_string, var, + set_doc, show_doc, help_doc, + set_func, show_func, + set_list, show_list); /* Disable the default symbol completer. */ - set_cmd_completer (set_cmd, nullptr); + set_cmd_completer (commands.set, nullptr); + + return commands; } /* Add element named NAME to both the set and show command LISTs (the list for set/show or some sublist thereof). */ -struct cmd_list_element * + +set_show_commands add_setshow_string_noescape_cmd (const char *name, enum command_class theclass, char **var, const char *set_doc, const char *show_doc, @@ -732,23 +732,22 @@ add_setshow_string_noescape_cmd (const char *name, enum command_class theclass, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { - struct cmd_list_element *set_cmd; - - add_setshow_cmd_full (name, theclass, var_string_noescape, var, - set_doc, show_doc, help_doc, - set_func, show_func, - set_list, show_list, - &set_cmd, NULL); + set_show_commands commands + = add_setshow_cmd_full (name, theclass, var_string_noescape, var, + set_doc, show_doc, help_doc, + set_func, show_func, + set_list, show_list); /* Disable the default symbol completer. */ - set_cmd_completer (set_cmd, nullptr); + set_cmd_completer (commands.set, nullptr); - return set_cmd; + return commands; } /* Add element named NAME to both the set and show command LISTs (the list for set/show or some sublist thereof). */ -void + +set_show_commands add_setshow_optional_filename_cmd (const char *name, enum command_class theclass, char **var, const char *set_doc, const char *show_doc, @@ -758,16 +757,15 @@ add_setshow_optional_filename_cmd (const char *name, enum command_class theclass struct cmd_list_element **set_list, struct cmd_list_element **show_list) { - struct cmd_list_element *set_result; - - add_setshow_cmd_full (name, theclass, var_optional_filename, var, - set_doc, show_doc, help_doc, - set_func, show_func, - set_list, show_list, - &set_result, NULL); + set_show_commands commands + = add_setshow_cmd_full (name, theclass, var_optional_filename, var, + set_doc, show_doc, help_doc, + set_func, show_func, + set_list, show_list); - set_cmd_completer (set_result, filename_completer); + set_cmd_completer (commands.set, filename_completer); + return commands; } /* Completes on literal "unlimited". Used by integer commands that @@ -792,7 +790,8 @@ integer_unlimited_completer (struct cmd_list_element *ignore, add_cmd. VAR is address of the variable which will contain the value. SET_DOC and SHOW_DOC are the documentation strings. This function is only used in Python API. Please don't use it elsewhere. */ -void + +set_show_commands add_setshow_integer_cmd (const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, @@ -802,22 +801,23 @@ add_setshow_integer_cmd (const char *name, enum command_class theclass, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { - struct cmd_list_element *set; + set_show_commands commands + = add_setshow_cmd_full (name, theclass, var_integer, var, + set_doc, show_doc, help_doc, + set_func, show_func, + set_list, show_list); - add_setshow_cmd_full (name, theclass, var_integer, var, - set_doc, show_doc, help_doc, - set_func, show_func, - set_list, show_list, - &set, NULL); + set_cmd_completer (commands.set, integer_unlimited_completer); - set_cmd_completer (set, integer_unlimited_completer); + return commands; } /* Add element named NAME to both the set and show command LISTs (the list for set/show or some sublist thereof). CLASS is as in add_cmd. VAR is address of the variable which will contain the value. SET_DOC and SHOW_DOC are the documentation strings. */ -void + +set_show_commands add_setshow_uinteger_cmd (const char *name, enum command_class theclass, unsigned int *var, const char *set_doc, const char *show_doc, @@ -827,22 +827,23 @@ add_setshow_uinteger_cmd (const char *name, enum command_class theclass, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { - struct cmd_list_element *set; + set_show_commands commands + = add_setshow_cmd_full (name, theclass, var_uinteger, var, + set_doc, show_doc, help_doc, + set_func, show_func, + set_list, show_list); - add_setshow_cmd_full (name, theclass, var_uinteger, var, - set_doc, show_doc, help_doc, - set_func, show_func, - set_list, show_list, - &set, NULL); + set_cmd_completer (commands.set, integer_unlimited_completer); - set_cmd_completer (set, integer_unlimited_completer); + return commands; } /* Add element named NAME to both the set and show command LISTs (the list for set/show or some sublist thereof). CLASS is as in add_cmd. VAR is address of the variable which will contain the value. SET_DOC and SHOW_DOC are the documentation strings. */ -void + +set_show_commands add_setshow_zinteger_cmd (const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, @@ -852,14 +853,13 @@ add_setshow_zinteger_cmd (const char *name, enum command_class theclass, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { - add_setshow_cmd_full (name, theclass, var_zinteger, var, - set_doc, show_doc, help_doc, - set_func, show_func, - set_list, show_list, - NULL, NULL); + return add_setshow_cmd_full (name, theclass, var_zinteger, var, + set_doc, show_doc, help_doc, + set_func, show_func, + set_list, show_list); } -void +set_show_commands add_setshow_zuinteger_unlimited_cmd (const char *name, enum command_class theclass, int *var, @@ -871,22 +871,23 @@ add_setshow_zuinteger_unlimited_cmd (const char *name, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { - struct cmd_list_element *set; + set_show_commands commands + = add_setshow_cmd_full (name, theclass, var_zuinteger_unlimited, var, + set_doc, show_doc, help_doc, + set_func, show_func, + set_list, show_list); - add_setshow_cmd_full (name, theclass, var_zuinteger_unlimited, var, - set_doc, show_doc, help_doc, - set_func, show_func, - set_list, show_list, - &set, NULL); + set_cmd_completer (commands.set, integer_unlimited_completer); - set_cmd_completer (set, integer_unlimited_completer); + return commands; } /* Add element named NAME to both the set and show command LISTs (the list for set/show or some sublist thereof). CLASS is as in add_cmd. VAR is address of the variable which will contain the value. SET_DOC and SHOW_DOC are the documentation strings. */ -void + +set_show_commands add_setshow_zuinteger_cmd (const char *name, enum command_class theclass, unsigned int *var, const char *set_doc, const char *show_doc, @@ -896,11 +897,10 @@ add_setshow_zuinteger_cmd (const char *name, enum command_class theclass, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { - add_setshow_cmd_full (name, theclass, var_zuinteger, var, - set_doc, show_doc, help_doc, - set_func, show_func, - set_list, show_list, - NULL, NULL); + return add_setshow_cmd_full (name, theclass, var_zuinteger, var, + set_doc, show_doc, help_doc, + set_func, show_func, + set_list, show_list); } /* Remove the command named NAME from the command list. Return the 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. */ diff --git a/gdb/corefile.c b/gdb/corefile.c index 30960c1..ddaa772 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -458,17 +458,17 @@ void _initialize_core (); void _initialize_core () { - struct cmd_list_element *c; - - c = add_cmd ("core-file", class_files, core_file_command, _("\ + cmd_list_element *core_file_cmd + = add_cmd ("core-file", class_files, core_file_command, _("\ Use FILE as core dump for examining memory and registers.\n\ Usage: core-file FILE\n\ No arg means have no core file. This command has been superseded by the\n\ `target core' and `detach' commands."), &cmdlist); - set_cmd_completer (c, filename_completer); + set_cmd_completer (core_file_cmd, filename_completer); - c = add_setshow_string_noescape_cmd ("gnutarget", class_files, + set_show_commands set_show_gnutarget + = add_setshow_string_noescape_cmd ("gnutarget", class_files, &gnutarget_string, _("\ Set the current BFD target."), _("\ Show the current BFD target."), _("\ @@ -476,7 +476,7 @@ Use `set gnutarget auto' to specify automatic detection."), set_gnutarget_command, show_gnutarget_string, &setlist, &showlist); - set_cmd_completer (c, complete_set_gnutarget); + set_cmd_completer (set_show_gnutarget.set, complete_set_gnutarget); add_alias_cmd ("g", "gnutarget", class_files, 1, &setlist); diff --git a/gdb/disasm.c b/gdb/disasm.c index 70c5422..7f730f6 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -1139,11 +1139,10 @@ void _initialize_disasm (); void _initialize_disasm () { - struct cmd_list_element *cmd; - /* Add the command that controls the disassembler options. */ - cmd = add_setshow_string_noescape_cmd ("disassembler-options", no_class, - &prospective_options, _("\ + set_show_commands set_show_disas_opts + = add_setshow_string_noescape_cmd ("disassembler-options", no_class, + &prospective_options, _("\ Set the disassembler options.\n\ Usage: set disassembler-options OPTION [,OPTION]...\n\n\ See: 'show disassembler-options' for valid option values."), _("\ @@ -1151,5 +1150,5 @@ Show the disassembler options."), NULL, set_disassembler_options_sfunc, show_disassembler_options_sfunc, &setlist, &showlist); - set_cmd_completer (cmd, disassembler_options_completer); + set_cmd_completer (set_show_disas_opts.set, disassembler_options_completer); } diff --git a/gdb/stack.c b/gdb/stack.c index 7856a5a..334d974 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -3572,17 +3572,18 @@ Usage: func NAME")); /* Install "set print raw frame-arguments", a deprecated spelling of "set print raw-frame-arguments". */ - cmd = add_setshow_boolean_cmd - ("frame-arguments", no_class, - &user_frame_print_options.print_raw_frame_arguments, - _("\ + set_show_commands set_show_frame_args + = add_setshow_boolean_cmd + ("frame-arguments", no_class, + &user_frame_print_options.print_raw_frame_arguments, + _("\ Set whether to print frame arguments in raw form."), _("\ Show whether to print frame arguments in raw form."), _("\ If set, frame arguments are printed in raw form, bypassing any\n\ pretty-printers for that value."), - NULL, NULL, - &setprintrawlist, &showprintrawlist); - deprecate_cmd (cmd, "set print raw-frame-arguments"); + NULL, NULL, + &setprintrawlist, &showprintrawlist); + deprecate_cmd (set_show_frame_args.set, "set print raw-frame-arguments"); add_setshow_auto_boolean_cmd ("disassemble-next-line", class_stack, &disassemble_next_line, _("\ @@ -2345,7 +2345,7 @@ input settings."), show_interactive_mode, &setlist, &showlist); - c = add_setshow_boolean_cmd ("startup-quietly", class_support, + add_setshow_boolean_cmd ("startup-quietly", class_support, &startup_quiet, _("\ Set whether GDB should start up quietly."), _(" \ Show whether GDB should start up quietly."), _("\ |