gdb: rename cmd_list_element::prefixlist to subcommands
authorSimon Marchi <simon.marchi@polymtl.ca>
Mon, 17 May 2021 18:01:08 +0000 (14:01 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 17 May 2021 18:01:08 +0000 (14:01 -0400)
While browsing this code, I found the name "prefixlist" really
confusing.  I kept reading it as "list of prefixes".  Which it isn't:
it's a list of sub-commands, for a prefix command.  I think that
renaming it to "subcommands" would make things clearer.

gdb/ChangeLog:

* Rename "prefixlist" parameters to "subcommands" throughout.
* cli/cli-decode.h (cmd_list_element) <prefixlist>: Rename to...
<subcommands>: ... this.
* cli/cli-decode.c (lookup_cmd_for_prefixlist): Rename to...
(lookup_cmd_with_subcommands): ... this.

Change-Id: I150da10d03052c2420aa5b0dee41f422e2a97928

13 files changed:
gdb/ChangeLog
gdb/auto-load.c
gdb/cli/cli-cmds.c
gdb/cli/cli-decode.c
gdb/cli/cli-decode.h
gdb/cli/cli-script.c
gdb/cli/cli-setshow.c
gdb/command.h
gdb/completer.c
gdb/guile/scm-cmd.c
gdb/python/py-cmd.c
gdb/top.c
gdb/unittests/command-def-selftests.c

index 4ff50087f7558c49201766e2fb98b3f697814e7b..4184c9f1ff82deb0c259e4fed872fe9570febbd3 100644 (file)
@@ -1,3 +1,11 @@
+2021-05-17  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * Rename "prefixlist" parameters to "subcommands" throughout.
+       * cli/cli-decode.h (cmd_list_element) <prefixlist>: Rename to...
+       <subcommands>: ... this.
+       * cli/cli-decode.c (lookup_cmd_for_prefixlist): Rename to...
+       (lookup_cmd_with_subcommands): ... this.
+
 2021-05-17  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * cli/cli-decode.c (add_alias_cmd): Don't handle old == 0.
index b9478c45c53492904c3bd603c84fe245d4b799c6..7745aa65b0367a59db4468b6a694118d23044abc 100644 (file)
@@ -1465,7 +1465,7 @@ info_auto_load_cmd (const char *args, int from_tty)
     {
       ui_out_emit_tuple option_emitter (uiout, "option");
 
-      gdb_assert (!list->prefixlist);
+      gdb_assert (!list->subcommands);
       gdb_assert (list->type == not_set_cmd);
 
       uiout->field_string ("name", list->name);
index 284b75192581e64a393725b88a4c272cd016c28c..c29e5979acb427c11ebccafe7593ead43bae8c5c 100644 (file)
@@ -1625,7 +1625,7 @@ show_user (const char *args, int from_tty)
     {
       for (c = cmdlist; c; c = c->next)
        {
-         if (cli_user_command_p (c) || c->prefixlist != NULL)
+         if (cli_user_command_p (c) || c->subcommands != NULL)
            show_user_1 (c, "", c->name, gdb_stdout);
        }
     }
@@ -1900,7 +1900,7 @@ alias_command (const char *args, int from_tty)
       /* We've already tried to look up COMMAND.  */
       gdb_assert (c_command != NULL
                  && c_command != (struct cmd_list_element *) -1);
-      gdb_assert (c_command->prefixlist != NULL);
+      gdb_assert (c_command->subcommands != NULL);
       c_alias = lookup_cmd_1 (& alias_prefix, cmdlist, NULL, NULL, 1);
       if (c_alias != c_command)
        error (_("ALIAS and COMMAND prefixes do not match."));
@@ -1909,7 +1909,7 @@ alias_command (const char *args, int from_tty)
       alias_cmd = add_alias_cmd (xstrdup (alias_argv[alias_argc - 1]),
                                 command_argv[command_argc - 1],
                                 class_alias, a_opts.abbrev_flag,
-                                c_command->prefixlist);
+                                c_command->subcommands);
     }
 
   gdb_assert (alias_cmd != nullptr);
