This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[RFA] gdb/command.c, gdb/command.h: "help all"



New users often have trouble figuring out exactly what commands
are available, and often "help" by itself doesn't offer much
insight.  The "help all" command would simply list all of the
commands that are available.  (Are there possibly better ways
to generate this list?)

Fri Mar 24 12:10:38 2000  glen mccready  <gkm@pobox.com>

	* commands.c (help_all): Add functionality to display a complete
	listing of available commands.

Index: gdb/command.c
===================================================================
RCS file: /cvs/src/src/gdb/command.c,v
retrieving revision 1.3
diff -c -b -r1.3 command.c
*** command.c	2000/03/20 09:19:45	1.3
--- command.c	2000/03/24 17:19:32
***************
*** 396,401 ****
--- 396,407 ----
        return;
      }
  
+   if (strcmp (command, "all") == 0)
+     {
+       help_all (stream);
+       return;
+     }
+ 
    c = lookup_cmd (&command, cmdlist, "", 0, 0);
  
    if (c == 0)
***************
*** 486,491 ****
--- 492,518 ----
  Type \"help%s\" followed by %scommand name for full documentation.\n\
  Command name abbreviations are allowed if unambiguous.\n",
  		    cmdtype1, cmdtype2);
+ }
+ 
+ static void
+ help_all (stream)
+      struct ui_file *stream;
+ {
+   struct cmd_list_element *c;
+   extern struct cmd_list_element *cmdlist;
+ 
+   for (c = cmdlist; c; c = c->next)
+     {
+       if (c->abbrev_flag)
+         continue;
+       /* If this is a prefix command, print it's subcommands */
+       if (c->prefixlist)
+         help_cmd_list (*c->prefixlist, all_commands, c->prefixname, 0, stream);
+     
+       /* If this is a class name, print all of the commands in the class */
+       else if (c->function.cfunc == NULL)
+         help_cmd_list (cmdlist, c->class, "", 0, stream);
+     }
  }
  
  /* Print only the first line of STR on STREAM.  */
Index: gdb/command.h
===================================================================
RCS file: /cvs/src/src/gdb/command.h,v
retrieving revision 1.1.1.4
diff -c -b -r1.1.1.4 command.h
*** command.h	2000/02/02 00:21:05	1.1.1.4
--- command.h	2000/03/24 17:19:32
***************
*** 238,243 ****
--- 238,245 ----
  extern void help_cmd_list (struct cmd_list_element *, enum command_class,
  			   char *, int, struct ui_file *);
  
+ extern void help_all (struct ui_file *);
+ 
  extern struct cmd_list_element *
    add_set_cmd PARAMS ((char *, enum command_class, var_types, char *, char *,
  		       struct cmd_list_element **));

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]