]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/cli/cli-decode.c
This commit was manufactured by cvs2svn to create branch 'gdb_7_0-branch'.
[thirdparty/binutils-gdb.git] / gdb / cli / cli-decode.c
index 556c0278a843855fde27edfb2892c5bfd7a31477..3e4f6f57f9a01ca01e3308b8e7dadb8e3502c538 100644 (file)
@@ -112,18 +112,6 @@ get_cmd_context (struct cmd_list_element *cmd)
   return cmd->context;
 }
 
-void
-set_cmd_no_selected_thread_ok (struct cmd_list_element *cmd)
-{
-  cmd->flags |= CMD_NO_SELECTED_THREAD_OK;
-}
-
-int
-get_cmd_no_selected_thread_ok (struct cmd_list_element *cmd)
-{
-  return cmd->flags & CMD_NO_SELECTED_THREAD_OK;
-}
-
 enum cmd_types
 cmd_type (struct cmd_list_element *cmd)
 {
@@ -132,7 +120,8 @@ cmd_type (struct cmd_list_element *cmd)
 
 void
 set_cmd_completer (struct cmd_list_element *cmd,
-                  char **(*completer) (char *text, char *word))
+                  char **(*completer) (struct cmd_list_element *self,
+                                       char *text, char *word))
 {
   cmd->completer = completer; /* Ok.  */
 }
@@ -207,7 +196,8 @@ add_cmd (char *name, enum command_class class, void (*fun) (char *, int),
   c->prefixname = NULL;
   c->allow_unknown = 0;
   c->abbrev_flag = 0;
-  set_cmd_completer (c, make_symbol_completion_list);
+  set_cmd_completer (c, make_symbol_completion_list_fn);
+  c->destroyer = NULL;
   c->type = not_set_cmd;
   c->var = NULL;
   c->var_type = var_boolean;
@@ -261,7 +251,7 @@ add_alias_cmd (char *name, char *oldname, enum command_class class,
                                                     &prehook, &prehookee,
                                                     &posthook, &posthookee);
       /* If this happens, it means a programmer error somewhere.  */
-      gdb_assert (!aliases && !prehook && prehookee
+      gdb_assert (!aliases && !prehook && !prehookee
                  && !posthook && ! posthookee);
       return 0;
     }
@@ -407,17 +397,6 @@ add_setshow_cmd_full (char *name,
     *show_result = show;
 }
 
-struct cmd_list_element *
-deprecated_add_set_cmd (char *name,
-                       enum command_class class,
-                       var_types var_type,
-                       void *var,
-                       char *doc,
-                       struct cmd_list_element **list)
-{
-  return add_set_or_show_cmd (name, set_cmd, class, var_type, var, doc, list);
-}
-
 /* Add element named NAME to command list LIST (the list for set or
    some sublist thereof).  CLASS is as in add_cmd.  ENUMLIST is a list
    of strings which may follow NAME.  VAR is address of the variable
@@ -688,6 +667,8 @@ delete_cmd (char *name, struct cmd_list_element **list,
     {
       if (strcmp (iter->name, name) == 0)
        {
+         if (iter->destroyer)
+           iter->destroyer (iter, iter->context);
          if (iter->hookee_pre)
            iter->hookee_pre->hook_pre = 0;
          *prehook = iter->hook_pre;
@@ -774,10 +755,11 @@ apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
                         struct re_pattern_buffer *regex, char *prefix)
 {
   struct cmd_list_element *c;
-  int returnvalue=1; /*Needed to avoid double printing*/
+  int returnvalue;
   /* Walk through the commands */
   for (c=commandlist;c;c=c->next)
     {
+      returnvalue = -1; /*Needed to avoid double printing*/
       if (c->name != NULL)
        {
          /* Try to match against the name*/
@@ -788,7 +770,7 @@ apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
                                      0 /* don't recurse */, stream);
            }
        }
-      if (c->doc != NULL && returnvalue != 0)
+      if (c->doc != NULL && returnvalue < 0)
        {
          /* Try to match against documentation */
          if (re_search(regex,c->doc,strlen(c->doc),0,strlen(c->doc),NULL) >=0)
@@ -797,8 +779,11 @@ apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
                                      0 /* don't recurse */, stream);
            }
        }
-      /* Check if this command has subcommands */
-      if (c->prefixlist != NULL)
+      /* Check if this command has subcommands and is not an abbreviation.
+        We skip listing subcommands of abbreviations in order to avoid
+        duplicates in the output.
+       */
+      if (c->prefixlist != NULL && !c->abbrev_flag)
        {
          /* Recursively call ourselves on the subcommand list,
             passing the right prefix in.