diff options
author | Fernando Nasser <fnasser@redhat.com> | 2000-03-23 23:43:19 +0000 |
---|---|---|
committer | Fernando Nasser <fnasser@redhat.com> | 2000-03-23 23:43:19 +0000 |
commit | 2dc8fb4756062c56aaff9a6f0faf06451ebdd49c (patch) | |
tree | 275e4c47383e6c2a899f472adc89d7b5e9684e5f /gdb/top.c | |
parent | 29f870bdbe7ab33868b34297abd219b0386fea8b (diff) | |
download | gdb-2dc8fb4756062c56aaff9a6f0faf06451ebdd49c.tar.gz |
2000-03-23 Fernando Nasser <fnasser@cygnus.com>
From David Whedon <dwhedon@gordian.com>
* top.c (execute_command): Checks all commands beore executing
to see if the user needs to be warned that the command is
deprecated, warns user if appropriate.
(add_info), (add_info_alias), (add_com) , (add_com_alias): Changed
return values from void to struct cmd_list_element *.
* command.c (lookup_cmd_1): Check aliases before following link
in case user needs to be warned about a deprecated alias.
(deprecate_cmd): new exported function for command deprecation,
sets flags and posibly a replacement string.
(deprecated_cmd_warning): New exported funciton to warn user about
a deprecated command.
(lookup_cmd_composition): New exported function that determines
alias, prefix_command, and cmd based on a string. This is useful
is we want to full name of a command.
* command.h : Added prototypes for deprecate_cmd,
deprecated_warn_user and lookup_cmd_composition, added flags to
the cmd_list_element structure, changed return values for
add_com_* and add_info_* from void to cmd_list_element.
* maint.c : (maintenance_deprecate): New function to deprecate a
command. This exists only so that the testsuite can deprecate
commands at runtime and check the warning behavior.
(maintenance_undeprecate) : New function, drops deprecated flags.
(maintenance_do_deprecate): Actually does the (un)deprecation.
(initialize_maint_cmds): Added the above new deprecate commands.
Diffstat (limited to 'gdb/top.c')
-rw-r--r-- | gdb/top.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/gdb/top.c b/gdb/top.c index 4acf4db4ad6..0fac46d96b5 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1474,6 +1474,7 @@ execute_command (p, from_tty) register struct cmd_list_element *c; register enum language flang; static int warned = 0; + char *line; /* FIXME: These should really be in an appropriate header file */ extern void serial_log_command PARAMS ((const char *)); @@ -1494,7 +1495,8 @@ execute_command (p, from_tty) if (*p) { char *arg; - + line = p; + c = lookup_cmd (&p, cmdlist, "", 0, 1); /* If the target is running, we allow only a limited set of @@ -1517,11 +1519,14 @@ execute_command (p, from_tty) p--; *(p + 1) = '\0'; } - + /* If this command has been hooked, run the hook first. */ if (c->hook) execute_user_command (c->hook, (char *) 0); + if (c->flags & DEPRECATED_WARN_USER) + deprecated_cmd_warning (&line); + if (c->class == class_user) execute_user_command (c, arg); else if (c->type == set_cmd || c->type == show_cmd) @@ -2892,24 +2897,24 @@ free_command_lines (lptr) /* Add an element to the list of info subcommands. */ -void +struct cmd_list_element * add_info (name, fun, doc) char *name; void (*fun) PARAMS ((char *, int)); char *doc; { - add_cmd (name, no_class, fun, doc, &infolist); + return add_cmd (name, no_class, fun, doc, &infolist); } /* Add an alias to the list of info subcommands. */ -void +struct cmd_list_element * add_info_alias (name, oldname, abbrev_flag) char *name; char *oldname; int abbrev_flag; { - add_alias_cmd (name, oldname, 0, abbrev_flag, &infolist); + return add_alias_cmd (name, oldname, 0, abbrev_flag, &infolist); } /* The "info" command is defined as a prefix, with allow_unknown = 0. @@ -2965,26 +2970,26 @@ show_command (arg, from_tty) /* Add an element to the list of commands. */ -void +struct cmd_list_element * add_com (name, class, fun, doc) char *name; enum command_class class; void (*fun) PARAMS ((char *, int)); char *doc; { - add_cmd (name, class, fun, doc, &cmdlist); + return add_cmd (name, class, fun, doc, &cmdlist); } /* Add an alias or abbreviation command to the list of commands. */ -void +struct cmd_list_element * add_com_alias (name, oldname, class, abbrev_flag) char *name; char *oldname; enum command_class class; int abbrev_flag; { - add_alias_cmd (name, oldname, class, abbrev_flag, &cmdlist); + return add_alias_cmd (name, oldname, class, abbrev_flag, &cmdlist); } void |