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>
* event-loop.c: Comment clean-up.

View file

@ -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"
@ -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
@ -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))
{
/* 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 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)
@ -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."), _("\

View file

@ -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 *);
@ -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),
@ -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;
@ -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)
{
@ -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++)
@ -1231,12 +1236,12 @@ lookup_cmd_1 (char **text, struct cmd_list_element *clist,
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;
}
@ -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
deprecated and a warning message should be generated. This function
decodes *TEXT and potentially generates a warning message as outlined
below.
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,7 +1493,6 @@ deprecated_cmd_warning (char **text)
}
/* Look up the contents of LINE as a command in the command list 'cmdlist'.
Return 1 on success, 0 on failure.
@ -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;
}
@ -1596,8 +1600,8 @@ lookup_cmd_composition (char *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 **
@ -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)
{

View file

@ -42,8 +42,8 @@ cmd_types;
/* 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.
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
@ -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 */

View file

@ -149,7 +149,7 @@ 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 */
else if (*mode == 'a') /* Append to existing file. */
{ /* FIXME -- doesn't work... */
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. */
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;

View file

@ -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);

View file

@ -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)

View file

@ -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,7 +197,8 @@ 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);
@ -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;
@ -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
@ -925,8 +933,8 @@ process_next_line (char *p, struct command_line **command, int parse_commands,
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)))
@ -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
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
@ -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 = "";
{

View file

@ -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
{

View file

@ -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);

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,
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);