summaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-02-05 04:37:23 +0000
committerAndrew Cagney <cagney@redhat.com>2002-02-05 04:37:23 +0000
commit9a766f85834587f44aa31dee73d9346fa0b40aed (patch)
tree375adbe0209e88ffe8225032d4fae5bbb534eb89 /gdb/top.c
parenta94458334607d7dcbfa5812673c037f2bb5be656 (diff)
downloadgdb-9a766f85834587f44aa31dee73d9346fa0b40aed.tar.gz
* 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.
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/gdb/top.c b/gdb/top.c
index 7552de7fbf7..7a2f756d620 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)
{