From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2846 invoked by alias); 31 Oct 2006 12:11:12 -0000 Received: (qmail 2837 invoked by uid 22791); 31 Oct 2006 12:11:11 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 31 Oct 2006 12:10:58 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GesSD-0004Y1-Nd for gdb-patches@sources.redhat.com; Tue, 31 Oct 2006 13:10:53 +0100 Received: from wind.lvk.cs.msu.su ([158.250.17.9]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 31 Oct 2006 13:10:53 +0100 Received: from ghost by wind.lvk.cs.msu.su with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 31 Oct 2006 13:10:53 +0100 To: gdb-patches@sources.redhat.com From: Vladimir Prus Subject: Re: Improve "help all" Date: Tue, 31 Oct 2006 12:11:00 -0000 Message-ID: References: <200610272340.26372.vladimir@codesourcery.com> <200610281557.57708.vladimir@codesourcery.com> <20061028152928.GA396@nevyn.them.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2577369.3jXK12zKzC" Content-Transfer-Encoding: 7Bit User-Agent: KNode/0.10.2 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00309.txt.bz2 --nextPart2577369.3jXK12zKzC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8Bit Content-length: 1423 Daniel Jacobowitz wrote: > On Sat, Oct 28, 2006 at 02:26:19PM +0200, Eli Zaretskii wrote: >> > From: Vladimir Prus >> > Date: Sat, 28 Oct 2006 15:57:57 +0400 >> > Cc: gdb-patches@sources.redhat.com >> > >> > Archived output is attached. >> >> Thanks. It looks fine to me. >> >> Perhaps we should assign classes to the 3 unclassified commands that >> appear near the end. I think they all should go where `set' is, since >> that's where their corresponding `set' commands are. > > Perhaps a strategic assertion when adding commands? > > Here's a couple of other things we noticed during the discussion that > prompted this patch - lesser improvements than mentioning "apropos" > prominently, I think: > > - The help output doesn't mention which class a command is in; this > might be useful, for finding related commands. The attached patch implements it. The output I get is: (gdb) help step Step program until it reaches a different source line. Argument N means do this N times (or till program stops for another reason). Run "help running" for the list of all commands in this class. This patch would require changing "breakpoint" command that already suggests to use "help breakpoints" in its own help string -- I'll do this later if this patch is approved. OK? - Volodya * cli/cli-decode.c (help_cmd): Find and mention the class of commands. --nextPart2577369.3jXK12zKzC Content-Type: text/x-diff; name="show_class.diff" Content-Transfer-Encoding: 8Bit Content-Disposition: attachment; filename="show_class.diff" Content-length: 2667 ? a.c ? help.diff ? show_class.diff Index: cli-decode.c =================================================================== RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v retrieving revision 1.59 diff -u -r1.59 cli-decode.c --- cli-decode.c 31 Oct 2006 11:45:41 -0000 1.59 +++ cli-decode.c 31 Oct 2006 12:09:05 -0000 @@ -731,6 +731,7 @@ help_cmd (char *command, struct ui_file *stream) { struct cmd_list_element *c; + struct cmd_list_element *c2; extern struct cmd_list_element *cmdlist; if (!command) @@ -765,30 +766,47 @@ fputs_filtered (c->doc, stream); fputs_filtered ("\n", stream); - if (c->prefixlist == 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, all_commands, stream); - - /* If this is a class name, print all of the commands in the class */ - if (c->func == NULL) - help_list (cmdlist, "", c->class, stream); + if (c->prefixlist != 0 || c->func == NULL) + { + /* This is either prefix command or class. */ + fprintf_filtered (stream, "\n"); + /* If this is a prefix command, print it's subcommands */ + if (c->prefixlist) + help_list (*c->prefixlist, c->prefixname, all_commands, stream); + + /* If this is a class name, print all of the commands in the class */ + if (c->func == NULL) + help_list (cmdlist, "", c->class, stream); + } + if (c->hook_pre || c->hook_post) fprintf_filtered (stream, - "\nThis command has a hook (or hooks) defined:\n"); - + "\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); + "\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); + "\tThis command is run before : %s (post hook)\n", + c->hook_post->name); + + if (c->func != NULL) + { + /* This is either ordinary command or prefix command, but not + a command class. Find the name of the class it belongs + too. */ + for (c2 = cmdlist;;c2 = c2->next) + if (c2->class == c->class && c2->func == NULL && c2->prefixlist == 0) + break; + + if (c2) + fprintf_filtered (stream, + "\nRun \"help %s\" for the list of all " + "commands in this class.\n", c2->name); + } } /* --nextPart2577369.3jXK12zKzC--