diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 14 | ||||
-rw-r--r-- | gdb/cli/cli-cmds.c | 122 | ||||
-rw-r--r-- | gdb/cli/cli-cmds.h | 20 | ||||
-rw-r--r-- | gdb/cli/cli-decode.c | 182 | ||||
-rw-r--r-- | gdb/cli/cli-decode.h | 39 | ||||
-rw-r--r-- | gdb/cli/cli-dump.c | 32 | ||||
-rw-r--r-- | gdb/cli/cli-interp.c | 22 | ||||
-rw-r--r-- | gdb/cli/cli-logging.c | 20 | ||||
-rw-r--r-- | gdb/cli/cli-script.c | 113 | ||||
-rw-r--r-- | gdb/cli/cli-setshow.c | 20 | ||||
-rw-r--r-- | gdb/cli/cli-setshow.h | 8 | ||||
-rw-r--r-- | gdb/command.h | 8 |
12 files changed, 321 insertions, 279 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e9b36c5..fab7e82 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,19 @@ 2010-12-28 Michael Snyder <msnyder@vmware.com> + * command.h: Comment clean-up. + * cli/cli-cmds.c: Ditto. + * cli/cli-cmds.h: Ditto. + * cli/cli-decode.c: Ditto. + * cli/cli-decode.h: Ditto. + * cli/cli-dump.c: Ditto. + * cli/cli-interp.c: Ditto. + * cli/cli-logging.c: Ditto. + * cli/cli-script.c: Ditto. + * cli/cli-setshow.c: Ditto. + * cli/cli-setshow.h: Ditto. + +2010-12-28 Michael Snyder <msnyder@vmware.com> + * event-loop.c: Comment clean-up. * event-loop.h: Ditto. * event-top.c: Ditto. diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index e5df8f5..21194a4 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -24,9 +24,9 @@ #include "readline/readline.h" #include "readline/tilde.h" #include "completer.h" -#include "target.h" /* For baud_rate, remote_debug and remote_timeout */ -#include "gdb_wait.h" /* For shell escape implementation */ -#include "gdb_regex.h" /* Used by apropos_command */ +#include "target.h" /* For baud_rate, remote_debug and remote_timeout. */ +#include "gdb_wait.h" /* For shell escape implementation. */ +#include "gdb_regex.h" /* Used by apropos_command. */ #include "gdb_string.h" #include "gdb_vfork.h" #include "linespec.h" @@ -34,7 +34,7 @@ #include "frame.h" #include "value.h" #include "language.h" -#include "filenames.h" /* for DOSish file names */ +#include "filenames.h" /* For DOSish file names. */ #include "objfiles.h" #include "source.h" #include "disasm.h" @@ -51,7 +51,7 @@ #include "python/python.h" #ifdef TUI -#include "tui/tui.h" /* For tui_active et.al. */ +#include "tui/tui.h" /* For tui_active et.al. */ #endif #include <fcntl.h> @@ -105,35 +105,35 @@ struct cmd_list_element *cmdlist; struct cmd_list_element *infolist; -/* Chain containing all defined enable subcommands. */ +/* Chain containing all defined enable subcommands. */ struct cmd_list_element *enablelist; -/* Chain containing all defined disable subcommands. */ +/* Chain containing all defined disable subcommands. */ struct cmd_list_element *disablelist; -/* Chain containing all defined toggle subcommands. */ +/* Chain containing all defined toggle subcommands. */ struct cmd_list_element *togglelist; -/* Chain containing all defined stop subcommands. */ +/* Chain containing all defined stop subcommands. */ struct cmd_list_element *stoplist; -/* Chain containing all defined delete subcommands. */ +/* Chain containing all defined delete subcommands. */ struct cmd_list_element *deletelist; -/* Chain containing all defined detach subcommands. */ +/* Chain containing all defined detach subcommands. */ struct cmd_list_element *detachlist; -/* Chain containing all defined kill subcommands. */ +/* Chain containing all defined kill subcommands. */ struct cmd_list_element *killlist; -/* Chain containing all defined "enable breakpoint" subcommands. */ +/* Chain containing all defined "enable breakpoint" subcommands. */ struct cmd_list_element *enablebreaklist; @@ -161,15 +161,15 @@ struct cmd_list_element *showhistlist; struct cmd_list_element *unsethistlist; -/* Chain containing all defined maintenance subcommands. */ +/* Chain containing all defined maintenance subcommands. */ struct cmd_list_element *maintenancelist; -/* Chain containing all defined "maintenance info" subcommands. */ +/* Chain containing all defined "maintenance info" subcommands. */ struct cmd_list_element *maintenanceinfolist; -/* Chain containing all defined "maintenance print" subcommands. */ +/* Chain containing all defined "maintenance print" subcommands. */ struct cmd_list_element *maintenanceprintlist; @@ -206,7 +206,7 @@ static const char *script_ext_enums[] = { static const char *script_ext_mode = script_ext_soft; /* Utility used everywhere when at least one argument is needed and - none is supplied. */ + none is supplied. */ void error_no_arg (char *why) @@ -215,7 +215,8 @@ error_no_arg (char *why) } /* The "info" command is defined as a prefix, with allow_unknown = 0. - Therefore, its own definition is called only for "info" with no args. */ + Therefore, its own definition is called only for "info" with no + args. */ static void info_command (char *arg, int from_tty) @@ -265,10 +266,10 @@ complete_command (char *arg, int from_tty) arg = ""; argpoint = strlen (arg); - /* complete_line assumes that its first argument is somewhere within, - and except for filenames at the beginning of, the word to be completed. - The following crude imitation of readline's word-breaking tries to - accomodate this. */ + /* complete_line assumes that its first argument is somewhere + within, and except for filenames at the beginning of, the word to + be completed. The following crude imitation of readline's + word-breaking tries to accomodate this. */ point = arg + argpoint; while (point > arg) { @@ -444,8 +445,8 @@ cd_command (char *dir, int from_tty) } } else - /* We are dealing with leading repetitions of "/..", for example - "/../..", which is the Mach super-root. */ + /* We are dealing with leading repetitions of "/..", for + example "/../..", which is the Mach super-root. */ p += 3; } else @@ -574,10 +575,10 @@ source_script_with_search (const char *file, int from_tty, int search_path) if (!find_and_open_script (file, search_path, &stream, &full_path)) { - /* The script wasn't found, or was otherwise inaccessible. - If the source command was invoked interactively, throw an error. - Otherwise (e.g. if it was invoked by a script), silently ignore - the error. */ + /* The script wasn't found, or was otherwise inaccessible. + If the source command was invoked interactively, throw an + error. Otherwise (e.g. if it was invoked by a script), + silently ignore the error. */ if (from_tty) perror_with_name (file); else @@ -616,7 +617,8 @@ source_command (char *args, int from_tty) int search_path = 0; *old_source_verbose = source_verbose; - old_cleanups = make_cleanup (source_verbose_cleanup, old_source_verbose); + old_cleanups = make_cleanup (source_verbose_cleanup, + old_source_verbose); /* -v causes the source command to run in verbose mode. -s causes the file to be searched in the source search path, @@ -628,7 +630,8 @@ source_command (char *args, int from_tty) { while (args[0] != '\0') { - /* Make sure leading white space does not break the comparisons. */ + /* Make sure leading white space does not break the + comparisons. */ while (isspace(args[0])) args++; @@ -717,8 +720,8 @@ shell_escape (char *arg, int from_tty) gdb_flush (gdb_stderr); } #ifdef GLOBAL_CURDIR - /* Make sure to return to the directory GDB thinks it is, in case the - shell command we just ran changed it. */ + /* Make sure to return to the directory GDB thinks it is, in case + the shell command we just ran changed it. */ chdir (current_directory); #endif #else /* Can fork. */ @@ -731,7 +734,7 @@ shell_escape (char *arg, int from_tty) if ((user_shell = (char *) getenv ("SHELL")) == NULL) user_shell = "/bin/sh"; - /* Get the name of the shell for arg0 */ + /* Get the name of the shell for arg0. */ if ((p = strrchr (user_shell, '/')) == NULL) p = user_shell; else @@ -773,7 +776,7 @@ edit_command (char *arg, int from_tty) sal = get_current_source_symtab_and_line (); } - /* bare "edit" edits file with present line. */ + /* Bare "edit" edits file with present line. */ if (arg == 0) { @@ -806,10 +809,10 @@ edit_command (char *arg, int from_tty) if (*arg1) error (_("Junk at end of line specification.")); - /* If line was specified by address, - first print exactly which line, and which file. - In this case, sal.symtab == 0 means address is outside - of all known source files, not that user failed to give a filename. */ + /* If line was specified by address, first print exactly which + line, and which file. In this case, sal.symtab == 0 means + address is outside of all known source files, not that user + failed to give a filename. */ if (*arg == '*') { struct gdbarch *gdbarch; @@ -832,8 +835,8 @@ edit_command (char *arg, int from_tty) sal.symtab->filename, sal.line); } - /* If what was given does not imply a symtab, it must be an undebuggable - symbol which means no source code. */ + /* If what was given does not imply a symtab, it must be an + undebuggable symbol which means no source code. */ if (sal.symtab == 0) error (_("No line number known for %s."), arg); @@ -875,7 +878,7 @@ list_command (char *arg, int from_tty) int linenum_beg = 0; char *p; - /* Pull in the current default source line if necessary */ + /* Pull in the current default source line if necessary. */ if (arg == 0 || arg[0] == '+' || arg[0] == '-') { set_default_source_symtab_and_line (); @@ -891,7 +894,8 @@ list_command (char *arg, int from_tty) return; } - /* "l -" lists previous ten lines, the ones before the ten just listed. */ + /* "l -" lists previous ten lines, the ones before the ten just + listed. */ if (strcmp (arg, "-") == 0) { print_source_lines (cursal.symtab, @@ -972,10 +976,11 @@ list_command (char *arg, int from_tty) if (dummy_beg && dummy_end) error (_("Two empty args do not say what lines to list.")); - /* if line was specified by address, + /* If line was specified by address, first print exactly which line, and which file. - In this case, sal.symtab == 0 means address is outside - of all known source files, not that user failed to give a filename. */ + + In this case, sal.symtab == 0 means address is outside of all + known source files, not that user failed to give a filename. */ if (*arg == '*') { struct gdbarch *gdbarch; @@ -998,9 +1003,9 @@ list_command (char *arg, int from_tty) sal.symtab->filename, sal.line); } - /* If line was not specified by just a line number, - and it does not imply a symtab, it must be an undebuggable symbol - which means no source code. */ + /* If line was not specified by just a line number, and it does not + imply a symtab, it must be an undebuggable symbol which means no + source code. */ if (!linenum_beg && sal.symtab == 0) error (_("No line number known for %s."), arg); @@ -1241,12 +1246,13 @@ show_user (char *args, int from_tty) } /* Search through names of commands and documentations for a certain - regular expression. -*/ + regular expression. */ + void apropos_command (char *searchstr, int from_tty) { - extern struct cmd_list_element *cmdlist; /*This is the main command list*/ + extern struct cmd_list_element *cmdlist; /* This is the main command + list. */ regex_t pattern; char *pattern_fastmap; char errorbuffer[512]; @@ -1270,9 +1276,9 @@ apropos_command (char *searchstr, int from_tty) } /* Print a list of files and line numbers which a user may choose from - in order to list a function which was specified ambiguously (as with - `list classname::overloadedfuncname', for example). The vector in - SALS provides the filenames and line numbers. */ + in order to list a function which was specified ambiguously (as + with `list classname::overloadedfuncname', for example). The + vector in SALS provides the filenames and line numbers. */ static void ambiguous_line_spec (struct symtabs_and_lines *sals) @@ -1421,7 +1427,7 @@ The commands below can be used to select other frames by number or address."), &cmdlist); add_cmd ("running", class_run, NULL, _("Running the program."), &cmdlist); - /* Define general commands. */ + /* Define general commands. */ add_com ("pwd", class_files, pwd_command, _("\ Print working directory. This is used for your program as well.")); @@ -1544,8 +1550,8 @@ followed by a new line. The nested commands must be entered one per line,\n\ and should be terminated by the word 'else' or `end'. If an else clause\n\ is used, the same rules apply to its nested commands as to the first ones.")); - /* If target is open when baud changes, it doesn't take effect until the - next open (I think, not sure). */ + /* If target is open when baud changes, it doesn't take effect until + the next open (I think, not sure). */ add_setshow_zinteger_cmd ("remotebaud", no_class, &baud_rate, _("\ Set baud rate for remote serial I/O."), _("\ Show baud rate for remote serial I/O."), _("\ @@ -1637,7 +1643,7 @@ Two arguments (separated by a comma) are taken as a range of memory to dump,\n\ this. Instead it adds support for the form ``(gdb) ! ls'' (i.e. the space is required). If the ``!'' command below is added the complains about no ``!'' command would be replaced by - complains about how the ``!'' command is broken :-) */ + complains about how the ``!'' command is broken :-) */ if (xdb_commands) add_com_alias ("!", "shell", class_support, 0); diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h index 596870e..082b983 100644 --- a/gdb/cli/cli-cmds.h +++ b/gdb/cli/cli-cmds.h @@ -25,19 +25,19 @@ extern struct cmd_list_element *cmdlist; extern struct cmd_list_element *infolist; -/* Chain containing all defined enable subcommands. */ +/* Chain containing all defined enable subcommands. */ extern struct cmd_list_element *enablelist; -/* Chain containing all defined disable subcommands. */ +/* Chain containing all defined disable subcommands. */ extern struct cmd_list_element *disablelist; -/* Chain containing all defined delete subcommands. */ +/* Chain containing all defined delete subcommands. */ extern struct cmd_list_element *deletelist; -/* Chain containing all defined detach subcommands. */ +/* Chain containing all defined detach subcommands. */ extern struct cmd_list_element *detachlist; @@ -45,15 +45,15 @@ extern struct cmd_list_element *detachlist; extern struct cmd_list_element *killlist; -/* Chain containing all defined toggle subcommands. */ +/* Chain containing all defined toggle subcommands. */ extern struct cmd_list_element *togglelist; -/* Chain containing all defined stop subcommands. */ +/* Chain containing all defined stop subcommands. */ extern struct cmd_list_element *stoplist; -/* Chain containing all defined "enable breakpoint" subcommands. */ +/* Chain containing all defined "enable breakpoint" subcommands. */ extern struct cmd_list_element *enablebreaklist; @@ -81,15 +81,15 @@ extern struct cmd_list_element *showhistlist; extern struct cmd_list_element *unsethistlist; -/* Chain containing all defined maintenance subcommands. */ +/* Chain containing all defined maintenance subcommands. */ extern struct cmd_list_element *maintenancelist; -/* Chain containing all defined "maintenance info" subcommands. */ +/* Chain containing all defined "maintenance info" subcommands. */ extern struct cmd_list_element *maintenanceinfolist; -/* Chain containing all defined "maintenance print" subcommands. */ +/* Chain containing all defined "maintenance print" subcommands. */ extern struct cmd_list_element *maintenanceprintlist; diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 374bd19..b2c6f4e 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -28,12 +28,12 @@ #include "cli/cli-decode.h" #ifdef TUI -#include "tui/tui.h" /* For tui_active et.al. */ +#include "tui/tui.h" /* For tui_active et al. */ #endif #include "gdb_assert.h" -/* Prototypes for local functions */ +/* Prototypes for local functions. */ static void undef_cmd_error (char *, char *); @@ -139,10 +139,10 @@ set_cmd_completer (struct cmd_list_element *cmd, It should start with ? for a command that is an abbreviation or with * for a command that most users don't need to know about. - Add this command to command list *LIST. + Add this command to command list *LIST. Returns a pointer to the added command (not necessarily the head - of *LIST). */ + of *LIST). */ struct cmd_list_element * add_cmd (char *name, enum command_class class, void (*fun) (char *, int), @@ -210,12 +210,12 @@ add_cmd (char *name, enum command_class class, void (*fun) (char *, int), } /* Deprecates a command CMD. - REPLACEMENT is the name of the command which should be used in place - of this command, or NULL if no such command exists. + REPLACEMENT is the name of the command which should be used in + place of this command, or NULL if no such command exists. This function does not check to see if command REPLACEMENT exists - since gdb may not have gotten around to adding REPLACEMENT when this - function is called. + since gdb may not have gotten around to adding REPLACEMENT when + this function is called. Returns a pointer to the deprecated command. */ @@ -236,7 +236,8 @@ struct cmd_list_element * add_alias_cmd (char *name, char *oldname, enum command_class class, int abbrev_flag, struct cmd_list_element **list) { - /* Must do this since lookup_cmd tries to side-effect its first arg */ + /* Must do this since lookup_cmd tries to side-effect its first + arg. */ char *copied_name; struct cmd_list_element *old; struct cmd_list_element *c; @@ -272,10 +273,10 @@ add_alias_cmd (char *name, char *oldname, enum command_class class, return 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 containing that list. */ +/* 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 + containing that list. */ struct cmd_list_element * add_prefix_cmd (char *name, enum command_class class, void (*fun) (char *, int), @@ -291,7 +292,7 @@ add_prefix_cmd (char *name, enum command_class class, void (*fun) (char *, int), return c; } -/* Like add_prefix_cmd but sets the abbrev_flag on the new command. */ +/* Like add_prefix_cmd but sets the abbrev_flag on the new command. */ struct cmd_list_element * add_abbrev_prefix_cmd (char *name, enum command_class class, @@ -719,7 +720,7 @@ delete_cmd (char *name, struct cmd_list_element **list, return aliases; } -/* Shorthands to the commands above. */ +/* Shorthands to the commands above. */ /* Add an element to the list of info subcommands. */ @@ -760,19 +761,20 @@ add_com_alias (char *name, char *oldname, enum command_class class, name, or their documentation. */ void -apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist, +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; - /* Walk through the commands */ + /* Walk through the commands. */ for (c=commandlist;c;c=c->next) { - returnvalue = -1; /*Needed to avoid double printing*/ + returnvalue = -1; /* Needed to avoid double printing. */ if (c->name != NULL) { - /* Try to match against the name*/ + /* Try to match against the name. */ returnvalue = re_search (regex, c->name, strlen(c->name), 0, strlen (c->name), NULL); if (returnvalue >= 0) @@ -783,37 +785,35 @@ apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist, } if (c->doc != NULL && returnvalue < 0) { - /* Try to match against documentation */ + /* Try to match against documentation. */ if (re_search(regex,c->doc,strlen(c->doc),0,strlen(c->doc),NULL) >=0) { print_help_for_command (c, prefix, 0 /* don't recurse */, stream); } } - /* 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. - */ + /* 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. - */ + passing the right prefix in. */ apropos_cmd (stream,*c->prefixlist,regex,c->prefixname); } } } /* This command really has to deal with two things: - * 1) I want documentation on *this string* (usually called by - * "help commandname"). - * 2) I want documentation on *this list* (usually called by - * giving a command that requires subcommands. Also called by saying - * just "help".) - * - * I am going to split this into two seperate comamnds, help_cmd and - * help_list. - */ + 1) I want documentation on *this string* (usually called by + "help commandname"). + + 2) I want documentation on *this list* (usually called by giving a + command that requires subcommands. Also called by saying just + "help".) + + I am going to split this into two seperate comamnds, help_cmd and + help_list. */ void help_cmd (char *command, struct ui_file *stream) @@ -857,11 +857,11 @@ help_cmd (char *command, struct ui_file *stream) return; fprintf_filtered (stream, "\n"); - /* If this is a prefix command, print it's subcommands */ + /* 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 this is a class name, print all of the commands in the class. */ if (c->func == NULL) help_list (cmdlist, "", c->class, stream); @@ -898,7 +898,8 @@ help_list (struct cmd_list_element *list, char *cmdtype, int len; char *cmdtype1, *cmdtype2; - /* If CMDTYPE is "foo ", CMDTYPE1 gets " foo" and CMDTYPE2 gets "foo sub" */ + /* If CMDTYPE is "foo ", CMDTYPE1 gets " foo" and CMDTYPE2 gets "foo sub". + */ len = strlen (cmdtype); cmdtype1 = (char *) alloca (len + 1); cmdtype1[0] = 0; @@ -941,7 +942,7 @@ Type \"help all\" for the list of all commands."); wrap_here (""); fputs_filtered ("documentation.\n", stream); fputs_filtered ("Type \"apropos word\" to search " - "for commands related to \"word\".\n", stream); + "for commands related to \"word\".\n", stream); fputs_filtered ("Command name abbreviations are allowed if unambiguous.\n", stream); } @@ -957,7 +958,8 @@ help_all (struct ui_file *stream) { if (c->abbrev_flag) continue; - /* If this is a class name, print all of the commands in the class */ + /* If this is a class name, print all of the commands in the + class. */ if (c->func == NULL) { @@ -1020,7 +1022,7 @@ print_doc_line (struct ui_file *stream, char *str) /* Print one-line help for command C. If RECURSE is non-zero, also print one-line descriptions - of all prefixed subcommands. */ + of all prefixed subcommands. */ static void print_help_for_command (struct cmd_list_element *c, char *prefix, int recurse, struct ui_file *stream) @@ -1034,7 +1036,7 @@ print_help_for_command (struct cmd_list_element *c, char *prefix, int recurse, && 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. */ + most often we won't see anything. */ help_cmd_list (*c->prefixlist, all_commands, c->prefixname, 1, stream); } @@ -1072,14 +1074,15 @@ help_cmd_list (struct cmd_list_element *list, enum command_class class, else if (c->abbrev_flag == 0 && recurse && class == class_user && c->prefixlist != NULL) /* User-defined commands may be subcommands. */ - help_cmd_list (*c->prefixlist, class, c->prefixname, recurse, stream); + help_cmd_list (*c->prefixlist, class, c->prefixname, + recurse, stream); } } /* Search the input clist for 'command'. Return the command if found (or NULL if not), and return the number of commands - found in nfound */ + found in nfound. */ static struct cmd_list_element * find_cmd (char *command, int len, struct cmd_list_element *clist, @@ -1112,13 +1115,17 @@ find_command_name_length (const char *text) /* Treating underscores as part of command words is important so that "set args_foo()" doesn't get interpreted as "set args _foo()". */ - /* Some characters are only used for TUI specific commands. However, they - are always allowed for the sake of consistency. - The XDB compatibility characters are only allowed when using the right - mode because they clash with other GDB commands - specifically '/' is - used as a suffix for print, examine and display. - Note that this is larger than the character set allowed when creating - user-defined commands. */ + /* Some characters are only used for TUI specific commands. + However, they are always allowed for the sake of consistency. + + The XDB compatibility characters are only allowed when using the + right mode because they clash with other GDB commands - + specifically '/' is used as a suffix for print, examine and + display. + + Note that this is larger than the character set allowed when + creating user-defined commands. */ + while (isalnum (*p) || *p == '-' || *p == '_' /* Characters used by TUI specific commands. */ || *p == '+' || *p == '<' || *p == '>' || *p == '$' @@ -1185,7 +1192,7 @@ lookup_cmd_1 (char **text, struct cmd_list_element *clist, return 0; /* *text and p now bracket the first command word to lookup (and - it's length is len). We copy this into a local temporary */ + it's length is len). We copy this into a local temporary. */ command = (char *) alloca (len + 1); @@ -1197,10 +1204,8 @@ lookup_cmd_1 (char **text, struct cmd_list_element *clist, nfound = 0; found = find_cmd (command, len, clist, ignore_help_classes, &nfound); - /* - ** We didn't find the command in the entered case, so lower case it - ** and search again. - */ + /* We didn't find the command in the entered case, so lower case it + and search again. */ if (!found || nfound == 0) { for (tmp = 0; tmp < len; tmp++) @@ -1225,18 +1230,18 @@ lookup_cmd_1 (char **text, struct cmd_list_element *clist, return (struct cmd_list_element *) -1; /* Ambiguous. */ } - /* We've matched something on this list. Move text pointer forward. */ + /* We've matched something on this list. Move text pointer forward. */ *text += len; if (found->cmd_pointer) { - /* We drop the alias (abbreviation) in favor of the command it is - pointing to. If the alias is deprecated, though, we need to + /* We drop the alias (abbreviation) in favor of the command it + is pointing to. If the alias is deprecated, though, we need to warn the user about it before we drop it. Note that while we are warning about the alias, we may also warn about the command itself and we will adjust the appropriate DEPRECATED_WARN_USER - flags */ + flags. */ if (found->flags & DEPRECATED_WARN_USER) deprecated_cmd_warning (&line); @@ -1257,15 +1262,15 @@ lookup_cmd_1 (char **text, struct cmd_list_element *clist, } else if (c == (struct cmd_list_element *) -1) { - /* We've gotten this far properly, but the next step - is ambiguous. We need to set the result list to the best + /* We've gotten this far properly, but the next step is + ambiguous. We need to set the result list to the best we've found (if an inferior hasn't already set it). */ if (result_list != NULL) if (!*result_list) - /* This used to say *result_list = *found->prefixlist + /* This used to say *result_list = *found->prefixlist. If that was correct, need to modify the documentation - at the top of this function to clarify what is supposed - to be going on. */ + at the top of this function to clarify what is + supposed to be going on. */ *result_list = found; return c; } @@ -1406,10 +1411,10 @@ lookup_cmd (char **line, struct cmd_list_element *list, char *cmdtype, return 0; } -/* We are here presumably because an alias or command in *TEXT is - deprecated and a warning message should be generated. This function - decodes *TEXT and potentially generates a warning message as outlined - below. +/* We are here presumably because an alias or command in *TEXT is + deprecated and a warning message should be generated. This + function decodes *TEXT and potentially generates a warning message + as outlined below. Example for 'set endian big' which has a fictitious alias 'seb'. @@ -1419,8 +1424,8 @@ lookup_cmd (char **line, struct cmd_list_element *list, char *cmdtype, If alias was used, and only the alias is deprecated: "warning: 'seb' an alias for the command 'set endian big' is deprecated." - If alias was used and command is deprecated (regardless of whether the - alias itself is deprecated: + If alias was used and command is deprecated (regardless of whether + the alias itself is deprecated: "warning: 'set endian big' (seb) is deprecated." @@ -1436,12 +1441,12 @@ deprecated_cmd_warning (char **text) struct cmd_list_element *cmd = NULL; if (!lookup_cmd_composition (*text, &alias, &prefix_cmd, &cmd)) - /* return if text doesn't evaluate to a command */ + /* Return if text doesn't evaluate to a command. */ return; if (!((alias ? (alias->flags & DEPRECATED_WARN_USER) : 0) || (cmd->flags & DEPRECATED_WARN_USER) ) ) - /* return if nothing is deprecated */ + /* Return if nothing is deprecated. */ return; printf_filtered ("Warning:"); @@ -1462,8 +1467,8 @@ deprecated_cmd_warning (char **text) printf_filtered ("' is deprecated.\n"); - /* If it is only the alias that is deprecated, we want to indicate the - new alias, otherwise we'll indicate the new command. */ + /* If it is only the alias that is deprecated, we want to indicate + the new alias, otherwise we'll indicate the new command. */ if (alias && !(cmd->flags & CMD_DEPRECATED)) { @@ -1480,7 +1485,7 @@ deprecated_cmd_warning (char **text) printf_filtered ("No alternative known.\n\n"); } - /* We've warned you, now we'll keep quiet */ + /* We've warned you, now we'll keep quiet. */ if (alias) alias->flags &= ~DEPRECATED_WARN_USER; @@ -1488,8 +1493,7 @@ deprecated_cmd_warning (char **text) } - -/* Look up the contents of LINE as a command in the command list 'cmdlist'. +/* Look up the contents of LINE as a command in the command list 'cmdlist'. Return 1 on success, 0 on failure. If LINE refers to an alias, *alias will point to that alias. @@ -1523,7 +1527,7 @@ lookup_cmd_composition (char *text, while (1) { /* Go through as many command lists as we need to - to find the command TEXT refers to. */ + to find the command TEXT refers to. */ prev_cmd = *cmd; @@ -1549,8 +1553,8 @@ lookup_cmd_composition (char *text, nfound = 0; *cmd = find_cmd (command, len, cur_list, 1, &nfound); - /* We didn't find the command in the entered case, so lower case it - and search again. + /* We didn't find the command in the entered case, so lower case + it and search again. */ if (!*cmd || nfound == 0) { @@ -1574,8 +1578,8 @@ lookup_cmd_composition (char *text, { if ((*cmd)->cmd_pointer) { - /* cmd was actually an alias, we note that an alias was used - (by assigning *alais) and we set *cmd. */ + /* cmd was actually an alias, we note that an alias was + used (by assigning *alais) and we set *cmd. */ *alias = *cmd; *cmd = (*cmd)->cmd_pointer; } @@ -1593,11 +1597,11 @@ lookup_cmd_composition (char *text, /* Helper function for SYMBOL_COMPLETION_FUNCTION. */ /* Return a vector of char pointers which point to the different - possible completions in LIST of TEXT. + possible completions in LIST of TEXT. WORD points in the same buffer as TEXT, and completions should be - returned relative to this position. For example, suppose TEXT is "foo" - and we want to complete to "foobar". If WORD is "oo", return + returned relative to this position. For example, suppose TEXT is + "foo" and we want to complete to "foobar". If WORD is "oo", return "oobar"; if WORD is "baz/foo", return "baz/foobar". */ char ** @@ -1686,7 +1690,7 @@ complete_on_cmdlist (struct cmd_list_element *list, char *text, char *word) /* Helper function for SYMBOL_COMPLETION_FUNCTION. */ /* Return a vector of char pointers which point to the different - possible completions in CMD of TEXT. + possible completions in CMD of TEXT. WORD points in the same buffer as TEXT, and completions should be returned relative to this position. For example, suppose TEXT is "foo" @@ -1755,7 +1759,7 @@ complete_on_enum (const char *enumlist[], } -/* check function pointer */ +/* Check function pointer. */ int cmd_func_p (struct cmd_list_element *cmd) { @@ -1763,7 +1767,7 @@ cmd_func_p (struct cmd_list_element *cmd) } -/* call the command function */ +/* Call the command function. */ void cmd_func (struct cmd_list_element *cmd, char *args, int from_tty) { diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index 2764d41..d63570c 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -41,9 +41,9 @@ cmd_types; /* This structure records one command'd definition. */ -/* This flag is used by the code executing commands to warn the user - the first time a deprecated command is used, see the 'flags' field in - the following struct. +/* This flag is used by the code executing commands to warn the user + the first time a deprecated command is used, see the 'flags' field + in the following struct. */ #define CMD_DEPRECATED 0x1 #define DEPRECATED_WARN_USER 0x2 @@ -94,7 +94,7 @@ struct cmd_list_element /* flags : a bitfield bit 0: (LSB) CMD_DEPRECATED, when 1 indicated that this command - is deprecated. It may be removed from gdb's command set in the + is deprecated. It may be removed from gdb's command set in the future. bit 1: DEPRECATED_WARN_USER, the user needs to be warned that @@ -109,8 +109,8 @@ struct cmd_list_element memory for replacement is malloc'ed. When a command is undeprecated or re-deprecated at runtime we don't want to risk calling free on statically allocated memory, so we check this - flag. - */ + flag. */ + int flags; /* If this command is deprecated, this is the replacement name. */ @@ -157,14 +157,16 @@ struct cmd_list_element skipped). It stops where we are supposed to stop completing (rl_point) and is '\0' terminated. - Return value is a malloc'd vector of pointers to possible completions - terminated with NULL. If there are no completions, returning a pointer - to a NULL would work but returning NULL itself is also valid. - WORD points in the same buffer as TEXT, and completions should be - returned relative to this position. For example, suppose TEXT is "foo" - and we want to complete to "foobar". If WORD is "oo", return - "oobar"; if WORD is "baz/foo", return "baz/foobar". */ - char **(*completer) (struct cmd_list_element *cmd, char *text, char *word); + Return value is a malloc'd vector of pointers to possible + completions terminated with NULL. If there are no completions, + returning a pointer to a NULL would work but returning NULL + itself is also valid. WORD points in the same buffer as TEXT, + and completions should be returned relative to this position. + For example, suppose TEXT is "foo" and we want to complete to + "foobar". If WORD is "oo", return "oobar"; if WORD is + "baz/foo", return "baz/foobar". */ + char **(*completer) (struct cmd_list_element *cmd, + char *text, char *word); /* Destruction routine for this command. If non-NULL, this is called when this command instance is destroyed. This may be @@ -175,14 +177,15 @@ struct cmd_list_element or "show"). */ cmd_types type; - /* Pointer to variable affected by "set" and "show". Doesn't matter - if type is not_set. */ + /* Pointer to variable affected by "set" and "show". Doesn't + matter if type is not_set. */ void *var; /* What kind of variable is *VAR? */ var_types var_type; - /* Pointer to NULL terminated list of enumerated values (like argv). */ + /* Pointer to NULL terminated list of enumerated values (like + argv). */ const char **enums; /* Pointer to command strings of user-defined commands */ @@ -295,7 +298,7 @@ extern char **complete_on_enum (const char *enumlist[], char *, char *); extern void help_cmd_list (struct cmd_list_element *, enum command_class, char *, int, struct ui_file *); -/* Functions that implement commands about CLI commands. */ +/* Functions that implement commands about CLI commands. */ extern void help_cmd (char *, struct ui_file *); diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 34d805c..f164574 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -149,8 +149,8 @@ bfd_openw_with_cleanup (const char *filename, const char *target, if (!bfd_set_format (obfd, bfd_object)) error (_("bfd_openw_with_cleanup: %s."), bfd_errmsg (bfd_get_error ())); } - else if (*mode == 'a') /* Append to existing file */ - { /* FIXME -- doesn't work... */ + else if (*mode == 'a') /* Append to existing file. */ + { /* FIXME -- doesn't work... */ error (_("bfd_openw does not work with append.")); } else @@ -430,7 +430,7 @@ add_dump_command (char *name, void (*func) (char *args, char *mode), c->doc = concat ("Append ", c->doc + 6, (char *)NULL); } -/* Opaque data for restore_section_callback. */ +/* Opaque data for restore_section_callback. */ struct callback_data { CORE_ADDR load_offset; CORE_ADDR load_start; @@ -455,7 +455,7 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args) gdb_byte *buf; int ret; - /* Ignore non-loadable sections, eg. from elf files. */ + /* Ignore non-loadable sections, eg. from elf files. */ if (!(bfd_get_section_flags (ibfd, isec) & SEC_LOAD)) return; @@ -463,7 +463,7 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args) if (sec_end <= data->load_start || (data->load_end > 0 && sec_start >= data->load_end)) { - /* No, no useable data in this section. */ + /* No, no useable data in this section. */ printf_filtered (_("skipping section %s...\n"), bfd_section_name (ibfd, isec)); return; @@ -474,7 +474,7 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args) transfer should start and end. */ if (sec_start < data->load_start) sec_offset = data->load_start - sec_start; - /* Size of a partial transfer: */ + /* Size of a partial transfer. */ sec_load_count -= sec_offset; if (data->load_end > 0 && sec_end > data->load_end) sec_load_count -= sec_end - data->load_end; @@ -528,10 +528,10 @@ restore_binary_file (char *filename, struct callback_data *data) error (_("Start address is greater than length of binary file %s."), filename); - /* Chop off "len" if it exceeds the requested load_end addr. */ + /* Chop off "len" if it exceeds the requested load_end addr. */ if (data->load_end != 0 && data->load_end < len) len = data->load_end; - /* Chop off "len" if the requested load_start addr skips some bytes. */ + /* Chop off "len" if the requested load_start addr skips some bytes. */ if (data->load_start > 0) len -= data->load_start; @@ -551,7 +551,7 @@ restore_binary_file (char *filename, struct callback_data *data) if (fread (buf, 1, len, file) != len) perror_with_name (filename); - /* Now write the buffer into target memory. */ + /* Now write the buffer into target memory. */ len = target_write_memory (data->load_start + data->load_offset, buf, len); if (len != 0) warning (_("restore: memory write failed (%s)."), safe_strerror (len)); @@ -573,7 +573,7 @@ restore_command (char *args, int from_tty) data.load_start = 0; data.load_end = 0; - /* Parse the input arguments. First is filename (required). */ + /* Parse the input arguments. First is filename (required). */ filename = scan_filename_with_cleanup (&args, NULL); if (args != NULL && *args != '\0') { @@ -586,18 +586,18 @@ restore_command (char *args, int from_tty) args += strlen (binary_string); args = skip_spaces (args); } - /* Parse offset (optional). */ + /* Parse offset (optional). */ if (args != NULL && *args != '\0') data.load_offset = parse_and_eval_address (scan_expression_with_cleanup (&args, NULL)); if (args != NULL && *args != '\0') { - /* Parse start address (optional). */ + /* Parse start address (optional). */ data.load_start = parse_and_eval_long (scan_expression_with_cleanup (&args, NULL)); if (args != NULL && *args != '\0') { - /* Parse end address (optional). */ + /* Parse end address (optional). */ data.load_end = parse_and_eval_long (args); if (data.load_end <= data.load_start) error (_("Start must be less than end.")); @@ -617,10 +617,10 @@ restore_command (char *args, int from_tty) } else { - /* Open the file for loading. */ + /* Open the file for loading. */ ibfd = bfd_openr_with_cleanup (filename, NULL); - /* Process the sections. */ + /* Process the sections. */ bfd_map_over_sections (ibfd, restore_section_callback, &data); } return; @@ -786,5 +786,5 @@ OFFSET will be added to the base address of the file (default zero).\n\ If START and END are given, only the file contents within that range\n\ (file relative) will be restored to target memory.")); c->completer = filename_completer; - /* FIXME: completers for other commands. */ + /* FIXME: completers for other commands. */ } diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c index fd75c7a..420e92a 100644 --- a/gdb/cli/cli-interp.c +++ b/gdb/cli/cli-interp.c @@ -30,11 +30,13 @@ struct ui_out *cli_uiout; -/* These are the ui_out and the interpreter for the console interpreter. */ +/* These are the ui_out and the interpreter for the console + interpreter. */ /* Longjmp-safe wrapper for "execute_command". */ static struct gdb_exception safe_execute_command (struct ui_out *uiout, - char *command, int from_tty); + char *command, + int from_tty); struct captured_execute_command_args { char *command; @@ -56,8 +58,9 @@ cli_interpreter_resume (void *data) /*sync_execution = 1; */ - /* gdb_setup_readline will change gdb_stdout. If the CLI was previously - writing to gdb_stdout, then set it to the new gdb_stdout afterwards. */ + /* gdb_setup_readline will change gdb_stdout. If the CLI was + previously writing to gdb_stdout, then set it to the new + gdb_stdout afterwards. */ stream = cli_out_set_stream (cli_uiout, gdb_stdout); if (stream != gdb_stdout) @@ -101,12 +104,13 @@ cli_interpreter_exec (void *data, const char *command_str) safe_execute_command. */ char *str = strcpy (alloca (strlen (command_str) + 1), command_str); - /* gdb_stdout could change between the time cli_uiout was initialized - and now. Since we're probably using a different interpreter which has - a new ui_file for gdb_stdout, use that one instead of the default. + /* gdb_stdout could change between the time cli_uiout was + initialized and now. Since we're probably using a different + interpreter which has a new ui_file for gdb_stdout, use that one + instead of the default. - It is important that it gets reset everytime, since the user could - set gdb to use a different interpreter. */ + It is important that it gets reset everytime, since the user + could set gdb to use a different interpreter. */ old_stream = cli_out_set_stream (cli_uiout, gdb_stdout); result = safe_execute_command (cli_uiout, str, 1); cli_out_set_stream (cli_uiout, old_stream); diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c index 2640c28..29b2c87 100644 --- a/gdb/cli/cli-logging.c +++ b/gdb/cli/cli-logging.c @@ -69,10 +69,10 @@ Whether logging overwrites or appends to the log file is %s.\n"), /* Value as configured by the user. */ static int logging_redirect; -/* The on-disk file in use if logging is currently active together with - redirection turned off (and therefore using tee_file_new). For active - logging with redirection the on-disk file is directly in GDB_STDOUT and - this variable is NULL. */ +/* The on-disk file in use if logging is currently active together + with redirection turned off (and therefore using tee_file_new). + For active logging with redirection the on-disk file is directly in + GDB_STDOUT and this variable is NULL. */ static struct ui_file *logging_no_redirect_file; static void @@ -90,7 +90,8 @@ set_logging_redirect (char *args, int from_tty, struct cmd_list_element *c) { gdb_assert (logging_no_redirect_file != NULL); - /* ui_out_redirect still has not been called for next gdb_stdout. */ + /* ui_out_redirect still has not been called for next + gdb_stdout. */ cleanups = make_cleanup_ui_file_delete (gdb_stdout); output = logging_no_redirect_file; @@ -120,10 +121,11 @@ set_logging_redirect (char *args, int from_tty, struct cmd_list_element *c) gdb_stdtargerr = output; logging_no_redirect_file = new_logging_no_redirect_file; - /* There is a former output pushed on the ui_out_redirect stack. We want to - replace it by OUTPUT so we must pop the former value first. We should - either do both the pop and push or to do neither of it. At least do not - try to push OUTPUT if the pop already failed. */ + /* There is a former output pushed on the ui_out_redirect stack. We + want to replace it by OUTPUT so we must pop the former value + first. We should either do both the pop and push or to do + neither of it. At least do not try to push OUTPUT if the pop + already failed. */ if (ui_out_redirect (uiout, NULL) < 0 || ui_out_redirect (uiout, output) < 0) diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index 9056773..cb54300 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -36,7 +36,7 @@ #include "python/python.h" -/* Prototypes for local functions */ +/* Prototypes for local functions. */ static enum command_control_type recurse_read_control_structure (char * (*read_next_line_func) (void), @@ -65,7 +65,8 @@ struct user_args { struct user_args *next; /* It is necessary to store a malloced copy of the command line to - ensure that the arguments are not overwritten before they are used. */ + ensure that the arguments are not overwritten before they are + used. */ char *command; struct { @@ -164,7 +165,8 @@ print_command_lines (struct ui_out *uiout, struct command_line *cmd, continue; } - /* loop_break to break out of a while loop, print it and continue. */ + /* loop_break to break out of a while loop, print it and + continue. */ if (list->control_type == break_control) { ui_out_field_string (uiout, NULL, "loop_break"); @@ -173,13 +175,14 @@ print_command_lines (struct ui_out *uiout, struct command_line *cmd, continue; } - /* A while command. Recursively print its subcommands and continue. */ + /* A while command. Recursively print its subcommands and + continue. */ if (list->control_type == while_control || list->control_type == while_stepping_control) { - /* For while-stepping, the line includes the 'while-stepping' token. - See comment in process_next_line for explanation. Here, - take care not print 'while-stepping' twice. */ + /* For while-stepping, the line includes the 'while-stepping' + token. See comment in process_next_line for explanation. + Here, take care not print 'while-stepping' twice. */ if (list->control_type == while_control) ui_out_field_fmt (uiout, NULL, "while %s", list->line); else @@ -194,12 +197,13 @@ print_command_lines (struct ui_out *uiout, struct command_line *cmd, continue; } - /* An if command. Recursively print both arms before continueing. */ + /* An if command. Recursively print both arms before + continueing. */ if (list->control_type == if_control) { ui_out_field_fmt (uiout, NULL, "if %s", list->line); ui_out_text (uiout, "\n"); - /* The true arm. */ + /* The true arm. */ print_command_lines (uiout, list->body_list[0], depth + 1); /* Show the false arm if it exists. */ @@ -220,7 +224,8 @@ print_command_lines (struct ui_out *uiout, struct command_line *cmd, continue; } - /* A commands command. Print the breakpoint commands and continue. */ + /* A commands command. Print the breakpoint commands and + continue. */ if (list->control_type == commands_control) { if (*(list->line)) @@ -251,7 +256,7 @@ print_command_lines (struct ui_out *uiout, struct command_line *cmd, continue; } - /* ignore illegal command type and try next */ + /* Ignore illegal command type and try next. */ list = list->next; } /* while (list) */ } @@ -263,7 +268,7 @@ clear_hook_in_cleanup (void *data) { struct cmd_list_element *c = data; - c->hook_in = 0; /* Allow hook to work again once it is complete */ + c->hook_in = 0; /* Allow hook to work again once it is complete. */ } void @@ -272,7 +277,7 @@ execute_cmd_pre_hook (struct cmd_list_element *c) if ((c->hook_pre) && (!c->hook_in)) { struct cleanup *cleanups = make_cleanup (clear_hook_in_cleanup, c); - c->hook_in = 1; /* Prevent recursive hooking */ + c->hook_in = 1; /* Prevent recursive hooking. */ execute_user_command (c->hook_pre, (char *) 0); do_cleanups (cleanups); } @@ -285,7 +290,7 @@ execute_cmd_post_hook (struct cmd_list_element *c) { struct cleanup *cleanups = make_cleanup (clear_hook_in_cleanup, c); - c->hook_in = 1; /* Prevent recursive hooking */ + c->hook_in = 1; /* Prevent recursive hooking. */ execute_user_command (c->hook_post, (char *) 0); do_cleanups (cleanups); } @@ -348,8 +353,8 @@ execute_user_command (struct cmd_list_element *c, char *args) do_cleanups (old_chain); } -/* This function is called every time GDB prints a prompt. - It ensures that errors and the like to not confuse the command tracing. */ +/* This function is called every time GDB prints a prompt. It ensures + that errors and the like do not confuse the command tracing. */ void reset_command_nest_depth (void) @@ -522,8 +527,8 @@ execute_control_command (struct command_line *cmd) val_mark = value_mark (); val = evaluate_expression (expr); - /* Choose which arm to take commands from based on the value of the - conditional expression. */ + /* Choose which arm to take commands from based on the value + of the conditional expression. */ if (value_true (val)) current = *cmd->body_list; else if (cmd->body_count == 2) @@ -549,8 +554,8 @@ execute_control_command (struct command_line *cmd) } case commands_control: { - /* Breakpoint commands list, record the commands in the breakpoint's - command list and return. */ + /* Breakpoint commands list, record the commands in the + breakpoint's command list and return. */ new_line = insert_args (cmd->line); if (!new_line) break; @@ -576,7 +581,7 @@ execute_control_command (struct command_line *cmd) } /* Like execute_control_command, but first set - suppress_next_print_command_trace. */ + suppress_next_print_command_trace. */ enum command_control_type execute_control_command_untraced (struct command_line *cmd) @@ -721,8 +726,8 @@ setup_user_args (char *p) return old_chain; } -/* Given character string P, return a point to the first argument ($arg), - or NULL if P contains no arguments. */ +/* Given character string P, return a point to the first argument + ($arg), or NULL if P contains no arguments. */ static char * locate_arg (char *p) @@ -738,7 +743,8 @@ locate_arg (char *p) } /* Insert the user defined arguments stored in user_arg into the $arg - arguments found in line, with the updated copy being placed into nline. */ + arguments found in line, with the updated copy being placed into + nline. */ static char * insert_args (char *line) @@ -751,7 +757,8 @@ insert_args (char *line) if (user_args == NULL) return xstrdup (line); - /* First we need to know how much memory to allocate for the new line. */ + /* First we need to know how much memory to allocate for the new + line. */ save_line = line; len = 0; while ((p = locate_arg (line))) @@ -883,11 +890,12 @@ read_next_line (void) return command_line_input (prompt_ptr, instream == stdin, "commands"); } -/* Process one input line. If the command is an "end", - return such an indication to the caller. If PARSE_COMMANDS is true, - strip leading whitespace (trailing whitespace is always stripped) - in the line, attempt to recognize GDB control commands, and also - return an indication if the command is an "else" or a nop. +/* Process one input line. If the command is an "end", return such an + indication to the caller. If PARSE_COMMANDS is true, strip leading + whitespace (trailing whitespace is always stripped) in the line, + attempt to recognize GDB control commands, and also return an + indication if the command is an "else" or a nop. + Otherwise, only "end" is recognized. */ static enum misc_command_type @@ -912,21 +920,21 @@ process_next_line (char *p, struct command_line **command, int parse_commands, while (p_start < p_end && (*p_start == ' ' || *p_start == '\t')) p_start++; - /* 'end' is always recognized, regardless of parse_commands value. + /* 'end' is always recognized, regardless of parse_commands value. We also permit whitespace before end and after. */ if (p_end - p_start == 3 && !strncmp (p_start, "end", 3)) return end_command; if (parse_commands) { - /* If commands are parsed, we skip initial spaces. Otherwise, + /* If commands are parsed, we skip initial spaces. Otherwise, which is the case for Python commands and documentation (see the 'document' command), spaces are preserved. */ p = p_start; /* Blanks and comments don't really do anything, but we need to - distinguish them from else, end and other commands which can be - executed. */ + distinguish them from else, end and other commands which can + be executed. */ if (p_end == p || p[0] == '#') return nop_command; @@ -934,8 +942,8 @@ process_next_line (char *p, struct command_line **command, int parse_commands, if (p_end - p == 4 && !strncmp (p, "else", 4)) return else_command; - /* Check for while, if, break, continue, etc and build a new command - line structure for them. */ + /* Check for while, if, break, continue, etc and build a new + command line structure for them. */ if ((p_end - p >= 14 && !strncmp (p, "while-stepping", 14)) || (p_end - p >= 8 && !strncmp (p, "stepping", 8)) || (p_end - p >= 2 && !strncmp (p, "ws", 2))) @@ -945,11 +953,12 @@ process_next_line (char *p, struct command_line **command, int parse_commands, include 'while-stepping'. For 'ws' alias, the command will have 'ws', not expanded - to 'while-stepping'. This is intentional -- we don't + to 'while-stepping'. This is intentional -- we don't really want frontend to send a command list with 'ws', - and next break-info returning command line with 'while-stepping'. - This should work, but might cause the breakpoint to be marked as - changed while it's actually not. */ + and next break-info returning command line with + 'while-stepping'. This should work, but might cause the + breakpoint to be marked as changed while it's actually + not. */ *command = build_command_line (while_stepping_control, p); } else if (p_end - p > 5 && !strncmp (p, "while", 5)) @@ -1040,11 +1049,9 @@ process_next_line (char *p, struct command_line **command, int parse_commands, return ok_command; } -/* Recursively read in the control structures and create a command_line - structure from them. Use read_next_line_func to obtain lines of - the command. - -*/ +/* Recursively read in the control structures and create a + command_line structure from them. Use read_next_line_func to + obtain lines of the command. */ static enum command_control_type recurse_read_control_structure (char * (*read_next_line_func) (void), @@ -1178,7 +1185,7 @@ read_command_lines (char *prompt_arg, int from_tty, int parse_commands, { if (deprecated_readline_begin_hook) { - /* Note - intentional to merge messages with no newline */ + /* Note - intentional to merge messages with no newline. */ (*deprecated_readline_begin_hook) ("%s %s\n", prompt_arg, END_MESSAGE); } else @@ -1482,7 +1489,7 @@ define_command (char *comname, int from_tty) comname = xstrdup (comname); /* If the rest of the commands will be case insensitive, this one - should behave in the same manner. */ + should behave in the same manner. */ for (tem = comname; *tem; tem++) if (isupper (*tem)) *tem = tolower (*tem); @@ -1506,14 +1513,14 @@ define_command (char *comname, int from_tty) { case CMD_PRE_HOOK: hookc->hook_pre = newc; /* Target gets hooked. */ - newc->hookee_pre = hookc; /* We are marked as hooking target cmd. */ + newc->hookee_pre = hookc; /* We are marked as hooking target cmd. */ break; case CMD_POST_HOOK: hookc->hook_post = newc; /* Target gets hooked. */ - newc->hookee_post = hookc; /* We are marked as hooking target cmd. */ + newc->hookee_post = hookc; /* We are marked as hooking target cmd. */ break; default: - /* Should never come here as hookc would be 0. */ + /* Should never come here as hookc would be 0. */ internal_error (__FILE__, __LINE__, _("bad switch")); } } @@ -1592,7 +1599,7 @@ wrapped_read_command_file (struct ui_out *uiout, void *data) read_command_file (args->stream); } -/* Used to implement source_command */ +/* Used to implement source_command. */ void script_from_file (FILE *stream, const char *file) @@ -1610,8 +1617,8 @@ script_from_file (FILE *stream, const char *file) make_cleanup (source_cleanup_lines, &old_lines); source_line_number = 0; source_file_name = file; - /* This will get set every time we read a line. So it won't stay "" for - long. */ + /* This will get set every time we read a line. So it won't stay "" + for long. */ error_pre_print = ""; { diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 37f7918..c54ae8f 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -29,7 +29,7 @@ #include "cli/cli-cmds.h" #include "cli/cli-setshow.h" -/* Prototypes for local functions */ +/* Prototypes for local functions. */ static int parse_binary_operation (char *); @@ -58,7 +58,7 @@ parse_auto_binary_operation (const char *arg) return AUTO_BOOLEAN_AUTO; } error (_("\"on\", \"off\" or \"auto\" expected.")); - return AUTO_BOOLEAN_AUTO; /* pacify GCC */ + return AUTO_BOOLEAN_AUTO; /* Pacify GCC. */ } static int @@ -117,10 +117,10 @@ deprecated_show_value_hack (struct ui_file *ignore_file, } } -/* Do a "set" or "show" command. ARG is NULL if no argument, or the text - of the argument, and FROM_TTY is nonzero if this command is being entered - directly by the user (i.e. these are just like any other - command). C is the command list element for the command. */ +/* Do a "set" or "show" command. ARG is NULL if no argument, or the + text of the argument, and FROM_TTY is nonzero if this command is + being entered directly by the user (i.e. these are just like any + other command). C is the command list element for the command. */ void do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) @@ -249,7 +249,8 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) const char *match = NULL; char *p; - /* if no argument was supplied, print an informative error message */ + /* If no argument was supplied, print an informative error + message. */ if (arg == NULL) { char *msg; @@ -268,7 +269,8 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) strcat (msg, ", "); strcat (msg, c->enums[i]); } - error (_("Requires an argument. Valid arguments are %s."), msg); + error (_("Requires an argument. Valid arguments are %s."), + msg); } p = strchr (arg, ' '); @@ -286,7 +288,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) { match = c->enums[i]; nmatches = 1; - break; /* exact match. */ + break; /* Exact match. */ } else { diff --git a/gdb/cli/cli-setshow.h b/gdb/cli/cli-setshow.h index b168ff8..3c12dbf 100644 --- a/gdb/cli/cli-setshow.h +++ b/gdb/cli/cli-setshow.h @@ -22,10 +22,10 @@ struct cmd_list_element; /* Exported to cli/cli-cmds.c and gdb/top.c */ -/* Do a "set" or "show" command. ARG is NULL if no argument, or the text - of the argument, and FROM_TTY is nonzero if this command is being entered - directly by the user (i.e. these are just like any other - command). C is the command list element for the command. */ +/* Do a "set" or "show" command. ARG is NULL if no argument, or the + text of the argument, and FROM_TTY is nonzero if this command is + being entered directly by the user (i.e. these are just like any + other command). C is the command list element for the command. */ extern void do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c); diff --git a/gdb/command.h b/gdb/command.h index f53dc3e..2dec9a3 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -20,7 +20,7 @@ #define COMMAND_H 1 /* Command classes are top-level categories into which commands are broken - down for "help" purposes. + down for "help" purposes. Notes on classes: class_alias is for alias commands which are not abbreviations of the original command. class-pseudo is for commands which are not really commands nor help topics ("stop"). */ @@ -60,7 +60,7 @@ typedef enum var_types "auto. *VAR is an ``enum auto_boolean''. NOTE: In general a custom show command will need to be implemented - one that for "auto" prints both the "auto" and the current auto-selected - value. */ + value. */ var_auto_boolean, /* Unsigned Integer. *VAR is an unsigned int. The user can type 0 @@ -146,7 +146,7 @@ extern void set_cmd_completer (struct cmd_list_element *cmd, extern int cmd_cfunc_eq (struct cmd_list_element *cmd, void (*cfunc) (char *args, int from_tty)); -/* Each command object has a local context attached to it. . */ +/* Each command object has a local context attached to it. */ extern void set_cmd_context (struct cmd_list_element *cmd, void *context); extern void *get_cmd_context (struct cmd_list_element *cmd); @@ -342,7 +342,7 @@ extern void add_setshow_zuinteger_cmd (char *name, extern void cmd_show_list (struct cmd_list_element *, int, char *); /* Used everywhere whenever at least one parameter is required and - none is specified. */ + none is specified. */ extern void error_no_arg (char *) ATTRIBUTE_NORETURN; |