Workaround for Itanium A/B step errata
[deliverable/binutils-gdb.git] / gdb / command.c
index aff3191569aa3d30c67f42c675c0345a481ef00d..6e64de42f7166b3245d2e8a67b40568313ad372f 100644 (file)
@@ -81,12 +81,8 @@ void _initialize_command (void);
    of *LIST). */
 
 struct cmd_list_element *
-add_cmd (name, class, fun, doc, list)
-     char *name;
-     enum command_class class;
-     void (*fun) (char *, int);
-     char *doc;
-     struct cmd_list_element **list;
+add_cmd (char *name, enum command_class class, void (*fun) (char *, int),
+        char *doc, struct cmd_list_element **list)
 {
   register struct cmd_list_element *c
   = (struct cmd_list_element *) xmalloc (sizeof (struct cmd_list_element));
@@ -116,7 +112,9 @@ add_cmd (name, class, fun, doc, list)
   c->doc = doc;
   c->flags = 0;
   c->replacement = NULL;
-  c->hook = NULL;
+  c->hook_pre  = NULL;
+  c->hook_post = NULL;
+  c->hook_in = 0;
   c->prefixlist = NULL;
   c->prefixname = NULL;
   c->allow_unknown = 0;
@@ -127,7 +125,8 @@ add_cmd (name, class, fun, doc, list)
   c->var_type = var_boolean;
   c->enums = NULL;
   c->user_commands = NULL;
-  c->hookee = NULL;
+  c->hookee_pre = NULL;
+  c->hookee_post = NULL;
   c->cmd_pointer = NULL;
 
   return c;
@@ -163,12 +162,8 @@ deprecate_cmd (struct cmd_list_element *cmd, char *replacement)
 #if 0                          /* Currently unused */
 
 struct cmd_list_element *
-add_abbrev_cmd (name, class, fun, doc, list)
-     char *name;
-     enum command_class class;
-     void (*fun) (char *, int);
-     char *doc;
-     struct cmd_list_element **list;
+add_abbrev_cmd (char *name, enum command_class class, void (*fun) (char *, int),
+               char *doc, struct cmd_list_element **list)
 {
   register struct cmd_list_element *c
   = add_cmd (name, class, fun, doc, list);
@@ -212,16 +207,10 @@ add_alias_cmd (char *name, char *oldname, enum command_class class,
    of the variable containing that list.  */
 
 struct cmd_list_element *
-add_prefix_cmd (name, class, fun, doc, prefixlist, prefixname,
-               allow_unknown, list)
-     char *name;
-     enum command_class class;
-     void (*fun) (char *, int);
-     char *doc;
-     struct cmd_list_element **prefixlist;
-     char *prefixname;
-     int allow_unknown;
-     struct cmd_list_element **list;
+add_prefix_cmd (char *name, enum command_class class, void (*fun) (char *, int),
+               char *doc, struct cmd_list_element **prefixlist,
+               char *prefixname, int allow_unknown,
+               struct cmd_list_element **list)
 {
   register struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
   c->prefixlist = prefixlist;
@@ -233,16 +222,10 @@ add_prefix_cmd (name, class, fun, doc, prefixlist, prefixname,
 /* Like add_prefix_cmd but sets the abbrev_flag on the new command. */
 
 struct cmd_list_element *
-add_abbrev_prefix_cmd (name, class, fun, doc, prefixlist, prefixname,
-                      allow_unknown, list)
-     char *name;
-     enum command_class class;
-     void (*fun) (char *, int);
-     char *doc;
-     struct cmd_list_element **prefixlist;
-     char *prefixname;
-     int allow_unknown;
-     struct cmd_list_element **list;
+add_abbrev_prefix_cmd (char *name, enum command_class class,
+                      void (*fun) (char *, int), char *doc,
+                      struct cmd_list_element **prefixlist, char *prefixname,
+                      int allow_unknown, struct cmd_list_element **list)
 {
   register struct cmd_list_element *c = add_cmd (name, class, fun, doc, list);
   c->prefixlist = prefixlist;
@@ -386,8 +369,10 @@ delete_cmd (char *name, struct cmd_list_element **list)
 
   while (*list && STREQ ((*list)->name, name))
     {
-      if ((*list)->hookee)
-       (*list)->hookee->hook = 0;      /* Hook slips out of its mouth */
+      if ((*list)->hookee_pre)
+      (*list)->hookee_pre->hook_pre = 0;   /* Hook slips out of its mouth */
+      if ((*list)->hookee_post)
+      (*list)->hookee_post->hook_post = 0; /* Hook slips out of its bottom  */
       p = (*list)->next;
       free ((PTR) * list);
       *list = p;
@@ -398,8 +383,11 @@ delete_cmd (char *name, struct cmd_list_element **list)
       {
        if (STREQ (c->next->name, name))
          {
-           if (c->next->hookee)
-             c->next->hookee->hook = 0;        /* hooked cmd gets away.  */
+          if (c->next->hookee_pre)
+            c->next->hookee_pre->hook_pre = 0; /* hooked cmd gets away.  */
+          if (c->next->hookee_post)
+            c->next->hookee_post->hook_post = 0; /* remove post hook */
+                                               /* :( no fishing metaphore */
            p = c->next->next;
            free ((PTR) c->next);
            c->next = p;
@@ -551,9 +539,18 @@ help_cmd (char *command, struct ui_file *stream)
   if (c->function.cfunc == NULL)
     help_list (cmdlist, "", c->class, stream);
 
-  if (c->hook)
-    fprintf_filtered (stream, "\nThis command has a hook defined: %s\n",
-                     c->hook->name);
+  if (c->hook_pre || c->hook_post)
+    fprintf_filtered (stream,
+                      "\nThis command has a hook (or hooks) defined:\n");
+
+  if (c->hook_pre)
+    fprintf_filtered (stream, 
+                      "\tThis command is run after  : %s (pre hook)\n",
+                    c->hook_pre->name);
+  if (c->hook_post)
+    fprintf_filtered (stream, 
+                      "\tThis command is run before : %s (post hook)\n",
+                    c->hook_post->name);
 }
 
 /*
@@ -1642,7 +1639,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
        case var_uinteger:
          if (arg == NULL)
            error_no_arg ("integer to set it to.");
-         *(unsigned int *) c->var = parse_and_eval_address (arg);
+         *(unsigned int *) c->var = parse_and_eval_long (arg);
          if (*(unsigned int *) c->var == 0)
            *(unsigned int *) c->var = UINT_MAX;
          break;
@@ -1651,7 +1648,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
            unsigned int val;
            if (arg == NULL)
              error_no_arg ("integer to set it to.");
-           val = parse_and_eval_address (arg);
+           val = parse_and_eval_long (arg);
            if (val == 0)
              *(int *) c->var = INT_MAX;
            else if (val >= INT_MAX)
@@ -1663,7 +1660,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
        case var_zinteger:
          if (arg == NULL)
            error_no_arg ("integer to set it to.");
-         *(int *) c->var = parse_and_eval_address (arg);
+         *(int *) c->var = parse_and_eval_long (arg);
          break;
        case var_enum:
          {
@@ -2065,7 +2062,7 @@ _initialize_command (void)
 With no arguments, run an inferior shell.");
 
   /* NOTE: cagney/2000-03-20: Being able to enter ``(gdb) !ls'' would
-     be a really useful feature.  Unfortunatly, the below wont do
+     be a really useful feature.  Unfortunately, the below wont do
      this.  Instead it adds support for the form ``(gdb) ! ls''
      (i.e. the space is required).  If the ``!'' command below is
      added the complains about no ``!'' command would be replaced by
This page took 0.024775 seconds and 4 git commands to generate.