+2014-09-12 Pedro Alves <palves@redhat.com>
+
+ * gdb.arch/gdb1558.exp: Replace uses of gdb_expect after
+ gdb_run_cmd with gdb_test_multiple or gdb_test throughout.
+ * gdb.arch/i386-size-overlap.exp: Likewise.
+ * gdb.arch/i386-size.exp: Likewise.
+ * gdb.arch/i386-unwind.exp: Likewise.
+ * gdb.base/a2-run.exp: Likewise.
+ * gdb.base/break.exp: Likewise.
+ * gdb.base/charset.exp: Likewise.
+ * gdb.base/chng-syms.exp: Likewise.
+ * gdb.base/commands.exp: Likewise.
+ * gdb.base/dbx.exp: Likewise.
+ * gdb.base/find.exp: Likewise.
+ * gdb.base/funcargs.exp: Likewise.
+ * gdb.base/jit-simple.exp: Likewise.
+ * gdb.base/reread.exp: Likewise.
+ * gdb.base/sepdebug.exp: Likewise.
+ * gdb.base/step-bt.exp: Likewise.
+ * gdb.cp/mb-inline.exp: Likewise.
+ * gdb.cp/mb-templates.exp: Likewise.
+ * gdb.objc/basicclass.exp: Likewise.
+ * gdb.threads/killed.exp: Likewise.
+
2014-09-12 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
PR tdep/17379
gdb_run_cmd
-gdb_expect 30 {
+set test "Hits breakpoint at main after function called from main"
+gdb_test_multiple "" $test {
-re "Breakpoint 1.*main .*$gdb_prompt $" {
- pass "Hits breakpoint at main after function called from main"
+ pass $test
}
-re "Breakpoint 2.*sub1 .*$gdb_prompt $" {
- kfail "gdb/1558" "Hits breakpoint at main after function called from main"
- }
- -re "$gdb_prompt $" {
- fail "Hits breakpoint at main after function called from main"
- }
- timeout {
- fail "Hits breakpoint at main after function called from main (timeout)"
+ kfail "gdb/1558" $test
}
}
# We use gdb_run_cmd so this stands a chance to work for remote
# targets too.
gdb_run_cmd
-
-gdb_expect {
- -re "Program received signal SIGTRAP.*$gdb_prompt $" {
- pass "run past main"
- }
- -re ".*$gdb_prompt $" {
- fail "run past main"
- }
- timeout {
- fail "run past main (timeout)"
- }
-}
+gdb_test "" "Program received signal SIGTRAP.*" "run past main"
set message "backtrace shows the outer function"
gdb_test_multiple "backtrace 10" $message {
# We use gdb_run_cmd so this stands a chance to work for remote
# targets too.
gdb_run_cmd
-
-gdb_expect {
- -re "Program received signal SIGTRAP.*$gdb_prompt $" {
- pass "run past main"
- }
- -re ".*$gdb_prompt $" {
- fail "run past main"
- }
- timeout {
- fail "run past main (timeout)"
- }
-}
+gdb_test "" "Program received signal SIGTRAP.*" "run past main"
set message "backtrace shows no function"
gdb_test_multiple "backtrace 10" $message {
# We use gdb_run_cmd so this stands a chance to work for remote
# targets too.
gdb_run_cmd
-
-gdb_expect {
- -re "Program received signal SIGTRAP.*$gdb_prompt $" {
- pass "run past gdb1435"
- }
- -re ".*$gdb_prompt $" {
- fail "run past gdb1435"
- }
- timeout {
- fail "run past gdb1435 (timeout)"
- }
-}
+gdb_test "" "Program received signal SIGTRAP.*" "run past gdb1435"
gdb_test "backtrace 10" \
"#1\[ \t]*$hex in gdb1435.*\r\n#2\[ \t\]*$hex in main.*" \
# On VxWorks this justs make sure the program was run.
gdb_run_cmd
+set test "run \"$testfile\" with no args"
+
if [istarget "*-*-vxworks*"] then {
- set timeout 120
- verbose "Timeout is now $timeout seconds" 2
- gdb_expect {
- "$inferior_exited_re normally" {
- unresolved "run \"$testfile\" with no args"
- }
- -re "usage: factorial <number>" {
- pass "run \"$testfile\" with no args"
- }
- timeout {
- fail "(timeout) run \"$testfile\" with no args"
- }
- }
- set timeout 10
- verbose "Timeout is now $timeout seconds" 2
- gdb_expect -re "$gdb_prompt $" {}
+ gdb_test "" "usage: factorial <number>.*" $test
} else {
- gdb_expect {
+ gdb_test_multiple "" $test {
-re ".*usage: factorial <number>.*$inferior_exited_re with code 01.\r\n$gdb_prompt $" {
- pass "run \"$testfile\" with no args"
+ pass $test
pass "no spurious messages at program exit"
}
-re ".*usage: factorial <number>.*$inferior_exited_re with code 01.*$gdb_prompt $" {
- pass "run \"$testfile\" with no args"
+ pass $test
fail "no spurious messages at program exit"
}
-re ".*usage: factorial <number>.* EXIT code 1.*$inferior_exited_re normally.\r\n$gdb_prompt $" {
- pass "run \"$testfile\" with no args (exit wrapper)"
+ pass "$test (exit wrapper)"
pass "no spurious messages at program exit"
}
-re ".*usage: factorial <number>.* EXIT code 1.*$inferior_exited_re normally.*$gdb_prompt $" {
- pass "run \"$testfile\" with no args (exit wrapper)"
+ pass "$test (exit wrapper)"
fail "no spurious messages at program exit"
}
- -re ".*$gdb_prompt $" {
- fail "run \"$testfile\" with no args"
- verbose "expect_out is $expect_out(buffer)" 2
- }
- timeout {
- fail "(timeout) run \"$testfile\" no args"
- }
}
}
verbose "Timeout is now $timeout seconds" 2
gdb_expect -re "$gdb_prompt $" {}
} else {
- setup_xfail "arm-*-coff"
- gdb_run_cmd 5
- gdb_expect {
- -re ".*120.*$gdb_prompt $"\
- { pass "run \"$testfile\" with arg" }
- -re ".*$gdb_prompt $" { fail "run \"$testfile\" with arg" }
- timeout { fail "(timeout) run \"$testfile\" with arg" }
- }
+ setup_xfail "arm-*-coff"
+ gdb_run_cmd 5
+ gdb_test "" "120.*" "run \"$testfile\" with arg"
}
# Run again with same arguments.
gdb_expect -re "$gdb_prompt $" {}
} else {
setup_xfail "arm-*-coff"
- gdb_expect {
- -re ".*120.*$gdb_prompt $"\
- { pass "run \"$testfile\" again with same args" }
- -re ".*$gdb_prompt $" { fail "run \"$testfile\" again with same args" }
- timeout { fail "(timeout) run \"$testfile\" again with same args" }
- }
+ gdb_test "" "120.*" "run \"$testfile\" again with same args"
}
# Use "set args" command to specify no arguments as default and run again.
verbose "Timeout is now $timeout seconds" 2
gdb_expect -re "$gdb_prompt $" {}
} else {
- gdb_expect {
- -re ".*usage: factorial <number>.*$gdb_prompt $" {
- pass "run after setting args to nil"
- }
- -re ".*$gdb_prompt $" {
- fail "run after setting args to nil"
- }
- timeout {
- fail "(timeout) run after setting args to nil"
- }
- }
+ gdb_test "" "usage: factorial <number>.*" "run after setting args to nil"
}
# Use "set args" command to specify an argument and run again.
gdb_expect -re "$gdb_prompt $" {}
} else {
setup_xfail "arm-*-coff"
- gdb_expect {
- -re ".*720.*$gdb_prompt $" {
- pass "run \"$testfile\" again after setting args"
- }
- -re ".*$gdb_prompt $" {
- fail "run \"$testfile\" again after setting args"
- }
- timeout {
- fail "(timeout) run \"$testfile\" again after setting args"
- }
- }
+ gdb_test "" "720.*" "run \"$testfile\" again after setting args"
}
# GOAL: Test that shell is being used with "run". For remote debugging
# run until the breakpoint at main is hit. For non-stubs-using targets.
#
gdb_run_cmd
-gdb_expect {
- -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $" {
- pass "run until function breakpoint"
- }
- -re "$gdb_prompt $" {
- fail "run until function breakpoint"
- }
- timeout {
- fail "run until function breakpoint (timeout)"
- }
-}
+gdb_test "" \
+ "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*" \
+ "run until function breakpoint"
# Test the 'list' commands sets current file for the 'break LINENO' command.
set bp_marker1 [gdb_get_line_number "set breakpoint 16 here" ${srcfile1}]
# Run until we call factorial with 6
gdb_run_cmd
- gdb_expect {
- -re "Break.* factorial .value=6. .*$gdb_prompt $" {}
- -re ".*$gdb_prompt $" {
- fail "run to factorial(6)"
- gdb_suppress_tests
- }
- timeout { fail "run to factorial(6) (timeout)" ; gdb_suppress_tests }
- }
+ gdb_test "" "Break.* factorial .value=6. .*" "run to factorial(6)"
# Continue until we call factorial recursively with 5.
# run until the breakpoint at main is hit. For non-stubs-using targets.
#
gdb_run_cmd
-gdb_expect {
+
+set test "run until function breakpoint, optimized file"
+gdb_test_multiple "" $test {
-re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $" {
- pass "run until function breakpoint, optimized file"
+ pass $test
}
-re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $" {
- pass "run until function breakpoint, optimized file (code motion)"
- }
- -re "$gdb_prompt $" {
- fail "run until function breakpoint, optimized file"
- }
- timeout {
- fail "run until function breakpoint, optimized file (timeout)"
+ pass "$test (code motion)"
}
}
# Run to a breakpoint. Fail if we see "Junk at end of arguments".
gdb_run_cmd
-gdb_expect {
+
+set test "rbreak junk"
+gdb_test_multiple "" $test {
-re "Junk at end of arguments" {
- fail "rbreak junk"
+ fail $test
}
-re ".*Breakpoint \[0-9\]+,.*$gdb_prompt $" {
- pass "rbreak junk"
- }
- timeout {
- fail "rbreak junk (timeout)"
+ pass $test
}
}
".*Breakpoint.* at .*" \
"set breakpoint after all strings have been initialized"
gdb_run_cmd
-gdb_expect {
- -re "Breakpoint.*all strings initialized.*$gdb_prompt $" {
- pass "run until all strings have been initialized"
- }
- -re "$gdb_prompt $" {
- fail "run until all strings have been initialized"
- }
- timeout {
- fail "run until all strings have been initialized (timeout)"
- }
-}
-
+gdb_test "" "Breakpoint.*all strings initialized.*" "run until all strings have been initialized"
# We only try the wide character tests on machines where the wchar_t
# typedef in the test case has the right size.
verbose "Timeout is now 10 seconds" 2
proc expect_to_stop_here { ident } {
- global gdb_prompt
- global decimal
-
# the "at foo.c:36" output we get with -g.
# the "in func" output we get without -g.
- gdb_expect {
- -re "Breakpoint \[0-9\]*, stop_here .*$gdb_prompt $" {
- return 1
- }
- -re "$gdb_prompt $" {
- fail "running to stop_here $ident"
- return 0
- }
- timeout {
- fail "running to stop_here $ident (timeout)"
- return 0
- }
- }
- return 1
+
+ gdb_test "" "Breakpoint \[0-9\]*, stop_here .*" "running to stop_here $ident"
}
clean_restart ${binfile}
} else {
gdb_run_cmd
- gdb_expect {
+
+ set test "running with invalidated bpt condition after executable changes"
+ gdb_test_multiple "" $test {
-re ".*$inferior_exited_re normally.*$gdb_prompt $" {
- pass "running with invalidated bpt condition after executable changes"
+ pass $test
}
-re ".*Breakpoint .*,( 0x.* in)? (\[^ \]*)exit .*$gdb_prompt $" {
- pass "running with invalidated bpt condition after executable changes"
- }
- -re "$gdb_prompt $" {
- fail "running with invalidated bpt condition after executable changes"
- }
- timeout {
- fail "(timeout) running with invalidated bpt condition after executable changes"
+ pass $test
}
}
"end commands"
gdb_run_cmd
- gdb_expect {
- -re ".*factorial command-list executed.*$gdb_prompt $" {
- pass "run factorial until breakpoint"
- }
- -re ".*$gdb_prompt $" {
- fail "run factorial until breakpoint"
- }
- default { fail "(timeout) run factorial until breakpoint" }
- timeout { fail "(timeout) run factorial until breakpoint" }
- }
+ gdb_test "" "factorial command-list executed.*" "run factorial until breakpoint"
}
proc temporary_breakpoint_commands {} {
"end tbreak commands"
gdb_run_cmd
- gdb_expect {
- -re ".*factorial tbreak commands executed.*$gdb_prompt $" {
- pass "run factorial until temporary breakpoint"
- }
- timeout { fail "(timeout) run factorial until temporary breakpoint" }
- }
+ gdb_test "" "factorial tbreak commands executed.*" \
+ "run factorial until temporary breakpoint"
}
# Test that GDB can handle $arg0 outside of user functions without
global gdb_prompt
gdb_run_cmd
- gdb_expect 30 {
- -re "Break.* at .*:$decimal.*$gdb_prompt $" { pass "running to main" }
- -re "Breakpoint \[0-9\]*, \[0-9xa-f\]* in .*$gdb_prompt $" { pass "running to main" }
- -re "$gdb_prompt $" { fail "running to main" }
- timeout { fail "running to main (timeout)" }
+ set test "running to main"
+ gdb_test_multiple "" $test {
+ -re "Break.* at .*:$decimal.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "Breakpoint \[0-9\]*, \[0-9xa-f\]* in .*$gdb_prompt $" {
+ pass $test
+ }
}
send_gdb "assign first=1\n"
gdb_expect {
"breakpoint function in file"
gdb_run_cmd
-gdb_expect {
- -re "Breakpoint \[0-9\]+,.*stop_here.* at .*$srcfile:.*$gdb_prompt $" {
- pass "run until function breakpoint"
- }
- -re "$gdb_prompt $" {
- fail "run until function breakpoint"
- }
- timeout {
- fail "run until function breakpoint (timeout)"
- }
-}
+gdb_test "" "Breakpoint \[0-9\]+,.*stop_here.* at .*$srcfile:.*" "run until function breakpoint"
# We've now got the target program in a state where we can test "find".
# Run; should stop at call0a and print actual arguments.
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
gdb_run_cmd
- gdb_expect {
- -re ".* call0a \\(c=97 'a', s=1, i=2, l=3\\) .*$gdb_prompt $" {
- pass "run to call0a"
- }
- -re "$gdb_prompt $" { fail "run to call0a" ; gdb_suppress_tests }
- timeout { fail "(timeout) run to call0a" ; gdb_suppress_tests }
- }
+ gdb_test "" " call0a \\(c=97 'a', s=1, i=2, l=3\\) .*" "run to call0a"
# Print each arg as a double check to see if we can print
# them here as well as with backtrace.
# Run; should stop at call1a and print actual arguments.
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
gdb_run_cmd
- gdb_expect {
- -re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$gdb_prompt $" {
- pass "run to call1a"
- }
- -re "$gdb_prompt $" { fail "run to call1a" ; gdb_suppress_tests; }
- timeout { fail "(timeout) run to call1a" ; gdb_suppress_tests; }
- }
+ gdb_test "" " call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*" "run to call1a"
# Print each arg as a double check to see if we can print
# them here as well as with backtrace.
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
gdb_run_cmd
- gdb_expect {
- -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { pass "run to call2a" }
- -re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { xfail "run to call2a" }
- -re "$gdb_prompt $" { fail "run to call2a" ; gdb_suppress_tests; }
- timeout { fail "(timeout) run to call2a" ; gdb_suppress_tests; }
+ set test "run to call2a"
+ gdb_test_multiple "" $test {
+ -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" {
+ pass $test
+ }
+ -re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" {
+ xfail $test
+ }
}
# Print each arg as a double check to see if we can print
# Run; should stop at call1a and print actual arguments.
gdb_run_cmd
- gdb_expect {
- -re ".* callca \\(f1=1 \\+ 2 \\* I, f2=1 \\+ 2 \\* I, f3=1 \\+ 2 \\* I\\) .*$gdb_prompt $" { pass "run to call2a" }
- timeout { fail "(timeout) run to callca" ; gdb_suppress_tests; }
- }
+ gdb_test "" " callca \\(f1=1 \\+ 2 \\* I, f2=1 \\+ 2 \\* I, f3=1 \\+ 2 \\* I\\) .*" "run to call2a"
+
gdb_test "cont" ".* callcb \\(d1=3 \\+ 4 \\* I, d2=3 \\+ 4 \\* I, d3=3 \\+ 4 \\* I\\) .*" "continue to callcb"
gdb_test "cont" ".* callcc \\(ld1=5 \\+ 6 \\* I, ld2=5 \\+ 6 \\* I, ld3=5 \\+ 6 \\* I\\) .*" "continue to callcc"
gdb_test "cont" ".* callcd \\(fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I\\) .*" "continue to callcd"
# Run; should stop at call1a and print actual arguments.
gdb_run_cmd
- gdb_expect {
- -re ".* callc1a \\(c=97 'a', s=1, i=2, ui=7, l=3, fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I\\) .*$gdb_prompt $" { pass "run to callc1a" }
- timeout { fail "(timeout) run to callc1a" ; gdb_suppress_tests; }
- }
+ gdb_test "" " callc1a \\(c=97 'a', s=1, i=2, ui=7, l=3, fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I\\) .*" "run to callc1a"
+
gdb_test "cont" ".* callc1b \\(ldc1=5 \\+ 6 \\* I\\, c=97 'a', s=1, i=2, fc1=1 \\+ 2 \\* I, ui=7, l=3, dc1=3 \\+ 4 \\* I\\) .*" "continue to callc1b"
}
# Run; should stop at call1a and print actual arguments.
gdb_run_cmd
- gdb_expect {
- -re ".* callc2a \\(c=97 'a', s=1, i=2, ui=7, l=3, f=4, d=5, fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I\\) .*$gdb_prompt $" { pass "run to callc2a" }
- timeout { fail "(timeout) run to callc1a" ; gdb_suppress_tests; }
- }
+ gdb_test "" " callc2a \\(c=97 'a', s=1, i=2, ui=7, l=3, f=4, d=5, fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I\\) .*" "run to callc2a"
+
gdb_test "cont" ".* callc2b \\(fc1=1 \\+ 2 \\* I, c=97 'a', s=1, i=2, ui=7, ldc1=5 \\+ 6 \\* I\\, l=3, f=4, d=5, dc1=3 \\+ 4 \\* I\\) .*" "continue to callc2b"
}
# Try dereferencing the arguments.
gdb_run_cmd
- gdb_expect {
- -re ".* call3a \\(cp=$hex <c> \"a.*\", sp=$hex <s>, ip=$hex <i>, lp=$hex <l>\\) .*$gdb_prompt $" { pass "run to call3a" }
- -re "$gdb_prompt $" { fail "run to call3a" ; gdb_suppress_tests; }
- timeout { fail "(timeout) run to call3a" ; gdb_suppress_tests; }
- }
+ gdb_test "" " call3a \\(cp=$hex <c> \"a.*\", sp=$hex <s>, ip=$hex <i>, lp=$hex <l>\\) .*" "run to call3a"
gdb_test "print *cp" ".* = 97 'a'"
gdb_test "print *sp" ".* = 1"
# Try dereferencing the arguments.
gdb_run_cmd
- gdb_expect {
- -re ".* call4a \\(stp=$hex <st>\\) .*$gdb_prompt $" {
- pass "run to call4a"
- }
- -re "$gdb_prompt $" { fail "run to call4a" ; gdb_suppress_tests; }
- timeout { fail "(timeout) run to call4a" ; gdb_suppress_tests; }
- }
+ gdb_test "" " call4a \\(stp=$hex <st>\\) .*" "run to call4a"
gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
# Try dereferencing the arguments.
gdb_run_cmd
- gdb_expect {
- -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$gdb_prompt $" {
- pass "run to call5a"
- }
- -re "$gdb_prompt $" { fail "run to call5a" ; gdb_suppress_tests; }
- timeout { fail "(timeout) run to call5a" ; gdb_suppress_tests; }
- }
+ gdb_test "" " call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*" "run to call5a"
gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
# Print backtrace.
gdb_run_cmd
- gdb_expect {
- -re ".*Breakpoint $decimal, call6a .*$gdb_prompt $" { pass "run to call6a" }
- -re "$gdb_prompt $" { fail "run to call6a" ; gdb_suppress_tests; }
- timeout { fail "(timeout) run to call6a" ; gdb_suppress_tests; }
- }
+ gdb_test "" "Breakpoint $decimal, call6a .*" "run to call6a"
setup_xfail "rs6000-*-*"
# Print backtrace.
gdb_run_cmd
- gdb_expect {
- -re ".*Breakpoint $decimal, call7a .*$gdb_prompt $" {
- pass "run to call7a"
- }
- -re "$gdb_prompt $" { fail "run to call7a" ; gdb_suppress_tests; }
- timeout { fail "(timeout) run to call7a" ; gdb_suppress_tests; }
- }
+ gdb_test "" "Breakpoint $decimal, call7a .*" "run to call7a"
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
gdb_test_multiple "backtrace 100" "backtrace from call7a" {
# Run; should stop at hitbottom and print actual arguments.
# Print backtrace.
gdb_run_cmd
- gdb_expect {
- -re ".*Breakpoint $decimal, hitbottom .*$gdb_prompt $" { pass "run to hitbottom" }
- -re "$gdb_prompt $" { fail "run to hitbottom" ; gdb_suppress_tests; }
- timeout { fail "(timeout) run to hitbottom" ; gdb_suppress_tests; }
- }
+ gdb_test "" "Breakpoint $decimal, hitbottom .*" "run to hitbottom"
if ![istarget sparclet-*-*] {
gdb_test_sequence "backtrace 100" "recursive passing of structs by value" {
global decimal gdb_prompt
gdb_run_cmd
- gdb_expect {
- -re "Inferior .* exited.*$gdb_prompt $" {
- pass $msg
- }
- -re ".*$gdb_prompt $" {
- fail $msg
- }
- }
+ gdb_test "" "Inferior .* exited.*" $msg
}
# Test re-running an inferior with a JIT descriptor, where the JIT
# Run, should see "Breakpoint 1, foo () at hello1.c:14"
gdb_run_cmd
-
-gdb_expect {
- -re ".*Breakpoint.* foo .* at .*$srcfile1:14.*$gdb_prompt $" {
- pass "run to foo()"
- }
- -re ".*$gdb_prompt $" {
- fail "run to foo()"
- gdb_suppress_tests
- }
- timeout { fail "run to foo() (timeout)" ; gdb_suppress_tests }
-}
+gdb_test "" "Breakpoint.* foo .* at .*$srcfile1:14.*" "run to foo()"
# Restore first executable to its original name, and move
# second executable into its place. Ensure that the new
# and reset the breakpoints correctly.
# Should see "Breakpoint 1, foo () at reread2.c:9"
+set test "run to foo() second time"
if [is_remote target] {
- unsupported "run to foo() second time "
+ unsupported $test
} else {
gdb_run_cmd
- gdb_expect {
- # -re ".*re-reading symbols.*Breakpoint.* foo .* at .*$srcfile2:9.*$gdb_prompt $" {}
- -re ".*Breakpoint.* foo .* at .*:9.*$gdb_prompt $" {
- pass "run to foo() second time "
- }
- -re ".*$gdb_prompt $" {
- fail "run to foo() second time"
- gdb_suppress_tests
- }
- timeout {
- fail "run to foo() second time (timeout)"
- gdb_suppress_tests
- }
- }
+ gdb_test "" "Breakpoint.* foo .* at .*:9.*" $test
}
"Breakpoint.*at.* file .*$srcfile1, line 14.*" \
"second pass: breakpoint foo in first file"
gdb_run_cmd
- gdb_expect {
- -re ".*Breakpoint.* foo .* at .*$srcfile1:14.*$gdb_prompt $" {
- pass "second pass: run to foo()"
- }
- -re ".*$gdb_prompt $" {
- fail "second pass: run to foo()"
- gdb_suppress_tests
- }
- timeout {
- fail "second pass: run to foo() (timeout)"
- gdb_suppress_tests
- }
- }
+ gdb_test "" "Breakpoint.* foo .* at .*$srcfile1:14.*" "second pass: run to foo()"
# This time, let the program run to completion. If GDB checks the
# executable file's timestamp now, it won't notice any change.
gdb_rename_execfile ${binfile} ${binfile1}
gdb_rename_execfile ${binfile2} ${binfile}
gdb_run_cmd
- gdb_expect {
- -re ".*Breakpoint.* foo .* at .*:9.*$gdb_prompt $" {
- pass "second pass: run to foo() second time "
- }
- -re ".*$gdb_prompt $" {
- fail "second pass: run to foo() second time"
- gdb_suppress_tests
- }
- timeout {
- fail "second pass: run to foo() second time (timeout)"
- gdb_suppress_tests
- }
- }
+ gdb_test "" "Breakpoint.* foo .* at .*:9.*" "second pass: run to foo() second time"
}
# End of tests.
-gdb_stop_suppressing_tests
-
return 0
# run until the breakpoint at main is hit. For non-stubs-using targets.
#
gdb_run_cmd
-gdb_expect {
- -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $" {
- pass "run until function breakpoint"
- }
- -re "$gdb_prompt $" {
- fail "run until function breakpoint"
- }
- timeout {
- fail "run until function breakpoint (timeout)"
- }
-}
+gdb_test "" \
+ "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*" \
+ "run until function breakpoint"
#
# run until the breakpoint at a line number
# Run until we call factorial with 6
gdb_run_cmd
- gdb_expect {
- -re "Break.* factorial .value=6. .*$gdb_prompt $" {}
- -re ".*$gdb_prompt $" {
- fail "run to factorial(6)"
- gdb_suppress_tests
- }
- timeout { fail "run to factorial(6) (timeout)" ; gdb_suppress_tests }
- }
+ gdb_test "" "Break.* factorial .value=6. .*" "run to factorial(6)"
# Continue until we call factorial recursively with 5.
if {$xfail} {
setup_xfail "*-*-*"
}
- gdb_expect {
+ set test "run until function breakpoint, optimized file"
+ gdb_test_multiple "" $test {
-re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $" {
- pass "run until function breakpoint, optimized file"
+ pass $test
}
-re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $" {
- pass "run until function breakpoint, optimized file (code motion)"
- }
- -re "$gdb_prompt $" {
- fail "run until function breakpoint, optimized file"
- }
- timeout {
- fail "run until function breakpoint, optimized file (timeout)"
+ pass "$test (code motion)"
}
}
"breakpoint at first instruction of hello()"
gdb_run_cmd
-gdb_expect {
- -re ".*Breakpoint.* hello .* at .*$srcfile:.*$gdb_prompt $" {
- pass "run to hello()"
- }
- -re ".*$gdb_prompt $" {
- fail "run to hello()"
- return -1
- }
- timeout {
- fail "run to hello() (timeout)"
- return -1
- }
-}
+gdb_test "" "Breakpoint.* hello .* at .*$srcfile:.*" "run to hello()"
gdb_test "stepi" \
".*" \
"\[\r\n\]1\.1.* y .* at .*$hdrfile:$bp_location.*\[\r\n\]1\.2.* y .* at .*$hdrfile:$bp_location.*"
gdb_run_cmd
-gdb_expect {
- -re "Breakpoint \[0-9\]+,.*foo \\(i=0\\).*$gdb_prompt $" {
- pass "run to breakpoint"
- }
- -re "$gdb_prompt $" {
- fail "run to breakpoint"
- }
- timeout {
- fail "run to breakpoint (timeout)"
- }
-}
+gdb_test "" "Breakpoint \[0-9\]+,.*foo \\(i=0\\).*" "run to breakpoint"
gdb_test "continue" \
".*Breakpoint.*foo \\(i=1\\).*" \
gdb_test_no_output "disable 1.2" "disabling location: disable"
gdb_run_cmd
-gdb_expect {
- -re "Breakpoint \[0-9\]+,.*foo \\(i=0\\).*$gdb_prompt $" {
- pass "disabling location: run to breakpoint"
- }
- -re "$gdb_prompt $" {
- fail "disabling location: run to breakpoint"
- }
- timeout {
- fail "disabling location: run to breakpoint (timeout)"
- }
-}
+gdb_test "" "Breakpoint \[0-9\]+,.*foo \\(i=0\\).*" "disabling location: run to breakpoint"
gdb_test_multiple "info break" "disabled breakpoint 1.2" {
-re "1\.2.* n .* at .*$hdrfile:$bp_location.*$gdb_prompt $" {
"separate condition: set condition"
gdb_run_cmd
-gdb_expect {
- -re "Breakpoint \[0-9\]+,.*foo<int> \\(i=1\\).*$gdb_prompt $" {
- pass "separate condition: run to breakpoint"
- }
- -re "$gdb_prompt $" {
- fail "separate condition: run to breakpoint"
- }
- timeout {
- fail "separate condition: run to breakpoint (timeout)"
- }
-}
+gdb_test "" "Breakpoint \[0-9\]+,.*foo<int> \\(i=1\\).*" "separate condition: run to breakpoint"
gdb_test "continue" \
".*Breakpoint.*foo<double> \\(i=1\\).*" \
gdb_test_no_output {disable $bpnum.1} "disabling location: disable"
gdb_run_cmd
-gdb_expect {
- -re "Breakpoint \[0-9\]+,.*foo<double> \\(i=1\\).*$gdb_prompt $" {
- pass "disabling location: run to breakpoint"
- }
- -re "$gdb_prompt $" {
- fail "disabling location: run to breakpoint"
- }
- timeout {
- fail "disabling location: run to breakpoint (timeout)"
- }
-}
+gdb_test "" "Breakpoint \[0-9\]+,.*foo<double> \\(i=1\\).*" "disabling location: run to breakpoint"
# Try disabling entire breakpoint
gdb_test_no_output {enable $bpnum.1} "disabling location: enable"
gdb_test_no_output {disable $bpnum} "disable breakpoint: disable"
gdb_run_cmd
-gdb_expect {
- -re "$inferior_exited_re normally.*$gdb_prompt $" {
- pass "disable breakpoint: run to breakpoint"
- }
- -re "$gdb_prompt $" {
- fail "disable breakpoint: run to breakpoint"
- }
- timeout {
- fail "disable breakpoint: run to breakpoint (timeout)"
- }
-}
+gdb_test "" "$inferior_exited_re normally.*" "disable breakpoint: run to breakpoint"
# Make sure breakpoint can be set on a specific instantion.
delete_breakpoints
gdb_run_cmd
-gdb_expect {
- -re ".*Breakpoint \[0-9\]+,.*foo<int> \\(i=0\\).*$gdb_prompt $" {
- pass "instantiation: run to breakpoint"
- }
- -re "$gdb_prompt $" {
- fail "instantiation: run to breakpoint"
- }
- timeout {
- fail "instantiation: run to breakpoint (timeout)"
- }
-}
+gdb_test "" "Breakpoint \[0-9\]+,.*foo<int> \\(i=0\\).*" "instantiation: run to breakpoint"
gdb_test "continue" \
".*Breakpoint.*foo<int> \\(i=1\\).*" \
# Test resetting breakpoints when re-running program
#
gdb_run_cmd
-gdb_expect {
- -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:.*$gdb_prompt $"\
- { pass "resetting breakpoints when rerunning" }
- -re ".*$gdb_prompt $" { fail "resetting breakpoints when rerunning" }
- timeout { fail "resetting breakpoints when rerunning" }
-}
+gdb_test "" "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:.*" "resetting breakpoints when r
#
# Continue until breakpoint (test re-setting breakpoint)
clean_restart ${binfile}
gdb_run_cmd
-gdb_expect {
- -re "$gdb_prompt $" {
- pass "run program to completion"
- }
- timeout {
- fail "run program to completion (timeout)"
- }
-}
+gdb_test "" "" "run program to completion"
# Try to quit.
send_gdb "quit\n"