This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] gdb.base/d*.exp e*.exp send_gdb vs. gdb_test
- From: Michael Snyder <msnyder at vmware dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 21 May 2010 15:20:32 -0700
- Subject: [RFA] gdb.base/d*.exp e*.exp send_gdb vs. gdb_test
2010-05-20 Michael Snyder <msnyder@vmware.com>
* gdb.base/default.exp: Replace send_gdb with gdb_test.
* gdb.base/define.exp: Replace send_gdb with gdb_test.
* gdb.base/display.exp: Replace send_gdb with gdb_test.
* gdb.base/dump.exp: Replace send_gdb with gdb_test.
* gdb.base/ending-run.exp: Replace send_gdb with gdb_test.
* gdb.base/eval-skip.exp: Replace send_gdb with gdb_test.
* gdb.base/exprs.exp: Replace send_gdb with gdb_test.
Index: default.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/default.exp,v
retrieving revision 1.38
diff -u -p -r1.38 default.exp
--- default.exp 29 Apr 2010 14:45:39 -0000 1.38
+++ default.exp 21 May 2010 22:19:27 -0000
@@ -40,22 +40,19 @@ gdb_test "append binary memory" "Missing
gdb_test "append binary value" "Missing filename\."
setup_xfail "mips-idt-*"
-send_gdb "attach\n"
-gdb_expect {
+gdb_test_multiple "attach" "attach" {
-re "Argument required .(process-id|program) to attach.*$gdb_prompt $"\
- { pass "attach" }
+ { pass "attach" }
-re "You can't do that when your target is `None'.*$gdb_prompt $"\
- { pass "attach" }
+ { pass "attach" }
-re "You can't do that without a process to debug.*$gdb_prompt $"\
- { pass "attach" }
+ { pass "attach" }
-re "Don't know how to attach. Try \"help target\"..*$gdb_prompt $"\
- { pass "attach" }
+ { pass "attach" }
-re "Kill it. .y or n." {
send_gdb "y\n"
exp_continue
}
- -re "$gdb_prompt $" { fail "attach" }
- timeout { fail "(timeout) attach" }
}
if ![target_info exists use_gdb_stub] {
@@ -117,18 +114,13 @@ gdb_test "define" "Argument required \[(
gdb_test "delete breakpoints" "" "delete breakpoints"
#test delete display
# FIXME -- need to dump full output to detailed log
-send_gdb "delete display\n"
-gdb_expect {
- -re "Delete all auto-display expressions.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re "$gdb_prompt $" { pass "delete display prompt" }
- timeout { fail "(timeout) delete display prompt" }
- }
- }
- timeout { fail "(timeout) delete display prompt" }
-}
+gdb_test "delete display" \
+ "" \
+ "delete display prompt" \
+ "Delete all auto-display expressions.*y or n. $" \
+ "y"
+
#test detach
gdb_test "detach" "" "detach"
@@ -141,17 +133,11 @@ if [istarget "h8300-*-hms"] then {
#test directory
# FIXME -- need to dump full output to detailed log
-send_gdb "directory\n"
-gdb_expect {
- -re "Reinitialize source path to empty.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re "Source directories searched: .cdir\[:;\].cwd.*$gdb_prompt $"\
- { pass "directory prompt" }
- timeout { fail "(timeout) directory prompt" }
- }
- }
-}
+gdb_test "directory" \
+ "Source directories searched: .cdir\[:;\].cwd.*" \
+ "directory prompt" \
+ "Reinitialize source path to empty.*y or n. $" \
+ "y"
#test disable "dis" abbreviation
gdb_test "dis" "" "disable \"dis\" abbreviation"
@@ -256,26 +242,25 @@ gdb_test "finish" "The program is not be
# vary on different systems.
gdb_test "forward-search" "No previous regular expression.*|There is no previous regular expression.*" "forward-search"
#test gcore
-send_gdb "gcore\n"
-gdb_expect {
+
+gdb_test_multiple "gcore" "gcore" {
-re "You can\'t do that without a process to debug.*$gdb_prompt $" {
pass "gcore"
}
-re "Undefined command: .*$gdb_prompt $" {
pass "gcore"
}
- default { fail "gcore" }
}
-send_gdb "generate-core-file\n"
-gdb_expect {
+
+gdb_test_multiple "generate-core-file" "generate-core-file" {
-re "You can\'t do that without a process to debug.*$gdb_prompt $" {
pass "generate-core-file"
}
-re "Undefined command: .*$gdb_prompt $" {
pass "generate-core-file"
}
- default { fail "generate-core-file" }
}
+
#test help "h" abbreviation
gdb_test "h" "List of classes of commands:(\[^\r\n\]*\[\r\n\])+aliases -- Aliases of other commands(\[^\r\n\]*\[\r\n\])+breakpoints -- Making program stop at certain points(\[^\r\n\]*\[\r\n\])+data -- Examining data(\[^\r\n\]*\[\r\n\])+files -- Specifying and examining files(\[^\r\n\]*\[\r\n\])+obscure -- Obscure features(\[^\r\n\]*\[\r\n\])+running -- Running the program(\[^\r\n\]*\[\r\n\])+stack -- Examining the stack(\[^\r\n\]*\[\r\n\])+status -- Status inquiries(\[^\r\n\]*\[\r\n\])+support -- Support facilities(\[^\r\n\]*\[\r\n\])+user-defined -- User-defined commands(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by a class name for a list of commands in that class.(\[^\r\n\]*\[\r\n\])+Type \"help\" followed by command name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "help \"h\" abbreviation"
#test help
@@ -415,29 +400,20 @@ You must specify a function name to run,
gdb_test "set args main" "" ""
} else {
- send_gdb "r\n"
- gdb_expect {
- -re "Starting program: .*
-You can't do that when your target is `None'.*$gdb_prompt $"\
- { pass "run \"r\" abbreviation" }
- -re "Starting program: .*
-No executable file specified.*
-Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
- { pass "run \"r\" abbreviation" }
- -re "Starting program: .*
-No executable specified, use .target exec.\\..*$gdb_prompt $"\
- { pass "run \"r\" abbreviation" }
- -re "Starting program: .*
-No image loaded into target.*$gdb_prompt $"\
- { pass "run \"r\" abbreviation" }
- -re "Starting program: .*
-No program loaded.*$gdb_prompt $"\
- { pass "run \"r\" abbreviation" }
- -re "Don't know how to run. Try \"help target\"..*$gdb_prompt $"\
- { pass "run \"r\" abbreviation" }
- -re ".*$gdb_prompt $" { fail "run \"r\" abbreviation" }
- timeout { fail "(timeout) run \"r\" abbreviation" }
- }
+ gdb_test_multiple "r" "run \"r\" abbreviation" {
+ -re "Starting program: .*You can't do that when your target is `None'.*$gdb_prompt $"\
+ { pass "run \"r\" abbreviation" }
+ -re "Starting program: .*No executable file specified.*Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
+ { pass "run \"r\" abbreviation" }
+ -re "Starting program: .*No executable specified, use .target exec.\\..*$gdb_prompt $"\
+ { pass "run \"r\" abbreviation" }
+ -re "Starting program: .*No image loaded into target.*$gdb_prompt $"\
+ { pass "run \"r\" abbreviation" }
+ -re "Starting program: .*No program loaded.*$gdb_prompt $"\
+ { pass "run \"r\" abbreviation" }
+ -re "Don't know how to run. Try \"help target\"..*$gdb_prompt $"\
+ { pass "run \"r\" abbreviation" }
+ }
}
#test run
@@ -449,27 +425,20 @@ You must specify a function name to run,
gdb_test "set args main" "" ""
} else {
- send_gdb "run\n"
- gdb_expect {
- -re "Starting program:.*You can't do that when your target is `None'.*$gdb_prompt $" { pass "run" }
- -re "Starting program: .*
-No executable file specified.*
-Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
- { pass "run" }
- -re "Starting program: .*
-No executable specified, use .target exec.\\..*$gdb_prompt $"\
- { pass "run" }
- -re "Starting program: .*
-No image loaded into target.*$gdb_prompt $"\
- { pass "run" }
- -re "Starting program: .*
-No program loaded.*$gdb_prompt $"\
- { pass "run \"r\" abbreviation" }
- -re "Don't know how to run. Try \"help target\"..*$gdb_prompt $"\
- { pass "run" }
- -re ".*$gdb_prompt $" { fail "run" }
- timeout { fail "(timeout) run" }
- }
+ gdb_test_multiple "run" "run" {
+ -re "Starting program:.*You can't do that when your target is `None'.*$gdb_prompt $"\
+ { pass "run" }
+ -re "Starting program: .*No executable file specified.*Use the \"file\" or \"exec-file\" command.*$gdb_prompt $"\
+ { pass "run" }
+ -re "Starting program: .*No executable specified, use .target exec.\\..*$gdb_prompt $"\
+ { pass "run" }
+ -re "Starting program: .*No image loaded into target.*$gdb_prompt $"\
+ { pass "run" }
+ -re "Starting program: .*No program loaded.*$gdb_prompt $"\
+ { pass "run" }
+ -re "Don't know how to run. Try \"help target\"..*$gdb_prompt $"\
+ { pass "run" }
+ }
}
#test rbreak
@@ -758,34 +727,20 @@ gdb_test "u" "The program is not being r
gdb_test "until" "The program is not being run." "until"
#test undisplay
# FIXME -- need to dump full output to detailed log
-send_gdb "undisplay\n"
-gdb_expect {
- -re "Delete all auto-display expressions.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re "$gdb_prompt $" { pass "undisplay prompt" }
- timeout { fail "(timeout) (timeout) undisplay prompt" }
- }
- }
- timeout { fail "(timeout) (timeout) undisplay prompt" }
-}
+
+gdb_test "undisplay" \
+ "" \
+ "undisplay prompt" \
+ "Delete all auto-display expressions.*y or n. $" \
+ "y"
#test unset environment
-send_gdb "unset environment\n"
-gdb_expect {
- -re "Delete all environment variables?.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re "$gdb_prompt $" { pass "unset environmentprompt" }
- timeout {
- fail "(timeout) (timeout) unset environment prompt"
- }
- }
- }
- timeout {
- fail "(timeout) (timeout) unset environment prompt"
- }
-}
+
+gdb_test "unset environment" \
+ "" \
+ "unset environment prompt" \
+ "Delete all environment variables?.*y or n. $" \
+ "y"
#test unset
gdb_test "unset" "\"unset\" must be followed by the name of an unset subcommand.(\[^\r\n\]*\[\r\n\])+List of unset subcommands:(\[^\r\n\]*\[\r\n\])+unset environment -- Cancel environment variable VAR for the program(\[^\r\n\]*\[\r\n\])+Type \"help unset\" followed by unset subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "unset"
Index: define.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/define.exp,v
retrieving revision 1.16
diff -u -p -r1.16 define.exp
--- define.exp 5 May 2010 18:06:57 -0000 1.16
+++ define.exp 21 May 2010 22:19:27 -0000
@@ -59,69 +59,37 @@ if ![runto_main] then { fail "define tes
# Verify that GDB allows a user to define their very own commands.
#
-send_gdb "define nextwhere\n"
-gdb_expect {
- -re "Type commands for definition of \"nextwhere\".\r\nEnd with a line saying just \"end\".\r\n>$"\
- {send_gdb "next\nbt\nend\n"
- gdb_expect {
- -re "$gdb_prompt $"\
- {pass "define user command: nextwhere"}
- timeout {fail "(timeout) define user command: nextwhere"}
- }
- }
- -re "$gdb_prompt $"\
- {fail "define user command: nextwhere"}
- timeout {fail "(timeout) define user command: nextwhere"}
+gdb_test_multiple "define nextwhere" "define user command: nextwhere" {
+ -re "Type commands for definition of \"nextwhere\".\r\nEnd with a line saying just \"end\".\r\n>$" {
+ gdb_test "next\nbt\nend" "" \
+ "define user command: nextwhere"
+ }
}
# Verify that those commands work as gdb_expected.
#
-send_gdb "nextwhere\n"
-gdb_expect {
- -re ".*$bp_location1\[ \t\]*printf.*#0\[ \t\]*main.*:$bp_location1.*$gdb_prompt $"\
- {pass "use user command: nextwhere"}
- -re "$gdb_prompt $"\
- {fail "use user command: nextwhere"}
- timeout {fail "(timeout) use user command: nextwhere"}
-}
+gdb_test "nextwhere" \
+ "$bp_location1\[ \t\]*printf.*#0\[ \t\]*main.*:$bp_location1.*" \
+ "use user command: nextwhere"
# Verify that a user can define a command whose spelling is a
# proper substring of another user-defined command.
#
-send_gdb "define nextwh\n"
-gdb_expect {
- -re "Type commands for definition of \"nextwh\".\r\nEnd with a line saying just \"end\".\r\n>$"\
- {send_gdb "next 2\nbt\nend\n"
- gdb_expect {
- -re "$gdb_prompt $"\
- {pass "define user command: nextwh"}
- timeout {fail "(timeout) define user command: nextwh"}
- }
- }
- -re "$gdb_prompt $"\
- {fail "define user command: nextwh"}
- timeout {fail "(timeout) define user command: nextwh"}
+gdb_test_multiple "define nextwh" "define user command: nextwh" {
+ -re "Type commands for definition of \"nextwh\".\r\nEnd with a line saying just \"end\".\r\n>$" {
+ gdb_test "next 2\nbt\nend" "" \
+ "define user command: nextwh"
+ }
}
# Verify that a user can redefine their commands. (Test both the
# confirmed and unconfirmed cases.)
#
-send_gdb "define nextwhere\n"
-gdb_expect {
- -re "Redefine command \"nextwhere\".*y or n. $"\
- {send_gdb "n\n"
- gdb_expect {
- -re "Command \"nextwhere\" not redefined.*$gdb_prompt $"\
- {pass "redefine user command aborted: nextwhere"}
- -re "$gdb_prompt $"\
- {fail "redefine user command aborted: nextwhere"}
- timeout {fail "(timeout) redefine user command aborted: nextwhere"}
- }
- }
- -re "$gdb_prompt $"\
- {fail "redefine user command aborted: nextwhere"}
- timeout {fail "(timeout) redefine user command aborted: nextwhere"}
-}
+gdb_test "define nextwhere" \
+ "Command \"nextwhere\" not redefined.*" \
+ "redefine user command aborted: nextwhere" \
+ "Redefine command \"nextwhere\".*y or n. $" \
+ "n"
send_gdb "define nextwhere\n"
gdb_expect {
@@ -147,81 +115,45 @@ gdb_expect {
# Verify that GDB gracefully handles an attempt to redefine the
# help text for a builtin command.
#
-send_gdb "document step\n"
-gdb_expect {
- -re "Command \"step\" is built-in..*$gdb_prompt $"\
- {pass "redocumenting builtin command disallowed"}
- -re "$gdb_prompt $"\
- {fail "redocumenting builtin command disallowed"}
- timeout {fail "(timeout) redocumenting builtin command disallowed"}
-}
+gdb_test "document step" "Command \"step\" is built-in.*" \
+ "redocumenting builtin command disallowed"
# Verify that a user can document their own commands. (And redocument
# them.)
#
-send_gdb "document nextwhere\n"
-gdb_expect {
- -re "Type documentation for \"nextwhere\".\r\nEnd with a line saying just \"end\".\r\n>$"\
- {send_gdb "A next command that frist shows you where you're stepping from.\nend\n"
- gdb_expect {
- -re "$gdb_prompt $"\
- {pass "document user command: nextwhere"}
- timeout {fail "(timeout) document user command: nextwhere"}
- }
- }
- -re "$gdb_prompt $"\
- {fail "document user command: nextwhere"}
- timeout {fail "(timeout) document user command: nextwhere"}
+gdb_test_multiple "document nextwhere" "document user command: nextwhere" {
+ -re "Type documentation for \"nextwhere\".\r\nEnd with a line saying just \"end\".\r\n>$" {
+ gdb_test "A next command that first shows you where you're stepping from.\nend" \
+ "" \
+ "document user command: nextwhere"
+ }
}
-send_gdb "document nextwhere\n"
-gdb_expect {
- -re "Type documentation for \"nextwhere\".\r\nEnd with a line saying just \"end\".\r\n>$"\
- {send_gdb "A next command that first shows you where you're stepping from.\nend\n"
- gdb_expect {
- -re "$gdb_prompt $"\
- {pass "re-document user command: nextwhere"}
- timeout {fail "(timeout) re-document user command: nextwhere"}
- }
- }
- -re "$gdb_prompt $"\
- {fail "re-document user command: nextwhere"}
- timeout {fail "(timeout) re-document user command: nextwhere"}
+gdb_test_multiple "document nextwhere" "re-document user command: nextwhere" {
+ -re "Type documentation for \"nextwhere\".\r\nEnd with a line saying just \"end\".\r\n>$" {
+ gdb_test "A next command that first shows you where you're stepping from.\nend" \
+ "" \
+ "re-document user command: nextwhere"
+ }
}
-send_gdb "help nextwhere\n"
-gdb_expect {
- -re "A next command that first shows you where you're stepping from.\r\n$gdb_prompt $"\
- {pass "help user command: nextwhere"}
- -re "$gdb_prompt $"\
- {fail "help user command: nextwhere"}
- timeout {fail "(timeout) help user command: nextwhere"}
-}
+gdb_test "help nextwhere" \
+ "A next command that first shows you where you're stepping from.*" \
+ "help user command: nextwhere"
# Verify that the document command preserves whitespace in the beginning of the line.
#
-send_gdb "document nextwhere\n"
-gdb_expect {
- -re "Type documentation for \"nextwhere\".\r\nEnd with a line saying just \"end\".\r\n>$"\
- {send_gdb " A next command that first shows you where you're stepping from.\nend\n"
- gdb_expect {
- -re "$gdb_prompt $" {}
- timeout {fail "(timeout) preserve whitespace in help string"}
- }
- }
- -re "$gdb_prompt $"\
- {fail "preserve whitespace in help string"}
- timeout {fail "(timeout) preserve whitespace in help string"}
+gdb_test_multiple "document nextwhere" "set up whitespace in help string" {
+ -re "Type documentation for \"nextwhere\".\r\nEnd with a line saying just \"end\".\r\n>$" {
+ gdb_test " A next command that first shows you where you're stepping from.\nend" \
+ "" \
+ "set up whitespace in help string"
+ }
}
-send_gdb "help nextwhere\n"
-gdb_expect {
- -re " A next command that first shows you where you're stepping from.\r\n$gdb_prompt $"\
- {pass "preserve whitespace in help string"}
- -re "$gdb_prompt $"\
- {fail "preserve whitespace in help string"}
- timeout {fail "(timeout) preserve whitespace in help string"}
-}
+gdb_test "help nextwhere" \
+ " A next command that first shows you where you're stepping from.*" \
+ "preserve whitespace in help string"
# Verify that the command parser doesn't require a space after an 'if'
# command in a user defined function.
@@ -261,65 +193,34 @@ gdb_test "whilenospace" ".*hi there.*" "
# hook the "stop" pseudo command, and we'll define it to use a user-
# define command.
#
-send_gdb "define user-bt\n"
-gdb_expect {
- -re "Type commands for definition of \"user-bt\".\r\nEnd with a line saying just \"end\".\r\n>$"\
- {send_gdb "bt\nend\n"
- gdb_expect {
- -re "$gdb_prompt $"\
- {pass "define user command: user-bt"}
- timeout {fail "(timeout) define user command: user-bt"}
- }
- }
- -re "$gdb_prompt $"\
- {fail "define user command: user-bt"}
- timeout {fail "(timeout) define user command: user-bt"}
+gdb_test_multiple "define user-bt" "define user command: user-bt" {
+ -re "Type commands for definition of \"user-bt\".\r\nEnd with a line saying just \"end\".\r\n>$" {
+ gdb_test "bt\nend" \
+ "" \
+ "define user command: user-bt"
+ }
}
-send_gdb "define hook-stop\n"
-gdb_expect {
- -re "Type commands for definition of \"hook-stop\".\r\nEnd with a line saying just \"end\".\r\n>$"\
- {send_gdb "user-b\nend\n"
- gdb_expect {
- -re "$gdb_prompt $"\
- {pass "define hook-stop command"}
- timeout {fail "(timeout) define hook-stop command"}
- }
- }
- -re "$gdb_prompt $"\
- {fail "define hook-stop command"}
- timeout {fail "(timeout) define hook-stop command"}
+gdb_test_multiple "define hook-stop" "define hook-stop command" {
+ -re "Type commands for definition of \"hook-stop\".\r\nEnd with a line saying just \"end\".\r\n>$" {
+ gdb_test "user-b\nend" \
+ "" \
+ "define hook-stop command"
+ }
}
-send_gdb "next\n"
-gdb_expect {
- -re "#0\[ \t\]*main.*:$bp_location11.*$gdb_prompt $"\
- {pass "use hook-stop command"}
- -re "$gdb_prompt $"\
- {fail "use hook-stop command"}
- timeout {fail "(timeout) use hook-stop command"}
-}
+gdb_test "next" "#0\[ \t\]*main.*:$bp_location11.*" \
+ "use hook-stop command"
# Verify that GDB responds gracefully to an attempt to define a "hook
# command" which doesn't exist. (Test both the confirmed and unconfirmed
# cases.)
#
-send_gdb "define hook-bar\n"
-gdb_expect {
- -re "warning: Your new `hook-bar' command does not hook any existing command.\r\nProceed.*y or n. $"\
- {send_gdb "n\n"
- gdb_expect {
- -re "Not confirmed.*$gdb_prompt $"\
- {pass "define hook undefined command aborted: bar"}
- -re "$gdb_prompt $"\
- {fail "define hook undefined command aborted: bar"}
- timeout {fail "(timeout) define hook undefined command aborted: bar"}
- }
- }
- -re "$gdb_prompt $"\
- {fail "define hook undefined command aborted: bar"}
- timeout {fail "(timeout) define hook undefined command aborted: bar"}
-}
+gdb_test "define hook-bar" \
+ "Not confirmed.*" \
+ "define hook undefined command aborted: bar" \
+ "warning: Your new `hook-bar' command does not hook any existing command.\r\nProceed.*y or n. $" \
+ "n"
send_gdb "define hook-bar\n"
gdb_expect {
@@ -378,20 +279,16 @@ gdb_test "target testsuite" "one\r\nhell
# This is a quasi-define command: Verify that the user can redefine
# GDB's gdb_prompt.
#
-send_gdb "set prompt \\(blah\\) \n"
-gdb_expect {
- -re "\\(blah\\) $"\
- {pass "set gdb_prompt"}
- -re "$gdb_prompt $"\
- {fail "set gdb_prompt"}
- timeout {fail "(timeout) set gdb_prompt"}
+gdb_test_multiple "set prompt \\(blah\\) " "set gdb_prompt" {
+ -re "\\(blah\\) $" {
+ pass "set gdb_prompt"
+ }
}
-send_gdb "set prompt \\(gdb\\) \n"
-gdb_expect {
- -re "$gdb_prompt $"\
- {pass "reset gdb_prompt"}
- timeout {fail "(timeout) reset gdb_prompt"}
+gdb_test_multiple "set prompt \\(gdb\\) " "reset gdb_prompt" {
+ -re "$gdb_prompt $" {
+ pass "reset gdb_prompt"
+ }
}
gdb_exit
Index: display.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/display.exp,v
retrieving revision 1.21
diff -u -p -r1.21 display.exp
--- display.exp 1 Jan 2010 07:32:00 -0000 1.21
+++ display.exp 21 May 2010 22:19:27 -0000
@@ -112,28 +112,12 @@ gdb_test "info disp" ".*Auto-display
gdb_test "cont" ".*\[Ww\]atch.*5.1415.*.*i = 0.*" "next hit"
-send_gdb "undisp\n"
-gdb_expect {
- -re ".*Delete all auto-display expressions.*y or n. $" {
- send_gdb "y\n"
- gdb_expect {
- -re "y\r\n$gdb_prompt $" {
- pass "undisp all"
- }
- -re ".*$gdb_prompt $" {
- fail "some un-helpful response"
- }
- -re ".*Delete all.*$" {
- fail "re-ask question"
- }
- timeout { fail "timeout" }
- }
- }
- -re ".*$gdb_prompt $" {
- fail "undisp all"
- }
- timeout { fail "timeout" }
-}
+gdb_test "undisp" \
+ "" \
+ "undisp all" \
+ ".*Delete all auto-display expressions.*y or n. $" \
+ "y"
+
gdb_test "disab 3" ".*.*" "disab 3"
gdb_test "cont" ".*Breakpoint 4.*" "watch off"
@@ -144,8 +128,7 @@ gdb_test "cont" ".*Breakpoint 4.*" "watc
# targets, including but not limited to the m68k, i386 & PA. So we
# have to arrange to step until we hit the line with the call to
# "do_vars".
-send_gdb "finish\n"
-gdb_expect {
+gdb_test_multiple "finish" "finish" {
-re ".*do_loops\\(\\);.*$gdb_prompt $" {
send_gdb "step\n"
exp_continue
@@ -153,14 +136,6 @@ gdb_expect {
-re ".*do_vars.*$gdb_prompt $" {
pass "finish"
}
- -re ".*$gdb_prompt $" {
- fail "finish"
- gdb_suppress_tests
- }
- timeout {
- fail "(timeout) finish"
- gdb_suppress_tests
- }
}
gdb_test "step" ".*do_vars.*.*i = 9.*"
Index: dump.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/dump.exp,v
retrieving revision 1.20
diff -u -p -r1.20 dump.exp
--- dump.exp 5 May 2010 18:06:57 -0000 1.20
+++ dump.exp 21 May 2010 22:19:27 -0000
@@ -77,15 +77,11 @@ if { ! [ runto checkpoint1 ] } then {
# Get the endianness for the later use with endianless formats.
-send_gdb "show endian\n"
-gdb_expect {
+gdb_test_multiple "show endian" "show endian" {
-re ".* (big|little) endian.*$gdb_prompt $" {
set endian $expect_out(1,string)
pass "endianness: $endian"
}
- default {
- fail "(timeout) getting target endianness"
- }
}
# Now generate some dump files.
@@ -93,13 +89,11 @@ gdb_expect {
proc make_dump_file { command msg } {
global gdb_prompt
- send_gdb "${command}\n"
- gdb_expect {
+ gdb_test_multiple "${command}" "$msg" {
-re ".*\[Ee\]rror.*$gdb_prompt $" { fail $msg }
-re ".*\[Ww\]arning.*$gdb_prompt $" { fail $msg }
-re ".*\[Uu\]ndefined .*$gdb_prompt $" { fail $msg }
- -re ".*$gdb_prompt $" { pass $msg }
- timeout { fail "$msg (timeout)" }
+ -re ".*$gdb_prompt $" { pass $msg }
}
}
@@ -210,14 +204,10 @@ gdb_file_cmd ${binfile}
# Now fix the endianness at the correct state.
-send_gdb "set endian $endian\n"
-gdb_expect {
+gdb_test_multiple "set endian $endian" "set endianness" {
-re ".* (big|little) endian.*$gdb_prompt $" {
pass "setting $endian endianness"
}
- default {
- fail "(timeout) setting $endian endianness"
- }
}
# Reload saved values one by one, and compare.
Index: ending-run.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/ending-run.exp,v
retrieving revision 1.41
diff -u -p -r1.41 ending-run.exp
--- ending-run.exp 24 Mar 2010 21:28:14 -0000 1.41
+++ ending-run.exp 21 May 2010 22:19:27 -0000
@@ -51,17 +51,13 @@ gdb_run_cmd
gdb_test "" ".*Breakpoint.*1.*callee.*14.*" "run"
gdb_test "cle" ".*Deleted breakpoints 1 2.*" "clear worked"
-send_gdb "i b\n"
-gdb_expect {
+gdb_test_multiple "i b" "cleared bp at line before routine" {
-re ".* breakpoint .* breakpoint .*$gdb_prompt $" {
fail "cleared bp at line before routine"
}
-re ".*3.*main.*31.*$gdb_prompt $" {
pass "cleared bp at line before routine"
}
- -re ".*$gdb_prompt $" {
- fail "cleared bp at line before routine (info b)"
- }
}
# Test some other "clear" combinations
@@ -71,8 +67,7 @@ gdb_test "b ending-run.c:14" ".*Note.*al
gdb_test "cle ending-run.c:14" \
".*Deleted breakpoint 5.*" "Cleared 2 by line"
-send_gdb "info line ending-run.c:14\n"
-gdb_expect {
+gdb_test_multiple "info line ending-run.c:14" "" {
-re ".*address (0x\[0-9a-fA-F]*).*$gdb_prompt $" {
set line_nine $expect_out(1,string)
gdb_test "b ending-run.c:14" ".*Breakpoint 6.*ending-run.c, line 14.*"
@@ -84,8 +79,7 @@ gdb_expect {
}
}
-send_gdb "i b\n"
-gdb_expect {
+gdb_test_multiple "i b" "all set to continue" {
-re ".* breakpoint .* breakpoint .*$gdb_prompt $" {
fail "all set to continue (didn't clear bps)"
}
@@ -117,9 +111,9 @@ if ![gdb_skip_stdio_test "Step to return
set old_timeout $timeout
set timeout 50
set program_exited 0
-send_gdb "next\n"
set nexted 0
-gdb_expect {
+
+gdb_test_multiple "next" "step out of main" {
-re "33\[ \t\]+\}.*$gdb_prompt $" {
# sometimes we stop at the closing brace, if so, do another next
if { $nexted } {
@@ -201,8 +195,6 @@ gdb_expect {
-re ".*Program received signal SIGTRAP.*$gdb_prompt $" {
pass "step out of main"
}
- -re ".*$gdb_prompt $" { fail "step out of main" }
- timeout { fail "step out of main" }
}
# When we're talking to a program running on a real stand-alone board,
@@ -216,8 +208,7 @@ if {! [target_info exists use_gdb_stub]
&& (! [target_info exists use_cygmon] || ! [target_info use_cygmon])} {
global program_exited;
if {[eval expr $program_exited == 0]} {
- send_gdb "n\n"
- gdb_expect {
+ gdb_test_multiple "n" "step to end of run" {
-re "Program exited normally.*$gdb_prompt $" {
# If we actually have debug info for the start function,
# then we won't get the "Single-stepping until function
@@ -246,14 +237,6 @@ if {! [target_info exists use_gdb_stub]
set program_exited_normally 1
}
}
- -re ".*$gdb_prompt $" {
- fail "step to end of run"
- set program_not_exited 1
- }
- timeout {
- fail "(timeout) step to end of run"
- set program_not_exited 1
- }
}
}
Index: eval-skip.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/eval-skip.exp,v
retrieving revision 1.10
diff -u -p -r1.10 eval-skip.exp
--- eval-skip.exp 1 Jan 2010 07:32:00 -0000 1.10
+++ eval-skip.exp 21 May 2010 22:19:27 -0000
@@ -65,278 +65,87 @@ gdb_test "set variable y=2" "" "set vari
gdb_test "set variable z=2" "" "set variable z=2"
gdb_test "set variable w=3" "" "set variable w=3"
-send_gdb "print (0 && (x+y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x+y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x+y))" }
- timeout { fail "(timeout) print value of (0 && (x+y))" }
- }
-
-
-send_gdb "print (0 && (x-y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x-y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x-y))" }
- timeout { fail "(timeout) print value of (0 && (x-y))" }
- }
-
-
-send_gdb "print (0 && (x*y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x*y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x*y))" }
- timeout { fail "(timeout) print value of (0 && (x*y))" }
- }
-
-
-
-send_gdb "print (0 && (x/y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x/y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x/y))" }
- timeout { fail "(timeout) print value of (0 && (x/y))" }
- }
-
-
-send_gdb "print (0 && (x%y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x%y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x%y))" }
- timeout { fail "(timeout) print value of (0 && (x%y))" }
- }
-
-
-send_gdb "print (0 && (x&&y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x&&y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x&&y))" }
- timeout { fail "(timeout) print value of (0 && (x&&y))" }
- }
-
-
-
-send_gdb "print (0 && (x||y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x||y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x||y))" }
- timeout { fail "(timeout) print value of (0 && (x||y))" }
- }
-
-
-
-send_gdb "print (0 && (x&y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x&y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x&y))" }
- timeout { fail "(timeout) print value of (0 && (x&y))" }
- }
-
-
-send_gdb "print (0 && (x|y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x|y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x|y))" }
- timeout { fail "(timeout) print value of (0 && (x|y))" }
- }
-
-
-send_gdb "print (0 && (x^y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x^y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x^y))" }
- timeout { fail "(timeout) print value of (0 && (x^y))" }
- }
-
-
-
-send_gdb "print (0 && (x < y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x < y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x < y))" }
- timeout { fail "(timeout) print value of (0 && (x < y))" }
- }
-
-
-send_gdb "print (0 && (x <= y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x <= y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x <= y))" }
- timeout { fail "(timeout) print value of (0 && (x <= y))" }
- }
-
-
-
-send_gdb "print (0 && (x>y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x>y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x>y))" }
- timeout { fail "(timeout) print value of (0 && (x>y))" }
- }
-
-
-send_gdb "print (0 && (x>=y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x>=y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x>=y))" }
- timeout { fail "(timeout) print value of (0 && (x>=y))" }
- }
-
-
-
-send_gdb "print (0 && (x==y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x==y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x==y))" }
- timeout { fail "(timeout) print value of (0 && (x==y))" }
- }
-
-
-send_gdb "print (0 && (x!=y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x!=y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x!=y))" }
- timeout { fail "(timeout) print value of (0 && (x!=y))" }
- }
-
-
-send_gdb "print (0 && (x<<31))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x<<31))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x<<31))" }
- timeout { fail "(timeout) print value of (0 && (x<<31))" }
- }
-
-
-send_gdb "print (0 && (x>>31))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x>>31))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x>>31))" }
- timeout { fail "(timeout) print value of (0 && (x>>31))" }
- }
-
-
-
-send_gdb "print (0 && (!x))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (!x))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (!x))" }
- timeout { fail "(timeout) print value of (0 && (!x))" }
- }
-
-
-send_gdb "print (0 && (~x))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (~x))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (~x))" }
- timeout { fail "(timeout) print value of (0 && (~x))" }
- }
-
-send_gdb "print (0 && (-x))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (-x))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (-x))" }
- timeout { fail "(timeout) print value of (0 && (-x))" }
- }
-
-
-send_gdb "print (0 && (x++))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x++))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x++))" }
- timeout { fail "(timeout) print value of (0 && (x++))" }
- }
-
-
-send_gdb "print (0 && (++x))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (++x))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (++x))" }
- timeout { fail "(timeout) print value of (0 && (++x))" }
- }
-
-
-send_gdb "print (0 && (x--))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x--))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x--))" }
- timeout { fail "(timeout) print value of (0 && (x--))" }
- }
-
-
-send_gdb "print (0 && (--x))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (--x))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (--x))" }
- timeout { fail "(timeout) print value of (0 && (--x))" }
- }
-
-send_gdb "print (0 && (x+=7))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x+=7))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x+=7))" }
- timeout { fail "(timeout) print value of (0 && (x+=7))" }
- }
-
-send_gdb "print (0 && (x=y))\n"
-gdb_expect {
- -re ".$decimal = $false\r\n$gdb_prompt $" {
- pass "print value of (0 && (x=y))"
- }
- -re ".*$gdb_prompt $" { fail "print value of (0 && (x=y))" }
- timeout { fail "(timeout) print value of (0 && (x=y))" }
- }
+gdb_test "print (0 && (x+y))" ".$decimal = $false" \
+ "print value of (0 && (x+y))"
+
+gdb_test "print (0 && (x-y))" ".$decimal = $false" \
+ "print value of (0 && (x-y))"
+
+gdb_test "print (0 && (x*y))" ".$decimal = $false" \
+ "print value of (0 && (x*y))"
+
+gdb_test "print (0 && (x/y))" ".$decimal = $false" \
+ "print value of (0 && (x/y))"
+
+gdb_test "print (0 && (x%y))" ".$decimal = $false" \
+ "print value of (0 && (x%y))"
+
+gdb_test "print (0 && (x&&y))" ".$decimal = $false" \
+ "print value of (0 && (x&&y))"
+
+gdb_test "print (0 && (x||y))" ".$decimal = $false" \
+ "print value of (0 && (x||y))"
+
+gdb_test "print (0 && (x&y))" ".$decimal = $false" \
+ "print value of (0 && (x&y))"
+
+gdb_test "print (0 && (x|y))" ".$decimal = $false" \
+ "print value of (0 && (x|y))"
+
+gdb_test "print (0 && (x^y))" ".$decimal = $false" \
+ "print value of (0 && (x^y))"
+
+gdb_test "print (0 && (x < y))" ".$decimal = $false" \
+ "print value of (0 && (x < y))"
+
+gdb_test "print (0 && (x <= y))" ".$decimal = $false" \
+ "print value of (0 && (x <= y))"
+
+gdb_test "print (0 && (x>y))" ".$decimal = $false" \
+ "print value of (0 && (x>y))"
+
+gdb_test "print (0 && (x>=y))" ".$decimal = $false" \
+ "print value of (0 && (x>=y))"
+
+gdb_test "print (0 && (x==y))" ".$decimal = $false" \
+ "print value of (0 && (x==y))"
+
+gdb_test "print (0 && (x!=y))" ".$decimal = $false" \
+ "print value of (0 && (x!=y))"
+
+gdb_test "print (0 && (x<<31))" ".$decimal = $false" \
+ "print value of (0 && (x<<31))"
+
+gdb_test "print (0 && (x>>31))" ".$decimal = $false" \
+ "print value of (0 && (x>>31))"
+
+gdb_test "print (0 && (!x))" ".$decimal = $false" \
+ "print value of (0 && (!x))"
+
+gdb_test "print (0 && (~x))" ".$decimal = $false" \
+ "print value of (0 && (~x))"
+
+gdb_test "print (0 && (-x))" ".$decimal = $false" \
+ "print value of (0 && (-x))"
+
+gdb_test "print (0 && (x++))" ".$decimal = $false" \
+ "print value of (0 && (x++))"
+
+gdb_test "print (0 && (++x))" ".$decimal = $false" \
+ "print value of (0 && (++x))"
+
+gdb_test "print (0 && (x--))" ".$decimal = $false" \
+ "print value of (0 && (x--))"
+
+gdb_test "print (0 && (--x))" ".$decimal = $false" \
+ "print value of (0 && (--x))"
+
+gdb_test "print (0 && (x+=7))" ".$decimal = $false" \
+ "print value of (0 && (x+=7))"
+
+gdb_test "print (0 && (x=y))" ".$decimal = $false" \
+ "print value of (0 && (x=y))"
+
gdb_exit
return 0
Index: exprs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/exprs.exp,v
retrieving revision 1.17
diff -u -p -r1.17 exprs.exp
--- exprs.exp 5 May 2010 18:06:57 -0000 1.17
+++ exprs.exp 21 May 2010 22:19:27 -0000
@@ -225,8 +225,8 @@ test_expr "set variable v_unsigned_long
# sizeof(long long) and sizeof(void*) are
# the same size so this test can not work.
#
-send_gdb "print sizeof (long long) > sizeof (long)\n"
-gdb_expect {
+gdb_test_multiple "print sizeof (long long) > sizeof (long)" \
+ "sizeof long long > sizeof long" {
-re "\\$\[0-9\]* = $true.*$gdb_prompt" {
set ok 1
pass "sizeof (long long) > sizeof (long) (true)"
@@ -235,10 +235,6 @@ gdb_expect {
set ok 0
pass "sizeof (long long) > sizeof (long) (false)"
}
- timeout {
- set ok 0
- fail "sizeof (long long) > sizeof (long) (timeout)"
- }
}
if [expr ! $ok] { setup_xfail "*-*-*" }
gdb_test "print (void*) ((long long) (unsigned long) -1 + 1)" \