aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/commands.exp
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/testsuite/gdb.base/commands.exp
parentcba9d85e019f73d15223eb7341fafc6b88d0ed15 (diff)
downloadgdb-b0c29749808a4e7232e4e8258df8e3aa03208e2f.zip
gdb-b0c29749808a4e7232e4e8258df8e3aa03208e2f.tar.gz
gdb-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/testsuite/gdb.base/commands.exp')
-rw-r--r--gdb/testsuite/gdb.base/commands.exp21
1 files changed, 20 insertions, 1 deletions
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