after gdb_run_cmd, gdb_expect -> gdb_test_multiple/gdb_test

See:
  https://sourceware.org/ml/gdb-patches/2014-09/msg00404.html

We have a number of places that do gdb_run_cmd followed by gdb_expect,
when it would be better to use gdb_test_multiple or gdb_test.

This converts all that "grep gdb_run_cmd -A 2 | grep gdb_expect"
found.

Tested on x86_64 Fedora 20, native and gdbserver.

gdb/testsuite/
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.
This commit is contained in:
Pedro Alves 2014-09-12 22:16:31 +01:00
parent f37f681c2b
commit fa43b1d7ca
21 changed files with 125 additions and 463 deletions

View file

@ -1,3 +1,27 @@
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

View file

@ -50,17 +50,12 @@ gdb_test "b sub2" "Breakpoint 3.*" "set breakpoint at sub2"
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
}
}

View file

@ -41,18 +41,7 @@ gdb_load ${binfile}
# 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 {

View file

@ -46,18 +46,7 @@ gdb_load ${binfile}
# 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 {

View file

@ -46,18 +46,7 @@ gdb_load ${binfile}
# 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.*" \

View file

@ -34,48 +34,28 @@ if { [prepare_for_testing ${testfile}.exp $testfile $srcfile] } {
# 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"
}
}
}
@ -107,14 +87,9 @@ if [istarget "*-*-vxworks*"] then {
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.
@ -135,12 +110,7 @@ if [istarget "*-*-vxworks*"] then {
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.
@ -170,17 +140,7 @@ if [istarget "*-*-vxworks*"] then {
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.
@ -211,17 +171,7 @@ if [istarget "*-*-vxworks*"] then {
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

View file

@ -358,17 +358,9 @@ gdb_test "disable \$1foo" \
# 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}]
@ -773,14 +765,7 @@ proc test_next_with_recursion {} {
# 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.
@ -871,18 +856,14 @@ gdb_test "break marker4" \
# 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)"
}
}
@ -945,15 +926,14 @@ gdb_test "rbreak main" \
# 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
}
}

View file

@ -324,18 +324,7 @@ gdb_test "break ${srcfile}:[gdb_get_line_number "all strings initialized"]" \
".*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.

View file

@ -30,25 +30,10 @@ set timeout 10
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}
@ -83,18 +68,14 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
} 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
}
}

View file

@ -493,16 +493,7 @@ proc bp_deleted_in_command_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 {} {
@ -551,12 +542,8 @@ 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

View file

@ -258,11 +258,14 @@ proc test_assign { } {
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 {

View file

@ -29,17 +29,7 @@ gdb_test "break $srcfile:stop_here" \
"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".

View file

@ -54,13 +54,7 @@ proc integral_args {} {
# 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.
@ -111,13 +105,7 @@ proc unsigned_integral_args {} {
# 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.
@ -172,11 +160,14 @@ proc float_and_integral_args {} {
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
@ -257,10 +248,8 @@ proc complex_args {} {
# 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"
@ -282,10 +271,8 @@ proc complex_integral_args {} {
# 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"
}
@ -302,10 +289,8 @@ proc complex_float_integral_args {} {
# 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"
}
@ -328,11 +313,7 @@ proc pointer_args {} {
# 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"
@ -384,13 +365,7 @@ proc structs_by_reference {} {
# 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\}"
@ -440,13 +415,7 @@ proc structs_by_value {} {
# 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\}"
@ -513,11 +482,7 @@ proc discard_and_shuffle {} {
# 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-*-*"
@ -743,13 +708,7 @@ proc shuffle_round_robin {} {
# 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" {
@ -939,11 +898,7 @@ proc recursive_structs_by_value {} {
# 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" {

View file

@ -40,14 +40,7 @@ proc jit_run {msg} {
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

View file

@ -62,17 +62,7 @@ gdb_test "break foo" \
# 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
@ -87,24 +77,12 @@ gdb_touch_execfile ${binfile}
# 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
}
@ -127,19 +105,7 @@ if [is_remote target] {
"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.
@ -151,23 +117,9 @@ if [is_remote target] {
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

View file

@ -177,17 +177,9 @@ gdb_test "info break" \
# 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
@ -574,14 +566,7 @@ proc test_next_with_recursion {} {
# 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.
@ -686,18 +671,13 @@ proc test_different_dir {type test_different_dir xfail} {
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)"
}
}

View file

@ -29,19 +29,7 @@ gdb_test "break *hello" \
"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" \
".*" \

View file

@ -46,17 +46,7 @@ gdb_test "info break" \
"\[\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\\).*" \
@ -69,17 +59,7 @@ gdb_test "continue" \
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 $" {

View file

@ -72,17 +72,7 @@ gdb_test_no_output {condition $bpnum i==1} \
"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\\).*" \
@ -94,17 +84,7 @@ gdb_test "continue" \
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"
@ -113,17 +93,7 @@ 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
@ -132,17 +102,7 @@ gdb_test "break 'void foo<int>(int)'" ".*" \
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\\).*" \

View file

@ -119,12 +119,7 @@ gdb_test continue \
# 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)

View file

@ -65,14 +65,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
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"