From b0c29749808a4e7232e4e8258df8e3aa03208e2f Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Wed, 11 Jan 1995 07:43:53 +0000 Subject: [PATCH] * 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/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.base/commands.exp | 21 ++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index ee730256937..32bc389cc4d 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 fcb09f4545d..6e78f6ea7d4 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 -- 2.30.2