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.
This commit is contained in:
Michael Snyder 2010-12-29 02:11:04 +00:00
parent 3458c4521e
commit ebcd3b23ee
12 changed files with 321 additions and 279 deletions

View file

@ -1,3 +1,17 @@
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> 2010-12-28 Michael Snyder <msnyder@vmware.com>
* event-loop.c: Comment clean-up. * event-loop.c: Comment clean-up.

View file

@ -24,9 +24,9 @@
#include "readline/readline.h" #include "readline/readline.h"
#include "readline/tilde.h" #include "readline/tilde.h"
#include "completer.h" #include "completer.h"
#include "target.h" /* For baud_rate, remote_debug and remote_timeout */ #include "target.h" /* For baud_rate, remote_debug and remote_timeout. */
#include "gdb_wait.h" /* For shell escape implementation */ #include "gdb_wait.h" /* For shell escape implementation. */
#include "gdb_regex.h" /* Used by apropos_command */ #include "gdb_regex.h" /* Used by apropos_command. */
#include "gdb_string.h" #include "gdb_string.h"
#include "gdb_vfork.h" #include "gdb_vfork.h"
#include "linespec.h" #include "linespec.h"
@ -34,7 +34,7 @@
#include "frame.h" #include "frame.h"
#include "value.h" #include "value.h"
#include "language.h" #include "language.h"
#include "filenames.h" /* for DOSish file names */ #include "filenames.h" /* For DOSish file names. */
#include "objfiles.h" #include "objfiles.h"
#include "source.h" #include "source.h"
#include "disasm.h" #include "disasm.h"
@ -215,7 +215,8 @@ error_no_arg (char *why)
} }
/* The "info" command is defined as a prefix, with allow_unknown = 0. /* 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 static void
info_command (char *arg, int from_tty) info_command (char *arg, int from_tty)
@ -265,10 +266,10 @@ complete_command (char *arg, int from_tty)
arg = ""; arg = "";
argpoint = strlen (arg); argpoint = strlen (arg);
/* complete_line assumes that its first argument is somewhere within, /* complete_line assumes that its first argument is somewhere
and except for filenames at the beginning of, the word to be completed. within, and except for filenames at the beginning of, the word to
The following crude imitation of readline's word-breaking tries to be completed. The following crude imitation of readline's
accomodate this. */ word-breaking tries to accomodate this. */
point = arg + argpoint; point = arg + argpoint;
while (point > arg) while (point > arg)
{ {
@ -444,8 +445,8 @@ cd_command (char *dir, int from_tty)
} }
} }
else else
/* We are dealing with leading repetitions of "/..", for example /* We are dealing with leading repetitions of "/..", for
"/../..", which is the Mach super-root. */ example "/../..", which is the Mach super-root. */
p += 3; p += 3;
} }
else else
@ -575,9 +576,9 @@ source_script_with_search (const char *file, int from_tty, int search_path)
if (!find_and_open_script (file, search_path, &stream, &full_path)) if (!find_and_open_script (file, search_path, &stream, &full_path))
{ {
/* The script wasn't found, or was otherwise inaccessible. /* The script wasn't found, or was otherwise inaccessible.
If the source command was invoked interactively, throw an error. If the source command was invoked interactively, throw an
Otherwise (e.g. if it was invoked by a script), silently ignore error. Otherwise (e.g. if it was invoked by a script),
the error. */ silently ignore the error. */
if (from_tty) if (from_tty)
perror_with_name (file); perror_with_name (file);
else else
@ -616,7 +617,8 @@ source_command (char *args, int from_tty)
int search_path = 0; int search_path = 0;
*old_source_verbose = source_verbose; *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. /* -v causes the source command to run in verbose mode.
-s causes the file to be searched in the source search path, -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') 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])) while (isspace(args[0]))
args++; args++;
@ -717,8 +720,8 @@ shell_escape (char *arg, int from_tty)
gdb_flush (gdb_stderr); gdb_flush (gdb_stderr);
} }
#ifdef GLOBAL_CURDIR #ifdef GLOBAL_CURDIR
/* Make sure to return to the directory GDB thinks it is, in case the /* Make sure to return to the directory GDB thinks it is, in case
shell command we just ran changed it. */ the shell command we just ran changed it. */
chdir (current_directory); chdir (current_directory);
#endif #endif
#else /* Can fork. */ #else /* Can fork. */
@ -731,7 +734,7 @@ shell_escape (char *arg, int from_tty)
if ((user_shell = (char *) getenv ("SHELL")) == NULL) if ((user_shell = (char *) getenv ("SHELL")) == NULL)
user_shell = "/bin/sh"; 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) if ((p = strrchr (user_shell, '/')) == NULL)
p = user_shell; p = user_shell;
else else
@ -773,7 +776,7 @@ edit_command (char *arg, int from_tty)
sal = get_current_source_symtab_and_line (); sal = get_current_source_symtab_and_line ();
} }
/* bare "edit" edits file with present line. */ /* Bare "edit" edits file with present line. */
if (arg == 0) if (arg == 0)
{ {
@ -806,10 +809,10 @@ edit_command (char *arg, int from_tty)
if (*arg1) if (*arg1)
error (_("Junk at end of line specification.")); error (_("Junk at end of line specification."));
/* If line was specified by address, /* If line was specified by address, first print exactly which
first print exactly which line, and which file. line, and which file. In this case, sal.symtab == 0 means
In this case, sal.symtab == 0 means address is outside address is outside of all known source files, not that user
of all known source files, not that user failed to give a filename. */ failed to give a filename. */
if (*arg == '*') if (*arg == '*')
{ {
struct gdbarch *gdbarch; struct gdbarch *gdbarch;
@ -832,8 +835,8 @@ edit_command (char *arg, int from_tty)
sal.symtab->filename, sal.line); sal.symtab->filename, sal.line);
} }
/* If what was given does not imply a symtab, it must be an undebuggable /* If what was given does not imply a symtab, it must be an
symbol which means no source code. */ undebuggable symbol which means no source code. */
if (sal.symtab == 0) if (sal.symtab == 0)
error (_("No line number known for %s."), arg); error (_("No line number known for %s."), arg);
@ -875,7 +878,7 @@ list_command (char *arg, int from_tty)
int linenum_beg = 0; int linenum_beg = 0;
char *p; 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] == '-') if (arg == 0 || arg[0] == '+' || arg[0] == '-')
{ {
set_default_source_symtab_and_line (); set_default_source_symtab_and_line ();
@ -891,7 +894,8 @@ list_command (char *arg, int from_tty)
return; 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) if (strcmp (arg, "-") == 0)
{ {
print_source_lines (cursal.symtab, print_source_lines (cursal.symtab,
@ -972,10 +976,11 @@ list_command (char *arg, int from_tty)
if (dummy_beg && dummy_end) if (dummy_beg && dummy_end)
error (_("Two empty args do not say what lines to list.")); 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. 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 == '*') if (*arg == '*')
{ {
struct gdbarch *gdbarch; struct gdbarch *gdbarch;
@ -998,9 +1003,9 @@ list_command (char *arg, int from_tty)
sal.symtab->filename, sal.line); sal.symtab->filename, sal.line);
} }
/* If line was not specified by just a line number, /* If line was not specified by just a line number, and it does not
and it does not imply a symtab, it must be an undebuggable symbol imply a symtab, it must be an undebuggable symbol which means no
which means no source code. */ source code. */
if (!linenum_beg && sal.symtab == 0) if (!linenum_beg && sal.symtab == 0)
error (_("No line number known for %s."), arg); 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 /* Search through names of commands and documentations for a certain
regular expression. regular expression. */
*/
void void
apropos_command (char *searchstr, int from_tty) 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; regex_t pattern;
char *pattern_fastmap; char *pattern_fastmap;
char errorbuffer[512]; 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 /* 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 in order to list a function which was specified ambiguously (as
`list classname::overloadedfuncname', for example). The vector in with `list classname::overloadedfuncname', for example). The
SALS provides the filenames and line numbers. */ vector in SALS provides the filenames and line numbers. */
static void static void
ambiguous_line_spec (struct symtabs_and_lines *sals) ambiguous_line_spec (struct symtabs_and_lines *sals)
@ -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\ 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.")); 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 /* If target is open when baud changes, it doesn't take effect until
next open (I think, not sure). */ the next open (I think, not sure). */
add_setshow_zinteger_cmd ("remotebaud", no_class, &baud_rate, _("\ add_setshow_zinteger_cmd ("remotebaud", no_class, &baud_rate, _("\
Set baud rate for remote serial I/O."), _("\ Set baud rate for remote serial I/O."), _("\
Show baud rate for remote serial I/O."), _("\ Show baud rate for remote serial I/O."), _("\

View file

@ -28,12 +28,12 @@
#include "cli/cli-decode.h" #include "cli/cli-decode.h"
#ifdef TUI #ifdef TUI
#include "tui/tui.h" /* For tui_active et.al. */ #include "tui/tui.h" /* For tui_active et al. */
#endif #endif
#include "gdb_assert.h" #include "gdb_assert.h"
/* Prototypes for local functions */ /* Prototypes for local functions. */
static void undef_cmd_error (char *, char *); static void undef_cmd_error (char *, char *);
@ -210,12 +210,12 @@ add_cmd (char *name, enum command_class class, void (*fun) (char *, int),
} }
/* Deprecates a command CMD. /* Deprecates a command CMD.
REPLACEMENT is the name of the command which should be used in place REPLACEMENT is the name of the command which should be used in
of this command, or NULL if no such command exists. place of this command, or NULL if no such command exists.
This function does not check to see if command REPLACEMENT exists This function does not check to see if command REPLACEMENT exists
since gdb may not have gotten around to adding REPLACEMENT when this since gdb may not have gotten around to adding REPLACEMENT when
function is called. this function is called.
Returns a pointer to the deprecated command. */ 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, add_alias_cmd (char *name, char *oldname, enum command_class class,
int abbrev_flag, struct cmd_list_element **list) 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; char *copied_name;
struct cmd_list_element *old; struct cmd_list_element *old;
struct cmd_list_element *c; struct cmd_list_element *c;
@ -272,10 +273,10 @@ add_alias_cmd (char *name, char *oldname, enum command_class class,
return c; return c;
} }
/* Like add_cmd but adds an element for a command prefix: /* Like add_cmd but adds an element for a command prefix: a name that
a name that should be followed by a subcommand to be looked up should be followed by a subcommand to be looked up in another
in another command list. PREFIXLIST should be the address command list. PREFIXLIST should be the address of the variable
of the variable containing that list. */ containing that list. */
struct cmd_list_element * struct cmd_list_element *
add_prefix_cmd (char *name, enum command_class class, void (*fun) (char *, int), add_prefix_cmd (char *name, enum command_class class, void (*fun) (char *, int),
@ -760,19 +761,20 @@ add_com_alias (char *name, char *oldname, enum command_class class,
name, or their documentation. name, or their documentation.
*/ */
void 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 re_pattern_buffer *regex, char *prefix)
{ {
struct cmd_list_element *c; struct cmd_list_element *c;
int returnvalue; int returnvalue;
/* Walk through the commands */ /* Walk through the commands. */
for (c=commandlist;c;c=c->next) 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) 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), returnvalue = re_search (regex, c->name, strlen(c->name),
0, strlen (c->name), NULL); 0, strlen (c->name), NULL);
if (returnvalue >= 0) if (returnvalue >= 0)
@ -783,37 +785,35 @@ apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
} }
if (c->doc != NULL && returnvalue < 0) 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) if (re_search(regex,c->doc,strlen(c->doc),0,strlen(c->doc),NULL) >=0)
{ {
print_help_for_command (c, prefix, print_help_for_command (c, prefix,
0 /* don't recurse */, stream); 0 /* don't recurse */, stream);
} }
} }
/* Check if this command has subcommands and is not an abbreviation. /* Check if this command has subcommands and is not an
We skip listing subcommands of abbreviations in order to avoid abbreviation. We skip listing subcommands of abbreviations
duplicates in the output. in order to avoid duplicates in the output. */
*/
if (c->prefixlist != NULL && !c->abbrev_flag) if (c->prefixlist != NULL && !c->abbrev_flag)
{ {
/* Recursively call ourselves on the subcommand list, /* 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); apropos_cmd (stream,*c->prefixlist,regex,c->prefixname);
} }
} }
} }
/* This command really has to deal with two things: /* This command really has to deal with two things:
* 1) I want documentation on *this string* (usually called by 1) I want documentation on *this string* (usually called by
* "help commandname"). "help commandname").
* 2) I want documentation on *this list* (usually called by
* giving a command that requires subcommands. Also called by saying 2) I want documentation on *this list* (usually called by giving a
* just "help".) 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. I am going to split this into two seperate comamnds, help_cmd and
*/ help_list. */
void void
help_cmd (char *command, struct ui_file *stream) help_cmd (char *command, struct ui_file *stream)
@ -857,11 +857,11 @@ help_cmd (char *command, struct ui_file *stream)
return; return;
fprintf_filtered (stream, "\n"); 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) if (c->prefixlist)
help_list (*c->prefixlist, c->prefixname, all_commands, stream); 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) if (c->func == NULL)
help_list (cmdlist, "", c->class, stream); help_list (cmdlist, "", c->class, stream);
@ -898,7 +898,8 @@ help_list (struct cmd_list_element *list, char *cmdtype,
int len; int len;
char *cmdtype1, *cmdtype2; 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); len = strlen (cmdtype);
cmdtype1 = (char *) alloca (len + 1); cmdtype1 = (char *) alloca (len + 1);
cmdtype1[0] = 0; cmdtype1[0] = 0;
@ -957,7 +958,8 @@ help_all (struct ui_file *stream)
{ {
if (c->abbrev_flag) if (c->abbrev_flag)
continue; 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) if (c->func == NULL)
{ {
@ -1072,14 +1074,15 @@ help_cmd_list (struct cmd_list_element *list, enum command_class class,
else if (c->abbrev_flag == 0 && recurse else if (c->abbrev_flag == 0 && recurse
&& class == class_user && c->prefixlist != NULL) && class == class_user && c->prefixlist != NULL)
/* User-defined commands may be subcommands. */ /* 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 /* Search the input clist for 'command'. Return the command if
found (or NULL if not), and return the number of commands found (or NULL if not), and return the number of commands
found in nfound */ found in nfound. */
static struct cmd_list_element * static struct cmd_list_element *
find_cmd (char *command, int len, struct cmd_list_element *clist, 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 /* Treating underscores as part of command words is important
so that "set args_foo()" doesn't get interpreted as so that "set args_foo()" doesn't get interpreted as
"set args _foo()". */ "set args _foo()". */
/* Some characters are only used for TUI specific commands. However, they /* Some characters are only used for TUI specific commands.
are always allowed for the sake of consistency. 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 The XDB compatibility characters are only allowed when using the
used as a suffix for print, examine and display. right mode because they clash with other GDB commands -
Note that this is larger than the character set allowed when creating specifically '/' is used as a suffix for print, examine and
user-defined commands. */ display.
Note that this is larger than the character set allowed when
creating user-defined commands. */
while (isalnum (*p) || *p == '-' || *p == '_' while (isalnum (*p) || *p == '-' || *p == '_'
/* Characters used by TUI specific commands. */ /* Characters used by TUI specific commands. */
|| *p == '+' || *p == '<' || *p == '>' || *p == '$' || *p == '+' || *p == '<' || *p == '>' || *p == '$'
@ -1185,7 +1192,7 @@ lookup_cmd_1 (char **text, struct cmd_list_element *clist,
return 0; return 0;
/* *text and p now bracket the first command word to lookup (and /* *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); command = (char *) alloca (len + 1);
@ -1197,10 +1204,8 @@ lookup_cmd_1 (char **text, struct cmd_list_element *clist,
nfound = 0; nfound = 0;
found = find_cmd (command, len, clist, ignore_help_classes, &nfound); found = find_cmd (command, len, clist, ignore_help_classes, &nfound);
/* /* We didn't find the command in the entered case, so lower case it
** We didn't find the command in the entered case, so lower case it and search again. */
** and search again.
*/
if (!found || nfound == 0) if (!found || nfound == 0)
{ {
for (tmp = 0; tmp < len; tmp++) for (tmp = 0; tmp < len; tmp++)
@ -1231,12 +1236,12 @@ lookup_cmd_1 (char **text, struct cmd_list_element *clist,
if (found->cmd_pointer) if (found->cmd_pointer)
{ {
/* We drop the alias (abbreviation) in favor of the command it is /* We drop the alias (abbreviation) in favor of the command it
pointing to. If the alias is deprecated, though, we need to 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 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 are warning about the alias, we may also warn about the command
itself and we will adjust the appropriate DEPRECATED_WARN_USER itself and we will adjust the appropriate DEPRECATED_WARN_USER
flags */ flags. */
if (found->flags & DEPRECATED_WARN_USER) if (found->flags & DEPRECATED_WARN_USER)
deprecated_cmd_warning (&line); 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) else if (c == (struct cmd_list_element *) -1)
{ {
/* We've gotten this far properly, but the next step /* We've gotten this far properly, but the next step is
is ambiguous. We need to set the result list to the best ambiguous. We need to set the result list to the best
we've found (if an inferior hasn't already set it). */ we've found (if an inferior hasn't already set it). */
if (result_list != NULL) if (result_list != NULL)
if (!*result_list) 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 If that was correct, need to modify the documentation
at the top of this function to clarify what is supposed at the top of this function to clarify what is
to be going on. */ supposed to be going on. */
*result_list = found; *result_list = found;
return c; return c;
} }
@ -1407,9 +1412,9 @@ lookup_cmd (char **line, struct cmd_list_element *list, char *cmdtype,
} }
/* We are here presumably because an alias or command in *TEXT is /* We are here presumably because an alias or command in *TEXT is
deprecated and a warning message should be generated. This function deprecated and a warning message should be generated. This
decodes *TEXT and potentially generates a warning message as outlined function decodes *TEXT and potentially generates a warning message
below. as outlined below.
Example for 'set endian big' which has a fictitious alias 'seb'. 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: If alias was used, and only the alias is deprecated:
"warning: 'seb' an alias for the command 'set endian big' 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 If alias was used and command is deprecated (regardless of whether
alias itself is deprecated: the alias itself is deprecated:
"warning: 'set endian big' (seb) is deprecated." "warning: 'set endian big' (seb) is deprecated."
@ -1436,12 +1441,12 @@ deprecated_cmd_warning (char **text)
struct cmd_list_element *cmd = NULL; struct cmd_list_element *cmd = NULL;
if (!lookup_cmd_composition (*text, &alias, &prefix_cmd, &cmd)) 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; return;
if (!((alias ? (alias->flags & DEPRECATED_WARN_USER) : 0) if (!((alias ? (alias->flags & DEPRECATED_WARN_USER) : 0)
|| (cmd->flags & DEPRECATED_WARN_USER) ) ) || (cmd->flags & DEPRECATED_WARN_USER) ) )
/* return if nothing is deprecated */ /* Return if nothing is deprecated. */
return; return;
printf_filtered ("Warning:"); printf_filtered ("Warning:");
@ -1462,8 +1467,8 @@ deprecated_cmd_warning (char **text)
printf_filtered ("' is deprecated.\n"); printf_filtered ("' is deprecated.\n");
/* If it is only the alias that is deprecated, we want to indicate the /* If it is only the alias that is deprecated, we want to indicate
new alias, otherwise we'll indicate the new command. */ the new alias, otherwise we'll indicate the new command. */
if (alias && !(cmd->flags & CMD_DEPRECATED)) if (alias && !(cmd->flags & CMD_DEPRECATED))
{ {
@ -1480,7 +1485,7 @@ deprecated_cmd_warning (char **text)
printf_filtered ("No alternative known.\n\n"); 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) if (alias)
alias->flags &= ~DEPRECATED_WARN_USER; alias->flags &= ~DEPRECATED_WARN_USER;
@ -1488,7 +1493,6 @@ 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. Return 1 on success, 0 on failure.
@ -1549,8 +1553,8 @@ lookup_cmd_composition (char *text,
nfound = 0; nfound = 0;
*cmd = find_cmd (command, len, cur_list, 1, &nfound); *cmd = find_cmd (command, len, cur_list, 1, &nfound);
/* We didn't find the command in the entered case, so lower case it /* We didn't find the command in the entered case, so lower case
and search again. it and search again.
*/ */
if (!*cmd || nfound == 0) if (!*cmd || nfound == 0)
{ {
@ -1574,8 +1578,8 @@ lookup_cmd_composition (char *text,
{ {
if ((*cmd)->cmd_pointer) if ((*cmd)->cmd_pointer)
{ {
/* cmd was actually an alias, we note that an alias was used /* cmd was actually an alias, we note that an alias was
(by assigning *alais) and we set *cmd. */ used (by assigning *alais) and we set *cmd. */
*alias = *cmd; *alias = *cmd;
*cmd = (*cmd)->cmd_pointer; *cmd = (*cmd)->cmd_pointer;
} }
@ -1596,8 +1600,8 @@ lookup_cmd_composition (char *text,
possible completions in LIST of TEXT. possible completions in LIST of TEXT.
WORD points in the same buffer as TEXT, and completions should be WORD points in the same buffer as TEXT, and completions should be
returned relative to this position. For example, suppose TEXT is "foo" returned relative to this position. For example, suppose TEXT is
and we want to complete to "foobar". If WORD is "oo", return "foo" and we want to complete to "foobar". If WORD is "oo", return
"oobar"; if WORD is "baz/foo", return "baz/foobar". */ "oobar"; if WORD is "baz/foo", return "baz/foobar". */
char ** char **
@ -1755,7 +1759,7 @@ complete_on_enum (const char *enumlist[],
} }
/* check function pointer */ /* Check function pointer. */
int int
cmd_func_p (struct cmd_list_element *cmd) 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 void
cmd_func (struct cmd_list_element *cmd, char *args, int from_tty) cmd_func (struct cmd_list_element *cmd, char *args, int from_tty)
{ {

View file

@ -42,8 +42,8 @@ cmd_types;
/* This flag is used by the code executing commands to warn the user /* 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 first time a deprecated command is used, see the 'flags' field
the following struct. in the following struct.
*/ */
#define CMD_DEPRECATED 0x1 #define CMD_DEPRECATED 0x1
#define DEPRECATED_WARN_USER 0x2 #define DEPRECATED_WARN_USER 0x2
@ -109,8 +109,8 @@ struct cmd_list_element
memory for replacement is malloc'ed. When a command is memory for replacement is malloc'ed. When a command is
undeprecated or re-deprecated at runtime we don't want to risk undeprecated or re-deprecated at runtime we don't want to risk
calling free on statically allocated memory, so we check this calling free on statically allocated memory, so we check this
flag. flag. */
*/
int flags; int flags;
/* If this command is deprecated, this is the replacement name. */ /* 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 skipped). It stops where we are supposed to stop completing
(rl_point) and is '\0' terminated. (rl_point) and is '\0' terminated.
Return value is a malloc'd vector of pointers to possible completions Return value is a malloc'd vector of pointers to possible
terminated with NULL. If there are no completions, returning a pointer completions terminated with NULL. If there are no completions,
to a NULL would work but returning NULL itself is also valid. returning a pointer to a NULL would work but returning NULL
WORD points in the same buffer as TEXT, and completions should be itself is also valid. WORD points in the same buffer as TEXT,
returned relative to this position. For example, suppose TEXT is "foo" and completions should be returned relative to this position.
and we want to complete to "foobar". If WORD is "oo", return For example, suppose TEXT is "foo" and we want to complete to
"oobar"; if WORD is "baz/foo", return "baz/foobar". */ "foobar". If WORD is "oo", return "oobar"; if WORD is
char **(*completer) (struct cmd_list_element *cmd, char *text, char *word); "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 /* Destruction routine for this command. If non-NULL, this is
called when this command instance is destroyed. This may be called when this command instance is destroyed. This may be
@ -175,14 +177,15 @@ struct cmd_list_element
or "show"). */ or "show"). */
cmd_types type; cmd_types type;
/* Pointer to variable affected by "set" and "show". Doesn't matter /* Pointer to variable affected by "set" and "show". Doesn't
if type is not_set. */ matter if type is not_set. */
void *var; void *var;
/* What kind of variable is *VAR? */ /* What kind of variable is *VAR? */
var_types var_type; 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; const char **enums;
/* Pointer to command strings of user-defined commands */ /* Pointer to command strings of user-defined commands */

View file

@ -149,7 +149,7 @@ bfd_openw_with_cleanup (const char *filename, const char *target,
if (!bfd_set_format (obfd, bfd_object)) if (!bfd_set_format (obfd, bfd_object))
error (_("bfd_openw_with_cleanup: %s."), bfd_errmsg (bfd_get_error ())); error (_("bfd_openw_with_cleanup: %s."), bfd_errmsg (bfd_get_error ()));
} }
else if (*mode == 'a') /* Append to existing file */ else if (*mode == 'a') /* Append to existing file. */
{ /* FIXME -- doesn't work... */ { /* FIXME -- doesn't work... */
error (_("bfd_openw does not work with append.")); error (_("bfd_openw does not work with append."));
} }
@ -474,7 +474,7 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args)
transfer should start and end. */ transfer should start and end. */
if (sec_start < data->load_start) if (sec_start < data->load_start)
sec_offset = data->load_start - sec_start; sec_offset = data->load_start - sec_start;
/* Size of a partial transfer: */ /* Size of a partial transfer. */
sec_load_count -= sec_offset; sec_load_count -= sec_offset;
if (data->load_end > 0 && sec_end > data->load_end) if (data->load_end > 0 && sec_end > data->load_end)
sec_load_count -= sec_end - data->load_end; sec_load_count -= sec_end - data->load_end;

View file

@ -30,11 +30,13 @@
struct ui_out *cli_uiout; 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". */ /* Longjmp-safe wrapper for "execute_command". */
static struct gdb_exception safe_execute_command (struct ui_out *uiout, 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 struct captured_execute_command_args
{ {
char *command; char *command;
@ -56,8 +58,9 @@ cli_interpreter_resume (void *data)
/*sync_execution = 1; */ /*sync_execution = 1; */
/* gdb_setup_readline will change gdb_stdout. If the CLI was previously /* gdb_setup_readline will change gdb_stdout. If the CLI was
writing to gdb_stdout, then set it to the new gdb_stdout afterwards. */ previously writing to gdb_stdout, then set it to the new
gdb_stdout afterwards. */
stream = cli_out_set_stream (cli_uiout, gdb_stdout); stream = cli_out_set_stream (cli_uiout, gdb_stdout);
if (stream != gdb_stdout) if (stream != gdb_stdout)
@ -101,12 +104,13 @@ cli_interpreter_exec (void *data, const char *command_str)
safe_execute_command. */ safe_execute_command. */
char *str = strcpy (alloca (strlen (command_str) + 1), command_str); char *str = strcpy (alloca (strlen (command_str) + 1), command_str);
/* gdb_stdout could change between the time cli_uiout was initialized /* gdb_stdout could change between the time cli_uiout was
and now. Since we're probably using a different interpreter which has initialized and now. Since we're probably using a different
a new ui_file for gdb_stdout, use that one instead of the default. 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 It is important that it gets reset everytime, since the user
set gdb to use a different interpreter. */ could set gdb to use a different interpreter. */
old_stream = cli_out_set_stream (cli_uiout, gdb_stdout); old_stream = cli_out_set_stream (cli_uiout, gdb_stdout);
result = safe_execute_command (cli_uiout, str, 1); result = safe_execute_command (cli_uiout, str, 1);
cli_out_set_stream (cli_uiout, old_stream); cli_out_set_stream (cli_uiout, old_stream);

View file

@ -69,10 +69,10 @@ Whether logging overwrites or appends to the log file is %s.\n"),
/* Value as configured by the user. */ /* Value as configured by the user. */
static int logging_redirect; static int logging_redirect;
/* The on-disk file in use if logging is currently active together with /* The on-disk file in use if logging is currently active together
redirection turned off (and therefore using tee_file_new). For active with redirection turned off (and therefore using tee_file_new).
logging with redirection the on-disk file is directly in GDB_STDOUT and For active logging with redirection the on-disk file is directly in
this variable is NULL. */ GDB_STDOUT and this variable is NULL. */
static struct ui_file *logging_no_redirect_file; static struct ui_file *logging_no_redirect_file;
static void 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); 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); cleanups = make_cleanup_ui_file_delete (gdb_stdout);
output = logging_no_redirect_file; 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; gdb_stdtargerr = output;
logging_no_redirect_file = new_logging_no_redirect_file; logging_no_redirect_file = new_logging_no_redirect_file;
/* There is a former output pushed on the ui_out_redirect stack. We want to /* There is a former output pushed on the ui_out_redirect stack. We
replace it by OUTPUT so we must pop the former value first. We should want to replace it by OUTPUT so we must pop the former value
either do both the pop and push or to do neither of it. At least do not first. We should either do both the pop and push or to do
try to push OUTPUT if the pop already failed. */ neither of it. At least do not try to push OUTPUT if the pop
already failed. */
if (ui_out_redirect (uiout, NULL) < 0 if (ui_out_redirect (uiout, NULL) < 0
|| ui_out_redirect (uiout, output) < 0) || ui_out_redirect (uiout, output) < 0)

View file

@ -36,7 +36,7 @@
#include "python/python.h" #include "python/python.h"
/* Prototypes for local functions */ /* Prototypes for local functions. */
static enum command_control_type static enum command_control_type
recurse_read_control_structure (char * (*read_next_line_func) (void), recurse_read_control_structure (char * (*read_next_line_func) (void),
@ -65,7 +65,8 @@ struct user_args
{ {
struct user_args *next; struct user_args *next;
/* It is necessary to store a malloced copy of the command line to /* 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; char *command;
struct struct
{ {
@ -164,7 +165,8 @@ print_command_lines (struct ui_out *uiout, struct command_line *cmd,
continue; 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) if (list->control_type == break_control)
{ {
ui_out_field_string (uiout, NULL, "loop_break"); ui_out_field_string (uiout, NULL, "loop_break");
@ -173,13 +175,14 @@ print_command_lines (struct ui_out *uiout, struct command_line *cmd,
continue; 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 if (list->control_type == while_control
|| list->control_type == while_stepping_control) || list->control_type == while_stepping_control)
{ {
/* For while-stepping, the line includes the 'while-stepping' token. /* For while-stepping, the line includes the 'while-stepping'
See comment in process_next_line for explanation. Here, token. See comment in process_next_line for explanation.
take care not print 'while-stepping' twice. */ Here, take care not print 'while-stepping' twice. */
if (list->control_type == while_control) if (list->control_type == while_control)
ui_out_field_fmt (uiout, NULL, "while %s", list->line); ui_out_field_fmt (uiout, NULL, "while %s", list->line);
else else
@ -194,7 +197,8 @@ print_command_lines (struct ui_out *uiout, struct command_line *cmd,
continue; 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) if (list->control_type == if_control)
{ {
ui_out_field_fmt (uiout, NULL, "if %s", list->line); ui_out_field_fmt (uiout, NULL, "if %s", list->line);
@ -220,7 +224,8 @@ print_command_lines (struct ui_out *uiout, struct command_line *cmd,
continue; 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->control_type == commands_control)
{ {
if (*(list->line)) if (*(list->line))
@ -251,7 +256,7 @@ print_command_lines (struct ui_out *uiout, struct command_line *cmd,
continue; continue;
} }
/* ignore illegal command type and try next */ /* Ignore illegal command type and try next. */
list = list->next; list = list->next;
} /* while (list) */ } /* while (list) */
} }
@ -263,7 +268,7 @@ clear_hook_in_cleanup (void *data)
{ {
struct cmd_list_element *c = 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 void
@ -272,7 +277,7 @@ execute_cmd_pre_hook (struct cmd_list_element *c)
if ((c->hook_pre) && (!c->hook_in)) if ((c->hook_pre) && (!c->hook_in))
{ {
struct cleanup *cleanups = make_cleanup (clear_hook_in_cleanup, 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_pre, (char *) 0); execute_user_command (c->hook_pre, (char *) 0);
do_cleanups (cleanups); 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); 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); execute_user_command (c->hook_post, (char *) 0);
do_cleanups (cleanups); do_cleanups (cleanups);
} }
@ -348,8 +353,8 @@ execute_user_command (struct cmd_list_element *c, char *args)
do_cleanups (old_chain); do_cleanups (old_chain);
} }
/* This function is called every time GDB prints a prompt. /* This function is called every time GDB prints a prompt. It ensures
It ensures that errors and the like to not confuse the command tracing. */ that errors and the like do not confuse the command tracing. */
void void
reset_command_nest_depth (void) reset_command_nest_depth (void)
@ -522,8 +527,8 @@ execute_control_command (struct command_line *cmd)
val_mark = value_mark (); val_mark = value_mark ();
val = evaluate_expression (expr); val = evaluate_expression (expr);
/* Choose which arm to take commands from based on the value of the /* Choose which arm to take commands from based on the value
conditional expression. */ of the conditional expression. */
if (value_true (val)) if (value_true (val))
current = *cmd->body_list; current = *cmd->body_list;
else if (cmd->body_count == 2) else if (cmd->body_count == 2)
@ -549,8 +554,8 @@ execute_control_command (struct command_line *cmd)
} }
case commands_control: case commands_control:
{ {
/* Breakpoint commands list, record the commands in the breakpoint's /* Breakpoint commands list, record the commands in the
command list and return. */ breakpoint's command list and return. */
new_line = insert_args (cmd->line); new_line = insert_args (cmd->line);
if (!new_line) if (!new_line)
break; break;
@ -721,8 +726,8 @@ setup_user_args (char *p)
return old_chain; return old_chain;
} }
/* Given character string P, return a point to the first argument ($arg), /* Given character string P, return a point to the first argument
or NULL if P contains no arguments. */ ($arg), or NULL if P contains no arguments. */
static char * static char *
locate_arg (char *p) locate_arg (char *p)
@ -738,7 +743,8 @@ locate_arg (char *p)
} }
/* Insert the user defined arguments stored in user_arg into the $arg /* 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 * static char *
insert_args (char *line) insert_args (char *line)
@ -751,7 +757,8 @@ insert_args (char *line)
if (user_args == NULL) if (user_args == NULL)
return xstrdup (line); 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; save_line = line;
len = 0; len = 0;
while ((p = locate_arg (line))) while ((p = locate_arg (line)))
@ -883,11 +890,12 @@ read_next_line (void)
return command_line_input (prompt_ptr, instream == stdin, "commands"); return command_line_input (prompt_ptr, instream == stdin, "commands");
} }
/* Process one input line. If the command is an "end", /* Process one input line. If the command is an "end", return such an
return such an indication to the caller. If PARSE_COMMANDS is true, indication to the caller. If PARSE_COMMANDS is true, strip leading
strip leading whitespace (trailing whitespace is always stripped) whitespace (trailing whitespace is always stripped) in the line,
in the line, attempt to recognize GDB control commands, and also attempt to recognize GDB control commands, and also return an
return an indication if the command is an "else" or a nop. indication if the command is an "else" or a nop.
Otherwise, only "end" is recognized. */ Otherwise, only "end" is recognized. */
static enum misc_command_type static enum misc_command_type
@ -925,8 +933,8 @@ process_next_line (char *p, struct command_line **command, int parse_commands,
p = p_start; p = p_start;
/* Blanks and comments don't really do anything, but we need to /* Blanks and comments don't really do anything, but we need to
distinguish them from else, end and other commands which can be distinguish them from else, end and other commands which can
executed. */ be executed. */
if (p_end == p || p[0] == '#') if (p_end == p || p[0] == '#')
return nop_command; 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)) if (p_end - p == 4 && !strncmp (p, "else", 4))
return else_command; return else_command;
/* Check for while, if, break, continue, etc and build a new command /* Check for while, if, break, continue, etc and build a new
line structure for them. */ command line structure for them. */
if ((p_end - p >= 14 && !strncmp (p, "while-stepping", 14)) if ((p_end - p >= 14 && !strncmp (p, "while-stepping", 14))
|| (p_end - p >= 8 && !strncmp (p, "stepping", 8)) || (p_end - p >= 8 && !strncmp (p, "stepping", 8))
|| (p_end - p >= 2 && !strncmp (p, "ws", 2))) || (p_end - p >= 2 && !strncmp (p, "ws", 2)))
@ -947,9 +955,10 @@ process_next_line (char *p, struct command_line **command, int parse_commands,
For 'ws' alias, the command will have 'ws', not expanded 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', really want frontend to send a command list with 'ws',
and next break-info returning command line with 'while-stepping'. and next break-info returning command line with
This should work, but might cause the breakpoint to be marked as 'while-stepping'. This should work, but might cause the
changed while it's actually not. */ breakpoint to be marked as changed while it's actually
not. */
*command = build_command_line (while_stepping_control, p); *command = build_command_line (while_stepping_control, p);
} }
else if (p_end - p > 5 && !strncmp (p, "while", 5)) 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; return ok_command;
} }
/* Recursively read in the control structures and create a command_line /* Recursively read in the control structures and create a
structure from them. Use read_next_line_func to obtain lines of command_line structure from them. Use read_next_line_func to
the command. obtain lines of the command. */
*/
static enum command_control_type static enum command_control_type
recurse_read_control_structure (char * (*read_next_line_func) (void), 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) 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); (*deprecated_readline_begin_hook) ("%s %s\n", prompt_arg, END_MESSAGE);
} }
else else
@ -1592,7 +1599,7 @@ wrapped_read_command_file (struct ui_out *uiout, void *data)
read_command_file (args->stream); read_command_file (args->stream);
} }
/* Used to implement source_command */ /* Used to implement source_command. */
void void
script_from_file (FILE *stream, const char *file) 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); make_cleanup (source_cleanup_lines, &old_lines);
source_line_number = 0; source_line_number = 0;
source_file_name = file; source_file_name = file;
/* This will get set every time we read a line. So it won't stay "" for /* This will get set every time we read a line. So it won't stay ""
long. */ for long. */
error_pre_print = ""; error_pre_print = "";
{ {

View file

@ -29,7 +29,7 @@
#include "cli/cli-cmds.h" #include "cli/cli-cmds.h"
#include "cli/cli-setshow.h" #include "cli/cli-setshow.h"
/* Prototypes for local functions */ /* Prototypes for local functions. */
static int parse_binary_operation (char *); static int parse_binary_operation (char *);
@ -58,7 +58,7 @@ parse_auto_binary_operation (const char *arg)
return AUTO_BOOLEAN_AUTO; return AUTO_BOOLEAN_AUTO;
} }
error (_("\"on\", \"off\" or \"auto\" expected.")); error (_("\"on\", \"off\" or \"auto\" expected."));
return AUTO_BOOLEAN_AUTO; /* pacify GCC */ return AUTO_BOOLEAN_AUTO; /* Pacify GCC. */
} }
static int 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 /* Do a "set" or "show" command. ARG is NULL if no argument, or the
of the argument, and FROM_TTY is nonzero if this command is being entered text of the argument, and FROM_TTY is nonzero if this command is
directly by the user (i.e. these are just like any other being entered directly by the user (i.e. these are just like any
command). C is the command list element for the command. */ other command). C is the command list element for the command. */
void void
do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) 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; const char *match = NULL;
char *p; 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) if (arg == NULL)
{ {
char *msg; char *msg;
@ -268,7 +269,8 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
strcat (msg, ", "); strcat (msg, ", ");
strcat (msg, c->enums[i]); 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, ' '); p = strchr (arg, ' ');
@ -286,7 +288,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
{ {
match = c->enums[i]; match = c->enums[i];
nmatches = 1; nmatches = 1;
break; /* exact match. */ break; /* Exact match. */
} }
else else
{ {

View file

@ -22,10 +22,10 @@ struct cmd_list_element;
/* Exported to cli/cli-cmds.c and gdb/top.c */ /* 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 /* Do a "set" or "show" command. ARG is NULL if no argument, or the
of the argument, and FROM_TTY is nonzero if this command is being entered text of the argument, and FROM_TTY is nonzero if this command is
directly by the user (i.e. these are just like any other being entered directly by the user (i.e. these are just like any
command). C is the command list element for the command. */ other command). C is the command list element for the command. */
extern void do_setshow_command (char *arg, int from_tty, extern void do_setshow_command (char *arg, int from_tty,
struct cmd_list_element *c); struct cmd_list_element *c);

View file

@ -146,7 +146,7 @@ extern void set_cmd_completer (struct cmd_list_element *cmd,
extern int cmd_cfunc_eq (struct cmd_list_element *cmd, extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
void (*cfunc) (char *args, int from_tty)); 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 set_cmd_context (struct cmd_list_element *cmd, void *context);
extern void *get_cmd_context (struct cmd_list_element *cmd); extern void *get_cmd_context (struct cmd_list_element *cmd);