mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 20:28:28 +08:00
* 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".
This commit is contained in:
@ -1,5 +1,9 @@
|
|||||||
Wed Jan 11 00:14:40 1995 Jeff Law (law@snake.cs.utah.edu)
|
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
|
* gdb.base/commands.exp: Test if/while commands as part of a
|
||||||
breakpoint command list; verify they appear in breakpoint
|
breakpoint command list; verify they appear in breakpoint
|
||||||
information.
|
information.
|
||||||
|
@ -104,7 +104,7 @@ proc if_while_breakpoint_command_test {} {
|
|||||||
send "commands\n"
|
send "commands\n"
|
||||||
expect {
|
expect {
|
||||||
-re "End with" { }
|
-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.
|
# 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"
|
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"
|
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_if_test
|
||||||
gdbvar_simple_while_test
|
gdbvar_simple_while_test
|
||||||
gdbvar_complex_if_while_test
|
gdbvar_complex_if_while_test
|
||||||
@ -119,3 +137,4 @@ progvar_simple_if_test
|
|||||||
progvar_simple_while_test
|
progvar_simple_while_test
|
||||||
progvar_complex_if_while_test
|
progvar_complex_if_while_test
|
||||||
if_while_breakpoint_command_test
|
if_while_breakpoint_command_test
|
||||||
|
user_defined_command_test
|
||||||
|
Reference in New Issue
Block a user