? 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); + } } /*