aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1995-01-11 07:43:53 +0000
committerJeff Law <law@redhat.com>1995-01-11 07:43:53 +0000
commitb0c29749808a4e7232e4e8258df8e3aa03208e2f (patch)
tree3b6a17755ac5b8b77c520d81f05f3ab0cd9bf7d2 /gdb
parentcba9d85e019f73d15223eb7341fafc6b88d0ed15 (diff)
downloadbinutils-b0c29749808a4e7232e4e8258df8e3aa03208e2f.zip
binutils-b0c29749808a4e7232e4e8258df8e3aa03208e2f.tar.gz
binutils-b0c29749808a4e7232e4e8258df8e3aa03208e2f.tar.bz2
* gdb.base/commands.exp: Test a simple user defined command with
arguments and if/while statements; verify the full user command is printed by "show user".
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.base/commands.exp21
2 files changed, 24 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index ee73025..32bc389 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
Wed Jan 11 00:14:40 1995 Jeff Law (law@snake.cs.utah.edu)
+ * gdb.base/commands.exp: Test a simple user defined command with
+ arguments and if/while statements; verify the full user command is
+ printed by "show user".
+
* gdb.base/commands.exp: Test if/while commands as part of a
breakpoint command list; verify they appear in breakpoint
information.
diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index fcb09f4..6e78f6e 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -104,7 +104,7 @@ proc if_while_breakpoint_command_test {} {
send "commands\n"
expect {
-re "End with" { }
- default "{ fail (timeout or eof) commands" }
+ default { fail "(timeout or eof) commands" }
}
# This test should alternate between 0xdeadbeef and 0xfeedface two times.
gdb_test "while value > 0\\nset value -= 1\\nif \(value % 2\) == 1\\np/x 0xdeadbeef\\nelse\\np/x 0xfeedface\\nend\\nend\\nend\\n" ".*$prompt.*" "commands"
@@ -112,6 +112,24 @@ proc if_while_breakpoint_command_test {} {
gdb_test "info break" "while.*set.*if.*p/x.*else.*p/x.*end.*" "info break"
}
+# Test a simple user defined command (with arguments)
+proc user_defined_command_test {} {
+ global prompt
+
+ gdb_test "set \\\$foo = 4"
+ # For some stupid reason doing this with a gdb_test timed out. Weird.
+ send "define mycommand\n"
+ expect {
+ -re "End with" { }
+ default { fail "(timeout or eof) enter user defined command" }
+ }
+ # This test should alternate between 0xdeadbeef and 0xfeedface two times.
+ gdb_test "while \\\$arg0 > 0\\nset \\\$arg0 -= 1\\nif \(\\\$arg0 % 2\) == 1\\np/x 0xdeadbeef\\nelse\\np/x 0xfeedface\\nend\\nend\\nend\\n" ".*$prompt.*" "enter user defined command"
+
+ gdb_test "mycommand \\\$foo" "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" "execute user defined command"
+ gdb_test "show user mycommand" "while.*set.*if.*p/x.*else.*p/x.*end.*" "display user command"
+}
+
gdbvar_simple_if_test
gdbvar_simple_while_test
gdbvar_complex_if_while_test
@@ -119,3 +137,4 @@ progvar_simple_if_test
progvar_simple_while_test
progvar_complex_if_while_test
if_while_breakpoint_command_test
+user_defined_command_test