aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorAndrew Stubbs <andrew.stubbs@st.com>2005-11-15 12:03:08 +0000
committerAndrew Stubbs <andrew.stubbs@st.com>2005-11-15 12:03:08 +0000
commitc03c782ff0dad9272576c5099eec29f7c001602c (patch)
tree97c379991a02f1636d104e7de6fb26170e91ee37 /gdb/doc
parent1637cd900b9f1f05d0a128479bd3484cd98f2811 (diff)
downloadgdb-c03c782ff0dad9272576c5099eec29f7c001602c.zip
gdb-c03c782ff0dad9272576c5099eec29f7c001602c.tar.gz
gdb-c03c782ff0dad9272576c5099eec29f7c001602c.tar.bz2
2005-11-15 Andrew Stubbs <andrew.stubbs@st.com>
* cli/cli-script.c: Include gdb_assert.h. (locate_arg): Detect $argc. (insert_args): Substitute $argc. * Makefile.in (cli-script.o): Add dependency on gdb_assert.h. doc/ * gdb.texinfo (User-defined commands): Add $argc. Add missing 'end'. Change @var{$arg0 to @code{$arg0.
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo17
2 files changed, 21 insertions, 1 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 7343e2a..ab7873b 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2005-11-15 Andrew Stubbs <andrew.stubbs@st.com>
+
+ * gdb.texinfo (User-defined commands): Add $argc. Add missing 'end'.
+ Change @var{$arg0 to @code{$arg0.
+
2005-11-14 Wu Zhou <woodzltc@cn.ibm.com>
* gdb.texinfo (Fortran): Add some words about Fortran debugging.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 1f0dbd1..21feb2c 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -15708,11 +15708,12 @@ A @dfn{user-defined command} is a sequence of @value{GDBN} commands to
which you assign a new name as a command. This is done with the
@code{define} command. User commands may accept up to 10 arguments
separated by whitespace. Arguments are accessed within the user command
-via @var{$arg0@dots{}$arg9}. A trivial example:
+via @code{$arg0@dots{}$arg9}. A trivial example:
@smallexample
define adder
print $arg0 + $arg1 + $arg2
+end
@end smallexample
@noindent
@@ -15728,6 +15729,20 @@ its three arguments. Note the arguments are text substitutions, so they may
reference variables, use complex expressions, or even perform inferior
functions calls.
+In addition, @code{$argc} may be used to find out how many arguments have
+been passed. This expands to a number in the range 0@dots{}10.
+
+@smallexample
+define adder
+ if $argc == 2
+ print $arg0 + $arg1
+ end
+ if $argc == 3
+ print $arg0 + $arg1 + $arg2
+ end
+end
+@end smallexample
+
@table @code
@kindex define