index 1bfc9477905a8c581d78f49177272dcdf10ffd8c..27bd311e89c1a3a198cb3d09c4c33f8e03f354da 100644 (file)
@@ -56,12 +56,12 @@ static int lookup_cmd_composition_1 (const char *text,
                                     struct cmd_list_element **cmd,
                                     struct cmd_list_element *cur_list);
 
-/* Look up a command whose 'prefixlist' is KEY.  Return the command if found,
-   otherwise return NULL.  */
+/* Look up a command whose 'subcommands' field is SUBCOMMANDS.  Return the
+   command if found, otherwise return NULL.  */
 
 static struct cmd_list_element *
-lookup_cmd_for_prefixlist (struct cmd_list_element **key,
-                          struct cmd_list_element *list)
+lookup_cmd_with_subcommands (cmd_list_element **subcommands,
+                            cmd_list_element *list)
 {
   struct cmd_list_element *p = NULL;
 
@@ -69,16 +69,16 @@ lookup_cmd_for_prefixlist (struct cmd_list_element **key,
     {
       struct cmd_list_element *q;
 
-      if (p->prefixlist == NULL)
+      if (p->subcommands == NULL)
        continue;
-      else if (p->prefixlist == key)
+      else if (p->subcommands == subcommands)
        {
          /* If we found an alias, we must return the aliased
             command.  */
          return p->cmd_pointer ? p->cmd_pointer : p;
        }
 
-      q = lookup_cmd_for_prefixlist (key, *(p->prefixlist));
+      q = lookup_cmd_with_subcommands (subcommands, *(p->subcommands));
       if (q != NULL)
        return q;
     }
@@ -163,7 +163,7 @@ set_cmd_completer_handle_brkchars (struct cmd_list_element *cmd,
 std::string
 cmd_list_element::prefixname () const
 {
-  if (this->prefixlist == nullptr)
+  if (this->subcommands == nullptr)
     /* Not a prefix command.  */
     return "";
 
@@ -236,8 +236,7 @@ do_add_cmd (const char *name, enum command_class theclass,
 
   /* Search the prefix cmd of C, and assigns it to C->prefix.
      See also add_prefix_cmd and update_prefix_field_of_prefixed_commands.  */
-  struct cmd_list_element *prefixcmd = lookup_cmd_for_prefixlist (list,
-                                                                 cmdlist);
+  cmd_list_element *prefixcmd = lookup_cmd_with_subcommands (list, cmdlist);
   c->prefix = prefixcmd;
 
 
@@ -323,7 +322,7 @@ add_alias_cmd (const char *name, cmd_list_element *old,
   /* NOTE: Both FUNC and all the FUNCTIONs need to be copied.  */
   c->func = old->func;
   c->function = old->function;
-  c->prefixlist = old->prefixlist;
+  c->subcommands = old->subcommands;
   c->allow_unknown = old->allow_unknown;
   c->abbrev_flag = abbrev_flag;
   c->cmd_pointer = old;
@@ -358,7 +357,7 @@ add_alias_cmd (const char *name, const char *oldname,
 static void
 update_prefix_field_of_prefixed_commands (struct cmd_list_element *c)
 {
-  for (cmd_list_element *p = *c->prefixlist; p != NULL; p = p->next)
+  for (cmd_list_element *p = *c->subcommands; p != NULL; p = p->next)
     {
       p->prefix = c;
 
@@ -371,9 +370,9 @@ update_prefix_field_of_prefixed_commands (struct cmd_list_element *c)
         In such a case, when 'auto-load' was created by do_add_cmd,
         the 'libthread-db' prefix field could not be updated, as the
         'auto-load' command was not yet reachable by
-           lookup_cmd_for_prefixlist (list, cmdlist)
+           lookup_cmd_for_subcommands (list, cmdlist)
            that searches from the top level 'cmdlist'.  */
-      if (p->prefixlist != nullptr)
+      if (p->subcommands != nullptr)
        update_prefix_field_of_prefixed_commands (p);
     }
 }
@@ -381,18 +380,18 @@ update_prefix_field_of_prefixed_commands (struct cmd_list_element *c)
 
 /* Like add_cmd but adds an element for a command prefix: a name that
    should be followed by a subcommand to be looked up in another
-   command list.  PREFIXLIST should be the address of the variable
+   command list.  SUBCOMMANDS should be the address of the variable
    containing that list.  */
 
 struct cmd_list_element *
 add_prefix_cmd (const char *name, enum command_class theclass,
                cmd_const_cfunc_ftype *fun,
-               const char *doc, struct cmd_list_element **prefixlist,
+               const char *doc, struct cmd_list_element **subcommands,
                int allow_unknown, struct cmd_list_element **list)
 {
   struct cmd_list_element *c = add_cmd (name, theclass, fun, doc, list);
 
-  c->prefixlist = prefixlist;
+  c->subcommands = subcommands;
   c->allow_unknown = allow_unknown;
 
   /* Now that prefix command C is defined, we need to set the prefix field
@@ -412,7 +411,7 @@ do_prefix_cmd (const char *args, int from_tty, struct cmd_list_element *c)
   while (c->cmd_pointer != nullptr)
     c = c->cmd_pointer;
 
-  help_list (*c->prefixlist, c->prefixname ().c_str (),
+  help_list (*c->subcommands, c->prefixname ().c_str (),
             all_commands, gdb_stdout);
 }
 
@@ -420,11 +419,11 @@ do_prefix_cmd (const char *args, int from_tty, struct cmd_list_element *c)
 
 struct cmd_list_element *
 add_basic_prefix_cmd (const char *name, enum command_class theclass,
-                     const char *doc, struct cmd_list_element **prefixlist,
+                     const char *doc, struct cmd_list_element **subcommands,
                      int allow_unknown, struct cmd_list_element **list)
 {
   struct cmd_list_element *cmd = add_prefix_cmd (name, theclass, nullptr,
-                                                doc, prefixlist,
+                                                doc, subcommands,
                                                 allow_unknown, list);
   set_cmd_sfunc (cmd, do_prefix_cmd);
   return cmd;
@@ -436,18 +435,18 @@ add_basic_prefix_cmd (const char *name, enum command_class theclass,
 static void
 do_show_prefix_cmd (const char *args, int from_tty, struct cmd_list_element *c)
 {
-  cmd_show_list (*c->prefixlist, from_tty);
+  cmd_show_list (*c->subcommands, from_tty);
 }
 
 /* See command.h.  */
 
 struct cmd_list_element *
 add_show_prefix_cmd (const char *name, enum command_class theclass,
-                    const char *doc, struct cmd_list_element **prefixlist,
+                    const char *doc, struct cmd_list_element **subcommands,
                     int allow_unknown, struct cmd_list_element **list)
 {
   struct cmd_list_element *cmd = add_prefix_cmd (name, theclass, nullptr,
-                                                doc, prefixlist,
+                                                doc, subcommands,
                                                 allow_unknown, list);
   set_cmd_sfunc (cmd, do_show_prefix_cmd);
   return cmd;
@@ -460,12 +459,12 @@ struct cmd_list_element *
 add_prefix_cmd_suppress_notification
               (const char *name, enum command_class theclass,
                cmd_const_cfunc_ftype *fun,
-               const char *doc, struct cmd_list_element **prefixlist,
+               const char *doc, struct cmd_list_element **subcommands,
                int allow_unknown, struct cmd_list_element **list,
                int *suppress_notification)
 {
   struct cmd_list_element *element
-    = add_prefix_cmd (name, theclass, fun, doc, prefixlist,
+    = add_prefix_cmd (name, theclass, fun, doc, subcommands,
                      allow_unknown, list);
   element->suppress_notification = suppress_notification;
   return element;
@@ -476,12 +475,12 @@ add_prefix_cmd_suppress_notification
 struct cmd_list_element *
 add_abbrev_prefix_cmd (const char *name, enum command_class theclass,
                       cmd_const_cfunc_ftype *fun, const char *doc,
-                      struct cmd_list_element **prefixlist,
+                      struct cmd_list_element **subcommands,
                       int allow_unknown, struct cmd_list_element **list)
 {
   struct cmd_list_element *c = add_cmd (name, theclass, fun, doc, list);
 
-  c->prefixlist = prefixlist;
+  c->subcommands = subcommands;
   c->allow_unknown = allow_unknown;
   c->abbrev_flag = 1;
   return c;
@@ -1188,11 +1187,11 @@ apropos_cmd (struct ui_file *stream,
            print_doc_of_command (c, prefix, verbose, regex, stream);
        }
       /* Check if this command has subcommands.  */
-      if (c->prefixlist != NULL)
+      if (c->subcommands != NULL)
        {
          /* Recursively call ourselves on the subcommand list,
             passing the right prefix in.  */
-         apropos_cmd (stream, *c->prefixlist, verbose, regex,
+         apropos_cmd (stream, *c->subcommands, verbose, regex,
                       c->prefixname ().c_str ());
        }
     }
@@ -1235,7 +1234,7 @@ help_cmd (const char *command, struct ui_file *stream)
   lookup_cmd_composition (orig_command, &alias, &prefix_cmd, &c_cmd);
 
   /* There are three cases here.
-     If c->prefixlist is nonzero, we have a prefix command.
+     If c->subcommands is nonzero, we have a prefix command.
      Print its documentation, then list its subcommands.
 
      If c->func is non NULL, we really have a command.  Print its
@@ -1253,13 +1252,13 @@ help_cmd (const char *command, struct ui_file *stream)
   fputs_filtered (c->doc, stream);
   fputs_filtered ("\n", stream);
 
-  if (c->prefixlist == 0 && c->func != NULL)
+  if (c->subcommands == 0 && c->func != NULL)
     return;
   fprintf_filtered (stream, "\n");
 
   /* If this is a prefix command, print it's subcommands.  */
-  if (c->prefixlist)
-    help_list (*c->prefixlist, c->prefixname ().c_str (),
+  if (c->subcommands)
+    help_list (*c->subcommands, c->prefixname ().c_str (),
               all_commands, stream);
 
   /* If this is a class name, print all of the commands in the class.  */
@@ -1450,12 +1449,12 @@ print_help_for_command (struct cmd_list_element *c,
   fput_aliases_definition_styled (c, stream);
 
   if (recurse
-      && c->prefixlist != 0
+      && c->subcommands != 0
       && c->abbrev_flag == 0)
     /* Subcommands of a prefix command typically have 'all_commands'
        as class.  If we pass CLASS to recursive invocation,
        most often we won't see anything.  */
-    help_cmd_list (*c->prefixlist, all_commands, true, stream);
+    help_cmd_list (*c->subcommands, all_commands, true, stream);
 }
 
 /*
@@ -1520,10 +1519,10 @@ help_cmd_list (struct cmd_list_element *list, enum command_class theclass,
 
       if (recurse
          && (theclass == class_user || theclass == class_alias)
-         && c->prefixlist != NULL)
+         && c->subcommands != NULL)
        {
          /* User-defined commands or aliases may be subcommands.  */
-         help_cmd_list (*c->prefixlist, theclass, recurse, stream);
+         help_cmd_list (*c->subcommands, theclass, recurse, stream);
          continue;
        }
 
@@ -1698,9 +1697,9 @@ lookup_cmd_1 (const char **text, struct cmd_list_element *clist,
     }
   /* If we found a prefix command, keep looking.  */
 
-  if (found->prefixlist)
+  if (found->subcommands)
     {
-      c = lookup_cmd_1 (text, *found->prefixlist, result_list, default_args,
+      c = lookup_cmd_1 (text, *found->subcommands, result_list, default_args,
                        ignore_help_classes, lookup_for_completion_p);
       if (!c)
        {
@@ -1718,7 +1717,7 @@ lookup_cmd_1 (const char **text, struct cmd_list_element *clist,
             we've found (if an inferior hasn't already set it).  */
          if (result_list != nullptr)
            if (!*result_list)
-             /* This used to say *result_list = *found->prefixlist.
+             /* This used to say *result_list = *found->subcommands.
                 If that was correct, need to modify the documentation
                 at the top of this function to clarify what is
                 supposed to be going on.  */
@@ -1810,14 +1809,14 @@ lookup_cmd (const char **line, struct cmd_list_element *list,
     }
   else if (c == CMD_LIST_AMBIGUOUS)
     {
-      /* Ambigous.  Local values should be off prefixlist or called
+      /* Ambigous.  Local values should be off subcommands or called
         values.  */
       int local_allow_unknown = (last_list ? last_list->allow_unknown :
                                 allow_unknown);
       std::string local_cmdtype
        = last_list ? last_list->prefixname () : cmdtype;
       struct cmd_list_element *local_list =
-       (last_list ? *(last_list->prefixlist) : list);
+       (last_list ? *(last_list->subcommands) : list);
 
       if (local_allow_unknown < 0)
        {
@@ -1869,7 +1868,7 @@ lookup_cmd (const char **line, struct cmd_list_element *list,
       while (**line == ' ' || **line == '\t')
        (*line)++;
 
-      if (c->prefixlist && **line && !c->allow_unknown)
+      if (c->subcommands && **line && !c->allow_unknown)
        undef_cmd_error (c->prefixname ().c_str (), *line);
 
       /* Seems to be what he wants.  Return it.  */
@@ -2060,9 +2059,9 @@ lookup_cmd_composition_1 (const char *text,
       text += len;
       text = skip_spaces (text);
 
-      if ((*cmd)->prefixlist != nullptr && *text != '\0')
+      if ((*cmd)->subcommands != nullptr && *text != '\0')
        {
-         cur_list = *(*cmd)->prefixlist;
+         cur_list = *(*cmd)->subcommands;
          *prefix_cmd = *cmd;
        }
       else
@@ -2127,7 +2126,7 @@ complete_on_cmdlist (struct cmd_list_element *list,
        if (!strncmp (ptr->name, text, textlen)
            && !ptr->abbrev_flag
            && (!ignore_help_classes || ptr->func
-               || ptr->prefixlist))
+               || ptr->subcommands))
          {
            if (pass == 0)
              {
index e6d6f32cbfa923b27fc39a480567db32f148b9e2..e2428bdddf7de1828b66ade1737dc2dfa13a54d3 100644 (file)
@@ -187,7 +187,7 @@ struct cmd_list_element
 
   /* Nonzero identifies a prefix command.  For them, the address
      of the variable containing the list of subcommands.  */
-  struct cmd_list_element **prefixlist = nullptr;
+  struct cmd_list_element **subcommands = nullptr;
 
   /* The prefix command of this command.  */
   struct cmd_list_element *prefix = nullptr;
index eb8853a5e649a7afc6ea601cf529be57bc21a971..5ddfab9674a096b089c6a12445666b491393f3fd 100644 (file)
@@ -1350,10 +1350,10 @@ validate_comname (const char **comname)
       const char *tem = prefix.c_str ();
 
       c = lookup_cmd (&tem, cmdlist, "", NULL, 0, 1);
-      if (c->prefixlist == NULL)
+      if (c->subcommands == NULL)
        error (_("\"%s\" is not a prefix command."), prefix.c_str ());
 
-      list = c->prefixlist;
+      list = c->subcommands;
       *comname = last_word;
     }
 
@@ -1414,7 +1414,7 @@ do_define_command (const char *comname, int from_tty,
          /* if C is a prefix command that was previously defined,
             tell the user its subcommands will be kept, and ask
             if ok to redefine the command.  */
-         if (c->prefixlist != nullptr)
+         if (c->subcommands != nullptr)
            q = (c->user_commands.get () == nullptr
                 || query (_("Keeping subcommands of prefix command \"%s\".\n"
                             "Redefine command \"%s\"? "), c->name, c->name));
@@ -1470,8 +1470,8 @@ do_define_command (const char *comname, int from_tty,
     cmds = *commands;
 
   {
-    struct cmd_list_element **c_prefixlist
-      = c == nullptr ? nullptr : c->prefixlist;
+    struct cmd_list_element **c_subcommands
+      = c == nullptr ? nullptr : c->subcommands;
 
     newc = add_cmd (comname, class_user, user_defined_command,
                    (c != nullptr && c->theclass == class_user)
@@ -1480,9 +1480,9 @@ do_define_command (const char *comname, int from_tty,
 
     /* If we define or re-define a command that was previously defined
        as a prefix, keep the prefix information.  */
-    if (c_prefixlist != nullptr)
+    if (c_subcommands != nullptr)
       {
-       newc->prefixlist = c_prefixlist;
+       newc->subcommands = c_subcommands;
        /* allow_unknown: see explanation in equivalent logic in
           define_prefix_command ().  */
        newc->allow_unknown = newc->user_commands.get () != nullptr;
@@ -1595,7 +1595,7 @@ define_prefix_command (const char *comname, int from_tty)
   if (c != nullptr && c->theclass != class_user)
     error (_("Command \"%s\" is built-in."), comfull);
 
-  if (c != nullptr && c->prefixlist != nullptr)
+  if (c != nullptr && c->subcommands != nullptr)
     {
       /* c is already a user defined prefix command.  */
       return;
@@ -1609,10 +1609,10 @@ define_prefix_command (const char *comname, int from_tty)
                   xstrdup ("User-defined."), list);
     }
 
-  /* Allocate the c->prefixlist, which marks the command as a prefix
+  /* Allocate the c->subcommands, which marks the command as a prefix
      command.  */
-  c->prefixlist = new struct cmd_list_element*;
-  *(c->prefixlist) = nullptr;
+  c->subcommands = new struct cmd_list_element*;
+  *(c->subcommands) = nullptr;
   /* If the prefix command C is not a command, then it must be followed
      by known subcommands.  Otherwise, if C is also a normal command,
      it can be followed by C args that must not cause a 'subcommand'
@@ -1665,7 +1665,7 @@ show_user_1 (struct cmd_list_element *c, const char *prefix, const char *name,
       struct command_line *cmdlines = c->user_commands.get ();
 
       fprintf_filtered (stream, "User %scommand \"",
-                       c->prefixlist == NULL ? "" : "prefix ");
+                       c->subcommands == NULL ? "" : "prefix ");
       fprintf_styled (stream, title_style.style (), "%s%s",
                      prefix, name);
       fprintf_filtered (stream, "\":\n");
@@ -1676,12 +1676,12 @@ show_user_1 (struct cmd_list_element *c, const char *prefix, const char *name,
        }
     }
 
-  if (c->prefixlist != NULL)
+  if (c->subcommands != NULL)
     {
       const std::string prefixname = c->prefixname ();
 
-      for (c = *c->prefixlist; c != NULL; c = c->next)
-       if (c->theclass == class_user || c->prefixlist != NULL)
+      for (c = *c->subcommands; c != NULL; c = c->next)
+       if (c->theclass == class_user || c->subcommands != NULL)
          show_user_1 (c, prefixname.c_str (), c->name, gdb_stdout);
     }
 
index 35482e1c5cc6f45e0a0fc0e1a3213c24871f0040..cb72c6241cbf8f857ed1e9843d833c742ad5c3be 100644 (file)
@@ -550,10 +550,10 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
          p = p->prefix;
        }
 
-      /* Don't trigger any observer notification if prefixlist is not
+      /* Don't trigger any observer notification if subcommands is not
         setlist.  */
       i--;
-      if (cmds[i]->prefixlist != &setlist)
+      if (cmds[i]->subcommands != &setlist)
        {
          xfree (cmds);
          xfree (name);
@@ -740,7 +740,7 @@ cmd_show_list (struct cmd_list_element *list, int from_tty)
 
       /* If we find a prefix, run its list, prefixing our output by its
         prefix (with "show " skipped).  */
-      if (list->prefixlist && list->cmd_pointer == nullptr)
+      if (list->subcommands && list->cmd_pointer == nullptr)
        {
          ui_out_emit_tuple optionlist_emitter (uiout, "optionlist");
          std::string prefixname = list->prefixname ();
@@ -748,7 +748,7 @@ cmd_show_list (struct cmd_list_element *list, int from_tty)
 
          if (uiout->is_mi_like_p ())
            uiout->field_string ("prefix", new_prefix);
-         cmd_show_list (*list->prefixlist, from_tty);
+         cmd_show_list (*list->subcommands, from_tty);
        }
       else if (list->theclass != no_set_class && list->cmd_pointer == nullptr)
        {
@@ -758,7 +758,7 @@ cmd_show_list (struct cmd_list_element *list, int from_tty)
            {
              /* If we find a prefix, output it (with "show " skipped).  */
              std::string prefixname = list->prefix->prefixname ();
-             prefixname = (list->prefix->prefixlist == nullptr ? ""
+             prefixname = (list->prefix->subcommands == nullptr ? ""
                            : strstr (prefixname.c_str (), "show ") + 5);
              uiout->text (prefixname.c_str ());
            }
index 33feb19166c690e2ea23f888940e3b3781e9445c..fe3c7b482f04b809577da73957c02014873b20df 100644 (file)
@@ -208,7 +208,7 @@ extern struct cmd_list_element *add_show_prefix_cmd
 extern struct cmd_list_element *add_prefix_cmd_suppress_notification
                        (const char *name, enum command_class theclass,
                         cmd_const_cfunc_ftype *fun,
-                        const char *doc, struct cmd_list_element **prefixlist,
+                        const char *doc, struct cmd_list_element **subcommands,
                         int allow_unknown,
                         struct cmd_list_element **list,
                         int *suppress_notification);
index 80e8c7b743e1a75d0a212a6980fd21b9b5790b9b..6d39435c6ca3151ce04ff617a7e281e19fa09ee4 100644 (file)
@@ -1428,7 +1428,7 @@ complete_line_internal_1 (completion_tracker &tracker,
          if (result_list)
            {
              if (reason != handle_brkchars)
-               complete_on_cmdlist (*result_list->prefixlist, tracker, p,
+               complete_on_cmdlist (*result_list->subcommands, tracker, p,
                                     word, ignore_help_classes);
            }
          else
@@ -1456,12 +1456,12 @@ complete_line_internal_1 (completion_tracker &tracker,
            {
              /* The command is followed by whitespace; we need to
                 complete on whatever comes after command.  */
-             if (c->prefixlist)
+             if (c->subcommands)
                {
                  /* It is a prefix command; what comes after it is
                     a subcommand (e.g. "info ").  */
                  if (reason != handle_brkchars)
-                   complete_on_cmdlist (*c->prefixlist, tracker, p, word,
+                   complete_on_cmdlist (*c->subcommands, tracker, p, word,
                                         ignore_help_classes);
 
                  /* Ensure that readline does the right thing
@@ -1524,7 +1524,7 @@ complete_line_internal_1 (completion_tracker &tracker,
        {
          /* There is non-whitespace beyond the command.  */
 
-         if (c->prefixlist && !c->allow_unknown)
+         if (c->subcommands && !c->allow_unknown)
            {
              /* It is an unrecognized subcommand of a prefix command,
                 e.g. "info adsfkdj".  */
index 1f35d881a2d1e1dd9d1e486cd871d9c9fe1edca8..fc7dc2b7d0bedcabd11f0a4c7e91292240c1895e 100644 (file)
@@ -524,10 +524,10 @@ gdbscm_parse_command_name (const char *name,
                                 gdbscm_scm_from_c_string (name), msg);
     }
 
-  if (elt->prefixlist)
+  if (elt->subcommands)
     {
       xfree (prefix_text);
-      *base_list = elt->prefixlist;
+      *base_list = elt->subcommands;
       return result;
     }
 
index 6f7794cdf53df40d212e6786109a1dddd4ea6aa9..c2c0df5798dad40f9785c1f27ac23cc6e2ddc124 100644 (file)
@@ -111,7 +111,7 @@ cmdpy_function (struct cmd_list_element *command,
     error (_("Invalid invocation of Python command object."));
   if (! PyObject_HasAttr ((PyObject *) obj, invoke_cst))
     {
-      if (obj->command->prefixlist != nullptr)
+      if (obj->command->subcommands != nullptr)
        {
          /* A prefix command does not need an invoke method.  */
          return;
@@ -393,9 +393,9 @@ gdbpy_parse_command_name (const char *name,
       return NULL;
     }
 
-  if (elt->prefixlist)
+  if (elt->subcommands)
     {
-      *base_list = elt->prefixlist;
+      *base_list = elt->subcommands;
       return result;
     }
 
index 2eb68fd2bc0e0103e7e164d6194630f3de8e5b0a..a391e9359de01be444163b741f1a0c522cd51072 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -647,7 +647,7 @@ execute_command (const char *p, int from_tty)
       if (c->theclass == class_user && c->user_commands)
        execute_user_command (c, arg);
       else if (c->theclass == class_user
-              && c->prefixlist && !c->allow_unknown)
+              && c->subcommands && !c->allow_unknown)
        /* If this is a user defined prefix that does not allow unknown
           (in other words, C is a prefix command and not a command
           that can be followed by its args), report the list of
@@ -659,7 +659,7 @@ execute_command (const char *p, int from_tty)
          printf_unfiltered
            ("\"%s\" must be followed by the name of a subcommand.\n",
             prefixname_no_space.c_str ());
-         help_list (*c->prefixlist, prefixname.c_str (), all_commands,
+         help_list (*c->subcommands, prefixname.c_str (), all_commands,
                     gdb_stdout);
        }
       else if (c->type == set_cmd)
index 040e22b93909ad30fea077971010b56d098453db..53e5626f64598de2764387e996da6d1d8f5ff5a9 100644 (file)
@@ -83,11 +83,11 @@ check_doc (struct cmd_list_element *commandlist, const char *prefix)
       /* Check if this command has subcommands and is not an
         abbreviation.  We skip checking subcommands of abbreviations
         in order to avoid duplicates in the output.  */
-      if (c->prefixlist != NULL && !c->abbrev_flag)
+      if (c->subcommands != NULL && !c->abbrev_flag)
        {
          /* Recursively call ourselves on the subcommand list,
             passing the right prefix in.  */
-         check_doc (*c->prefixlist, c->prefixname ().c_str ());
+         check_doc (*c->subcommands, c->prefixname ().c_str ());
        }
     }
 }
@@ -155,11 +155,11 @@ traverse_command_structure (struct cmd_list_element **list,
     {
       /* If this command has subcommands and is not an alias,
         traverse the subcommands.  */
-      if (c->prefixlist != NULL && c->cmd_pointer == nullptr)
+      if (c->subcommands != NULL && c->cmd_pointer == nullptr)
        {
          /* Recursively call ourselves on the subcommand list,
             passing the right prefix in.  */
-         traverse_command_structure (c->prefixlist, c->prefixname ().c_str ());
+         traverse_command_structure (c->subcommands, c->prefixname ().c_str ());
        }
       if (prefixcmd != c->prefix
          || (prefixcmd == nullptr && *list != cmdlist))
This page took 0.042512 seconds and 4 git commands to generate.