aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog47
-rw-r--r--gdb/alpha-tdep.c2
-rw-r--r--gdb/arc-tdep.c4
-rw-r--r--gdb/arch-utils.c4
-rw-r--r--gdb/arm-tdep.c2
-rw-r--r--gdb/cli/cli-cmds.c2
-rw-r--r--gdb/cli/cli-decode.c75
-rw-r--r--gdb/cli/cli-decode.h18
-rw-r--r--gdb/cli/cli-setshow.c2
-rw-r--r--gdb/command.h18
-rw-r--r--gdb/corefile.c2
-rw-r--r--gdb/cris-tdep.c6
-rw-r--r--gdb/demangle.c2
-rw-r--r--gdb/infcmd.c6
-rw-r--r--gdb/infrun.c3
-rw-r--r--gdb/kod.c2
-rw-r--r--gdb/language.c16
-rw-r--r--gdb/maint.c2
-rw-r--r--gdb/mips-tdep.c6
-rw-r--r--gdb/proc-api.c4
-rw-r--r--gdb/remote.c4
-rw-r--r--gdb/symfile.c2
-rw-r--r--gdb/top.c23
-rw-r--r--gdb/tracepoint.c4
-rw-r--r--gdb/utils.c2
-rw-r--r--gdb/valprint.c4
-rw-r--r--gdb/wince.c2
27 files changed, 198 insertions, 66 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7e56550..7739c4b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,50 @@
+2002-02-04 Andrew Cagney <ac131313@redhat.com>
+
+ * cli/cli-decode.c (do_cfunc, set_cmd_cfunc): New functions.
+ (do_sfunc, set_cmd_sfunc): New functions.
+
+ * command.h (struct cmd_list_element): Add field func.
+ * cli/cli-decode.h (struct cmd_list_element): Ditto.
+ * command.h (set_cmd_sfunc, set_cmd_cfunc): Declare.
+ * cli/cli-decode.h: Ditto.
+
+ * cli/cli-decode.c (help_cmd): Test for func not cfunc/sfunc.
+ (help_all, help_cmd_list): Ditto.
+ (find_cmd, complete_on_cmdlist): Ditto.
+ * top.c (execute_command): Ditto.
+
+ * cli/cli-setshow.c (do_setshow_command): Call func instead of
+ function.sfunc.
+
+ * infcmd.c (notice_args_read): Fix function signature.
+
+ * cli/cli-cmds.c (init_cli_cmds): Use set_cmd_sfunc.
+ * cli/cli-decode.c (add_set_cmd): Ditto.
+ * utils.c (initialize_utils): Ditto.
+ * maint.c (_initialize_maint_cmds): Ditto.
+ * infrun.c (_initialize_infrun): Ditto.
+ * demangle.c (_initialize_demangler): Ditto.
+ * remote.c (add_packet_config_cmd): Ditto.
+ * mips-tdep.c (_initialize_mips_tdep): Ditto.
+ * cris-tdep.c (_initialize_cris_tdep): Ditto.
+ * proc-api.c (_initialize_proc_api): Ditto.
+ * kod.c (_initialize_kod): Ditto.
+ * valprint.c (_initialize_valprint): Ditto.
+ * top.c (init_main): Ditto.
+ * infcmd.c (_initialize_infcmd): Ditto.
+ * corefile.c (_initialize_core): Ditto.
+ * arm-tdep.c (_initialize_arm_tdep): Ditto.
+ * arch-utils.c (initialize_current_architecture): Ditto.
+ (_initialize_gdbarch_utils): Ditto.
+ * alpha-tdep.c (_initialize_alpha_tdep): Ditto.
+
+ * cli/cli-decode.c (add_cmd): Use set_cmd_cfunc.
+ * wince.c (_initialize_inftarg): Ditto.
+ * symfile.c (_initialize_symfile): Ditto.
+ * mips-tdep.c (_initialize_mips_tdep): Ditto.
+ * language.c (_initialize_language): Ditto.
+ * arc-tdep.c (_initialize_arc_tdep): Ditto.
+
2002-02-04 Michael Snyder <msnyder@redhat.com>
* memattr.c (_initialize_mem): Elaborate the help for 'mem' command.
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 971dd63..4ca6bcc 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -1686,6 +1686,6 @@ search. The only need to set it is when debugging a stripped executable.",
&setlist);
/* We need to throw away the frame cache when we set this, since it
might change our ability to get backtraces. */
- c->function.sfunc = reinit_frame_cache_sfunc;
+ set_cmd_sfunc (c, reinit_frame_cache_sfunc);
add_show_from_set (c, &showlist);
}
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 825e55b..10a1bc1 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -692,9 +692,9 @@ change the cpu being debugged. It also gives one access to\n\
cpu-type-specific registers and recognize cpu-type-specific instructions.\
",
&setlist);
- c->function.cfunc = arc_set_cpu_type_command;
+ set_cmd_cfunc (c, arc_set_cpu_type_command);
c = add_show_from_set (c, &showlist);
- c->function.cfunc = arc_show_cpu_type_command;
+ set_cmd_cfunc (c, arc_show_cpu_type_command);
/* We have to use xstrdup() here because the `set' command frees it
before setting a new value. */
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index e6cda54..1ec5006 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -793,7 +793,7 @@ initialize_current_architecture (void)
arches, &set_architecture_string,
"Set architecture of target.",
&setlist);
- c->function.sfunc = set_architecture;
+ set_cmd_sfunc (c, set_architecture);
add_alias_cmd ("processor", "architecture", class_support, 1, &setlist);
/* Don't use set_from_show - need to print both auto/manual and
current setting. */
@@ -828,7 +828,7 @@ _initialize_gdbarch_utils (void)
endian_enum, &set_endian_string,
"Set endianness of target.",
&setlist);
- c->function.sfunc = set_endian;
+ set_cmd_sfunc (c, set_endian);
/* Don't use set_from_show - need to print both auto/manual and
current setting. */
add_cmd ("endian", class_support, show_endian,
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index f9ffa71..88135e8 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -2339,7 +2339,7 @@ The valid values are:\n");
&disassembly_flavor,
helptext,
&setlist);
- new_cmd->function.sfunc = set_disassembly_flavor_sfunc;
+ set_cmd_sfunc (new_cmd, set_disassembly_flavor_sfunc);
add_show_from_set (new_cmd, &showlist);
/* ??? Maybe this should be a boolean. */
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 4f033a3..f229a70 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -676,7 +676,7 @@ when gdb is started.", &cmdlist);
"Set ",
&setlist),
add_show_from_set (c, &showlist);
- c->function.sfunc = set_verbose;
+ set_cmd_sfunc (c, set_verbose);
set_verbose (NULL, 0, c);
add_prefix_cmd ("history", class_support, set_history,
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 3821faf..d64b2f6 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -40,6 +40,46 @@ static struct cmd_list_element *find_cmd (char *command,
static void help_all (struct ui_file *stream);
+/* Set the callback function for the specified command. For each both
+ the commands callback and func() are set. The latter set to a
+ bounce function (unless cfunc / sfunc is NULL that is). */
+
+static void
+do_cfunc (struct cmd_list_element *c, char *args, int from_tty)
+{
+ c->function.cfunc (args, from_tty); /* Ok. */
+}
+
+void
+set_cmd_cfunc (struct cmd_list_element *cmd,
+ void (*cfunc) (char *args, int from_tty))
+{
+ if (cfunc == NULL)
+ cmd->func = NULL;
+ else
+ cmd->func = do_cfunc;
+ cmd->function.cfunc = cfunc; /* Ok. */
+}
+
+static void
+do_sfunc (struct cmd_list_element *c, char *args, int from_tty)
+{
+ c->function.sfunc (args, from_tty, c); /* Ok. */
+}
+
+void
+set_cmd_sfunc (struct cmd_list_element *cmd,
+ void (*sfunc) (char *args, int from_tty,
+ struct cmd_list_element * c))
+{
+ if (sfunc == NULL)
+ cmd->func = NULL;
+ else
+ cmd->func = do_sfunc;
+ cmd->function.sfunc = sfunc; /* Ok. */
+}
+
+
/* Add element named NAME.
CLASS is the top level category into which commands are broken down
for "help" purposes.
@@ -85,7 +125,7 @@ add_cmd (char *name, enum command_class class, void (*fun) (char *, int),
c->name = name;
c->class = class;
- c->function.cfunc = fun;
+ set_cmd_cfunc (c, fun);
c->doc = doc;
c->flags = 0;
c->replacement = NULL;
@@ -165,7 +205,10 @@ add_alias_cmd (char *name, char *oldname, enum command_class class,
return 0;
}
- c = add_cmd (name, class, old->function.cfunc, old->doc, list);
+ c = add_cmd (name, class, NULL, old->doc, list);
+ /* NOTE: Both FUNC and all the FUNCTIONs need to be copied. */
+ c->func = old->func;
+ c->function = old->function;
c->prefixlist = old->prefixlist;
c->prefixname = old->prefixname;
c->allow_unknown = old->allow_unknown;
@@ -244,7 +287,7 @@ add_set_cmd (char *name,
c->var = var;
/* This needs to be something besides NULL so that this isn't
treated as a help class. */
- c->function.sfunc = empty_sfunc;
+ set_cmd_sfunc (c, empty_sfunc);
return c;
}
@@ -516,18 +559,18 @@ help_cmd (char *command, struct ui_file *stream)
If c->prefixlist is nonzero, we have a prefix command.
Print its documentation, then list its subcommands.
- If c->function is nonzero, we really have a command.
- Print its documentation and return.
+ If c->func is non NULL, we really have a command. Print its
+ documentation and return.
- If c->function is zero, we have a class name.
- Print its documentation (as if it were a command)
- and then set class to the number of this class
- so that the commands in the class will be listed. */
+ If c->func is NULL, we have a class name. Print its
+ documentation (as if it were a command) and then set class to the
+ number of this class so that the commands in the class will be
+ listed. */
fputs_filtered (c->doc, stream);
fputs_filtered ("\n", stream);
- if (c->prefixlist == 0 && c->function.cfunc != NULL)
+ if (c->prefixlist == 0 && c->func != NULL)
return;
fprintf_filtered (stream, "\n");
@@ -536,7 +579,7 @@ help_cmd (char *command, struct ui_file *stream)
help_list (*c->prefixlist, c->prefixname, all_commands, stream);
/* If this is a class name, print all of the commands in the class */
- if (c->function.cfunc == NULL)
+ if (c->func == NULL)
help_list (cmdlist, "", c->class, stream);
if (c->hook_pre || c->hook_post)
@@ -620,7 +663,7 @@ help_all (struct ui_file *stream)
help_cmd_list (*c->prefixlist, all_commands, c->prefixname, 0, stream);
/* If this is a class name, print all of the commands in the class */
- else if (c->function.cfunc == NULL)
+ else if (c->func == NULL)
help_cmd_list (cmdlist, c->class, "", 0, stream);
}
}
@@ -681,8 +724,8 @@ help_cmd_list (struct cmd_list_element *list, enum command_class class,
{
if (c->abbrev_flag == 0 &&
(class == all_commands
- || (class == all_classes && c->function.cfunc == NULL)
- || (class == c->class && c->function.cfunc != NULL)))
+ || (class == all_classes && c->func == NULL)
+ || (class == c->class && c->func != NULL)))
{
fprintf_filtered (stream, "%s%s -- ", prefix, c->name);
print_doc_line (stream, c->doc);
@@ -710,7 +753,7 @@ find_cmd (char *command, int len, struct cmd_list_element *clist,
*nfound = 0;
for (c = clist; c; c = c->next)
if (!strncmp (command, c->name, len)
- && (!ignore_help_classes || c->function.cfunc))
+ && (!ignore_help_classes || c->func))
{
found = c;
(*nfound)++;
@@ -1241,7 +1284,7 @@ complete_on_cmdlist (struct cmd_list_element *list, char *text, char *word)
for (ptr = list; ptr; ptr = ptr->next)
if (!strncmp (ptr->name, text, textlen)
&& !ptr->abbrev_flag
- && (ptr->function.cfunc
+ && (ptr->func
|| ptr->prefixlist))
{
if (matches == sizeof_matchlist)
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index 9e1e094..6c7c22b 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -121,7 +121,13 @@ struct cmd_list_element
enum command_class class;
/* Function definition of this command. NULL for command class
- names and for help topics that are not really commands. */
+ names and for help topics that are not really commands. NOTE:
+ cagney/2002-02-02: This function signature is evolving. For
+ the moment suggest sticking with either set_cmd_cfunc() or
+ set_cmd_sfunc(). */
+ void (*func) (struct cmd_list_element *c, char *args, int from_tty);
+ /* The command's real callback. At present func() bounces through
+ to one of the below. */
union
{
/* If type is not_set_cmd, call it like this: */
@@ -271,6 +277,16 @@ extern struct cmd_list_element *add_abbrev_prefix_cmd (char *,
struct cmd_list_element
**);
+/* Set the commands corresponding callback. */
+
+extern void set_cmd_cfunc (struct cmd_list_element *cmd,
+ void (*cfunc) (char *args, int from_tty));
+
+extern void set_cmd_sfunc (struct cmd_list_element *cmd,
+ void (*sfunc) (char *args, int from_tty,
+ struct cmd_list_element * c));
+
+
extern struct cmd_list_element *lookup_cmd (char **,
struct cmd_list_element *, char *,
int, int);
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 5904d33..f967b0c 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -345,7 +345,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
}
else
error ("gdb internal error: bad cmd_type in do_setshow_command");
- (*c->function.sfunc) (NULL, from_tty, c);
+ c->func (c, NULL, from_tty);
if (c->type == set_cmd && set_hook)
set_hook (c);
}
diff --git a/gdb/command.h b/gdb/command.h
index 205fb90..c7d7b5e 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -127,7 +127,13 @@ struct cmd_list_element
enum command_class class;
/* Function definition of this command. NULL for command class
- names and for help topics that are not really commands. */
+ names and for help topics that are not really commands. NOTE:
+ cagney/2002-02-02: This function signature is evolving. For
+ the moment suggest sticking with either set_cmd_cfunc() or
+ set_cmd_sfunc(). */
+ void (*func) (struct cmd_list_element *c, char *args, int from_tty);
+ /* The command's real callback. At present func() bounces through
+ to one of the below. */
union
{
/* If type is not_set_cmd, call it like this: */
@@ -277,6 +283,16 @@ extern struct cmd_list_element *add_abbrev_prefix_cmd (char *,
struct cmd_list_element
**);
+/* Set the commands corresponding callback. */
+
+extern void set_cmd_cfunc (struct cmd_list_element *cmd,
+ void (*cfunc) (char *args, int from_tty));
+
+extern void set_cmd_sfunc (struct cmd_list_element *cmd,
+ void (*sfunc) (char *args, int from_tty,
+ struct cmd_list_element * c));
+
+
extern struct cmd_list_element *lookup_cmd (char **,
struct cmd_list_element *, char *,
int, int);
diff --git a/gdb/corefile.c b/gdb/corefile.c
index facd2da..7acbd6eb 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -448,7 +448,7 @@ No arg means have no core file. This command has been superseded by the\n\
"Set the current BFD target.\n\
Use `set gnutarget auto' to specify automatic detection.",
&setlist);
- c->function.sfunc = set_gnutarget_command;
+ set_cmd_sfunc (c, set_gnutarget_command);
add_show_from_set (c, &showlist);
if (getenv ("GNUTARGET"))
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 8f22ed6..5b49a4f 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -3875,19 +3875,19 @@ _initialize_cris_tdep (void)
c = add_set_cmd ("cris-version", class_support, var_integer,
(char *) &usr_cmd_cris_version,
"Set the current CRIS version.", &setlist);
- c->function.sfunc = cris_version_update;
+ set_cmd_sfunc (c, cris_version_update);
add_show_from_set (c, &showlist);
c = add_set_enum_cmd ("cris-mode", class_support, cris_mode_enums,
&usr_cmd_cris_mode,
"Set the current CRIS mode.", &setlist);
- c->function.sfunc = cris_mode_update;
+ set_cmd_sfunc (c, cris_mode_update);
add_show_from_set (c, &showlist);
c = add_set_enum_cmd ("cris-abi", class_support, cris_abi_enums,
&usr_cmd_cris_abi,
"Set the current CRIS ABI version.", &setlist);
- c->function.sfunc = cris_abi_update;
+ set_cmd_sfunc (c, cris_abi_update);
add_show_from_set (c, &showlist);
c = add_cmd ("cris-fpless-backtrace", class_support, cris_fpless_backtrace,
diff --git a/gdb/demangle.c b/gdb/demangle.c
index 0104d8f..1fd69be 100644
--- a/gdb/demangle.c
+++ b/gdb/demangle.c
@@ -200,7 +200,7 @@ _initialize_demangler (void)
Use `set demangle-style' without arguments for a list of demangling styles.",
&setlist);
show = add_show_from_set (set, &showlist);
- set->function.sfunc = set_demangling_command;
+ set_cmd_sfunc (set, set_demangling_command);
/* Set the default demangling style chosen at compilation time. */
set_demangling_style (DEFAULT_DEMANGLING_STYLE);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index d5e18ec..2220534 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -248,7 +248,7 @@ notice_args_set (char *args, int from_tty, struct cmd_list_element *c)
/* Notice when `show args' is run. */
static void
-notice_args_read (struct cmd_list_element *c)
+notice_args_read (char *args, int from_tty, struct cmd_list_element *c)
{
/* Might compute the value. */
get_inferior_args ();
@@ -1877,9 +1877,9 @@ _initialize_infcmd (void)
Follow this command with any number of args, to be passed to the program.",
&setlist);
c->completer = filename_completer;
- c->function.sfunc = notice_args_set;
+ set_cmd_sfunc (c, notice_args_set);
c = add_show_from_set (c, &showlist);
- c->pre_show_hook = notice_args_read;
+ set_cmd_sfunc (c, notice_args_read);
c = add_cmd
("environment", no_class, environment_info,
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 1b0eb7e..c935db8 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4350,7 +4350,6 @@ A fork or vfork creates a new process. follow-fork-mode can be:\n\
For \"parent\" or \"child\", the unfollowed process will run free.\n\
By default, the debugger will follow the parent process.",
&setlist);
-/* c->function.sfunc = ; */
add_show_from_set (c, &showlist);
c = add_set_enum_cmd ("scheduler-locking", class_run,
@@ -4364,7 +4363,7 @@ step == scheduler locked during every single-step operation.\n\
Other threads may run while stepping over a function call ('next').",
&setlist);
- c->function.sfunc = set_schedlock_func; /* traps on target vector */
+ set_cmd_sfunc (c, set_schedlock_func); /* traps on target vector */
add_show_from_set (c, &showlist);
c = add_set_cmd ("step-mode", class_run,
diff --git a/gdb/kod.c b/gdb/kod.c
index eec99e5..2641c38 100644
--- a/gdb/kod.c
+++ b/gdb/kod.c
@@ -224,6 +224,6 @@ _initialize_kod (void)
(char *) &operating_system,
"Set operating system",
&setlist);
- c->function.sfunc = kod_set_os;
+ set_cmd_sfunc (c, kod_set_os);
add_show_from_set (c, &showlist);
}
diff --git a/gdb/language.c b/gdb/language.c
index c2db91c..a9077a9 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -1555,8 +1555,8 @@ _initialize_language (void)
"Set the current source language.",
&setlist);
show = add_show_from_set (set, &showlist);
- set->function.cfunc = set_language_command;
- show->function.cfunc = show_language_command;
+ set_cmd_cfunc (set, set_language_command);
+ set_cmd_cfunc (show, show_language_command);
add_prefix_cmd ("check", no_class, set_check,
"Set the status of the type/range checker",
@@ -1575,16 +1575,16 @@ _initialize_language (void)
"Set type checking. (on/warn/off/auto)",
&setchecklist);
show = add_show_from_set (set, &showchecklist);
- set->function.cfunc = set_type_command;
- show->function.cfunc = show_type_command;
+ set_cmd_cfunc (set, set_type_command);
+ set_cmd_cfunc (show, show_type_command);
set = add_set_cmd ("range", class_support, var_string_noescape,
(char *) &range,
"Set range checking. (on/warn/off/auto)",
&setchecklist);
show = add_show_from_set (set, &showchecklist);
- set->function.cfunc = set_range_command;
- show->function.cfunc = show_range_command;
+ set_cmd_cfunc (set, set_range_command);
+ set_cmd_cfunc (show, show_range_command);
set = add_set_cmd ("case-sensitive", class_support, var_string_noescape,
(char *) &case_sensitive,
@@ -1592,8 +1592,8 @@ _initialize_language (void)
For Fortran the default is off; for other languages the default is on.",
&setlist);
show = add_show_from_set (set, &showlist);
- set->function.cfunc = set_case_command;
- show->function.cfunc = show_case_command;
+ set_cmd_cfunc (set, set_case_command);
+ set_cmd_cfunc (show, show_case_command);
add_language (&unknown_language_defn);
add_language (&local_language_defn);
diff --git a/gdb/maint.c b/gdb/maint.c
index 67e7a27..59de6dc 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -790,7 +790,7 @@ passes without a response from the target, an error occurs.", &setlist),
"Set internal profiling.\n\
When enabled GDB is profiled.",
&maintenance_set_cmdlist);
- tmpcmd->function.sfunc = maintenance_set_profile_cmd;
+ set_cmd_sfunc (tmpcmd, maintenance_set_profile_cmd);
add_show_from_set (tmpcmd, &maintenance_show_cmdlist);
#endif
}
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 30079b5..efcc0e7 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -4786,9 +4786,9 @@ This option can be set to one of:\n\
Set this to be able to access processor-type-specific registers.\n\
",
&setlist);
- c->function.cfunc = mips_set_processor_type_command;
+ set_cmd_cfunc (c, mips_set_processor_type_command);
c = add_show_from_set (c, &showlist);
- c->function.cfunc = mips_show_processor_type_command;
+ set_cmd_cfunc (c, mips_show_processor_type_command);
tmp_mips_processor_type = xstrdup (DEFAULT_MIPS_TYPE);
mips_set_processor_type_command (xstrdup (DEFAULT_MIPS_TYPE), 0);
@@ -4807,7 +4807,7 @@ search. The only need to set it is when debugging a stripped executable.",
&setlist);
/* We need to throw away the frame cache when we set this, since it
might change our ability to get backtraces. */
- c->function.sfunc = reinit_frame_cache_sfunc;
+ set_cmd_sfunc (c, reinit_frame_cache_sfunc);
add_show_from_set (c, &showlist);
/* Allow the user to control whether the upper bits of 64-bit
diff --git a/gdb/proc-api.c b/gdb/proc-api.c
index 4cae8fd..986691d 100644
--- a/gdb/proc-api.c
+++ b/gdb/proc-api.c
@@ -777,7 +777,7 @@ _initialize_proc_api (void)
"Set tracing for /proc api calls.\n", &setlist);
add_show_from_set (c, &showlist);
- c->function.sfunc = set_procfs_trace_cmd;
+ set_cmd_sfunc (c, set_procfs_trace_cmd);
c->completer = filename_completer;
c = add_set_cmd ("procfs-file", no_class, var_filename,
@@ -785,5 +785,5 @@ _initialize_proc_api (void)
"Set filename for /proc tracefile.\n", &setlist);
add_show_from_set (c, &showlist);
- c->function.sfunc = set_procfs_file_cmd;
+ set_cmd_sfunc (c, set_procfs_file_cmd);
}
diff --git a/gdb/remote.c b/gdb/remote.c
index deab83d..688024d 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -675,7 +675,7 @@ add_packet_config_cmd (struct packet_config *config,
set_cmd = add_set_auto_boolean_cmd (cmd_name, class_obscure,
&config->detect, set_doc,
set_remote_list);
- set_cmd->function.sfunc = set_func;
+ set_cmd_sfunc (set_cmd, set_func);
show_cmd = add_cmd (cmd_name, class_obscure, show_func, show_doc,
show_remote_list);
/* set/show remote NAME-packet {auto,on,off} -- legacy */
@@ -6154,7 +6154,7 @@ in a memory packet.\n",
&remote_Z_packet_detect,
"\
Set use of remote protocol `Z' packets", &remote_set_cmdlist);
- tmpcmd->function.sfunc = set_remote_protocol_Z_packet_cmd;
+ set_cmd_sfunc (tmpcmd, set_remote_protocol_Z_packet_cmd);
add_cmd ("Z-packet", class_obscure, show_remote_protocol_Z_packet_cmd,
"Show use of remote protocol `Z' packets ",
&remote_show_cmdlist);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index e77c9c2..bbc2376 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3274,7 +3274,7 @@ for access from GDB.", &cmdlist);
"Set mapping between filename extension and source language.\n\
Usage: set extension-language .foo bar",
&setlist);
- c->function.cfunc = set_ext_lang_command;
+ set_cmd_cfunc (c, set_ext_lang_command);
add_info ("extensions", info_ext_lang_command,
"All filename extensions associated with a source language.");
diff --git a/gdb/top.c b/gdb/top.c
index 7552de7..7a2f756 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -672,7 +672,16 @@ execute_command (char *p, int from_tty)
/* Pass null arg rather than an empty one. */
arg = *p ? p : 0;
- /* Clear off trailing whitespace, except for set and complete command. */
+ /* FIXME: cagney/2002-02-02: The c->type test is pretty dodgy
+ while the is_complete_command(cfunc) test is just plain
+ bogus. They should both be replaced by a test of the form
+ c->strip_trailing_white_space_p. */
+ /* NOTE: cagney/2002-02-02: The function.cfunc in the below
+ can't be replaced with func. This is because it is the
+ cfunc, and not the func, that has the value that the
+ is_complete_command hack is testing for. */
+ /* Clear off trailing whitespace, except for set and complete
+ command. */
if (arg
&& c->type != set_cmd
&& !is_complete_command (c->function.cfunc))
@@ -698,12 +707,12 @@ execute_command (char *p, int from_tty)
execute_user_command (c, arg);
else if (c->type == set_cmd || c->type == show_cmd)
do_setshow_command (arg, from_tty & caution, c);
- else if (c->function.cfunc == NULL)
+ else if (c->func == NULL)
error ("That is not a command, just a help topic.");
else if (call_command_hook)
call_command_hook (c, arg, from_tty & caution);
else
- (*c->function.cfunc) (arg, from_tty & caution);
+ (*c->func) (c, arg, from_tty & caution);
/* If this command has been post-hooked, run the hook last. */
if ((c->hook_post) && (!c->hook_in))
@@ -1943,7 +1952,7 @@ init_main (void)
(char *) &new_async_prompt, "Set gdb's prompt",
&setlist);
add_show_from_set (c, &showlist);
- c->function.sfunc = set_async_prompt;
+ set_cmd_sfunc (c, set_async_prompt);
}
add_show_from_set
@@ -1979,7 +1988,7 @@ Without an argument, command line editing is enabled. To edit, use\n\
EMACS-like or VI-like commands like control-P or ESC.", &setlist);
add_show_from_set (c, &showlist);
- c->function.sfunc = set_async_editing_command;
+ set_cmd_sfunc (c, set_async_editing_command);
}
add_show_from_set
@@ -1993,7 +2002,7 @@ Without an argument, saving is enabled.", &sethistlist),
"Set the size of the command history, \n\
ie. the number of previous commands to keep a record of.", &sethistlist);
add_show_from_set (c, &showhistlist);
- c->function.sfunc = set_history_size_command;
+ set_cmd_sfunc (c, set_history_size_command);
c = add_set_cmd ("filename", no_class, var_filename,
(char *) &history_filename,
@@ -2030,7 +2039,7 @@ ie. the number of previous commands to keep a record of.", &sethistlist);
2 == output annotated suitably for use by programs that control GDB.",
&setlist);
add_show_from_set (c, &showlist);
- c->function.sfunc = set_async_annotation_level;
+ set_cmd_sfunc (c, set_async_annotation_level);
}
if (event_loop_p)
{
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 1244192..1eb01cc 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1,5 +1,7 @@
/* Tracing functionality for remote targets in custom GDB protocol
- Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+
+ Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+ Foundation, Inc.
This file is part of GDB.
diff --git a/gdb/utils.c b/gdb/utils.c
index 93989b9..34b660d 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -2238,7 +2238,7 @@ initialize_utils (void)
"Set number of characters gdb thinks are in a line.",
&setlist);
add_show_from_set (c, &showlist);
- c->function.sfunc = set_width_command;
+ set_cmd_sfunc (c, set_width_command);
add_show_from_set
(add_set_cmd ("height", class_support,
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 5f2c1762..131769b 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1490,14 +1490,14 @@ _initialize_valprint (void)
"Set default input radix for entering numbers.",
&setlist);
add_show_from_set (c, &showlist);
- c->function.sfunc = set_input_radix;
+ set_cmd_sfunc (c, set_input_radix);
c = add_set_cmd ("output-radix", class_support, var_uinteger,
(char *) &output_radix,
"Set default output radix for printing of values.",
&setlist);
add_show_from_set (c, &showlist);
- c->function.sfunc = set_output_radix;
+ set_cmd_sfunc (c, set_output_radix);
/* The "set radix" and "show radix" commands are special in that they are
like normal set and show commands but allow two normally independent
diff --git a/gdb/wince.c b/gdb/wince.c
index d931ddc..e37866c 100644
--- a/gdb/wince.c
+++ b/gdb/wince.c
@@ -1983,7 +1983,7 @@ _initialize_inftarg (void)
(char *) "Set how to upload executables to remote device.\n",
&setlist);
add_show_from_set (set, &showlist);
- set->function.cfunc = set_upload_type;
+ set_cmd_cfunc (set, set_upload_type);
set_upload_type (NULL, 0);
add_show_from_set