aboutsummaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
authorFernando Nasser <fnasser@redhat.com>2000-03-23 23:43:19 +0000
committerFernando Nasser <fnasser@redhat.com>2000-03-23 23:43:19 +0000
commit5638284566b17ba60eedca50f6e7bc13e7a3cc29 (patch)
treecdb0e845d64c986b45c29217bf9ba43206f02bbe /gdb/top.c
parent4fb431855b5bf2e43f8bbac82a9e32c8b796a63f (diff)
downloadfsf-binutils-gdb-5638284566b17ba60eedca50f6e7bc13e7a3cc29.zip
fsf-binutils-gdb-5638284566b17ba60eedca50f6e7bc13e7a3cc29.tar.gz
fsf-binutils-gdb-5638284566b17ba60eedca50f6e7bc13e7a3cc29.tar.bz2
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.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/gdb/top.c b/gdb/top.c
index 4acf4db..0fac46d 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