aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1995-03-14 00:49:33 +0000
committerPer Bothner <per@bothner.com>1995-03-14 00:49:33 +0000
commitd0b2a91c25190f8697f3c39af9875e4c5eb3dc83 (patch)
tree0612a5f1c2d10a894d2e9f1c1306ed2fb7a38078 /gdb/doc
parent4f69fe4692bd5be12c0b3c3e8b9f6808e2565c1e (diff)
downloadgdb-d0b2a91c25190f8697f3c39af9875e4c5eb3dc83.zip
gdb-d0b2a91c25190f8697f3c39af9875e4c5eb3dc83.tar.gz
gdb-d0b2a91c25190f8697f3c39af9875e4c5eb3dc83.tar.bz2
* gdb.texinfo (Define): Document $arg0... arguments to commands,
and new 'if' and 'while' commands.
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo37
2 files changed, 41 insertions, 1 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 79f5b0c..8cc1d5f 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+Mon Mar 13 16:49:13 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * gdb.texinfo (Define): Document $arg0... arguments to commands,
+ and new 'if' and 'while' commands.
+
Fri Feb 17 15:24:35 1995 Per Bothner <bothner@kalessin.cygnus.com>
* gdb.texinfo (Artificial arrays): Note use of coerce-to-array-type.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 7e445aa..898f6b9 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -7816,6 +7816,24 @@ The definition of the command is made up of other @value{GDBN} command lines,
which are given following the @code{define} command. The end of these
commands is marked by a line containing @code{end}.
+@item if
+@kindex if
+@kindex else
+Takes a single argument, which is an expression to evaluate.
+It is followed by a series of commands that are executed
+only if the expression is true (nonzero).
+There can then optionally be a line @code{else}, followed
+by a series of commands that are only executed if the expression
+was false. The end of the list is marked by a line containing @code{end}.
+
+@item while
+@kindex while
+The syntax is similar to @code{if}: The command takes a single argument,
+which is an expression to evaluate, and must be followed by the commands to
+execute, one per line, terminated by an @code{end}.
+The commands are executed repeatedly as long as the expression
+evaluates to true.
+
@item document @var{commandname}
@kindex document
Give documentation to the user-defined command @var{commandname}. The
@@ -7842,7 +7860,24 @@ documentation). If no @var{commandname} is given, display the
definitions for all user-defined commands.
@end table
-User-defined commands do not take arguments. When they are executed, the
+User-defined commands may accept up to 10 arguments separated by whitespace.
+Arguments are accessed within the user command via @code{$arg0}..@code{$arg9}.
+A trivial example:
+@smallexample
+define adder
+print $arg0 + $arg1 + $arg2
+end
+@end smallexample
+Defines the command @code{adder} which prints the sum of its three arguments.
+To execute the command use:
+@smallexample
+adder 1 2 3
+@end smallexample
+
+Note the arguments are text substitutions, so they may reference variables,
+use complex expressions, or even perform inferior function calls.
+
+When user-defined commands are executed, the
commands of the definition are not printed. An error in any command
stops execution of the user-defined command.