2010-05-27 Michael Snyder <msnyder@msnyder-server.eng.vmware.com>

* gdb.base/relational.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/relocate.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/restore.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/return.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/return2.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/sepdebug.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/setshow.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/setvar.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/shlib-call.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/shreloc.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/sigall.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/sigbpt.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/signull.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/so-impl-ld.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/varargs.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/volatile.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/watch_thread_num.exp: Replace uses of send_gdb / gdb_expect.
	* gdb.base/watchpoint.exp: Replace uses of send_gdb / gdb_expect.
This commit is contained in:
Michael Snyder 2010-05-27 23:44:51 +00:00
parent 2245442480
commit 02746bbc9f
19 changed files with 433 additions and 1070 deletions

View file

@ -1,6 +1,24 @@
2010-05-27 Michael Snyder <msnyder@msnyder-server.eng.vmware.com> 2010-05-27 Michael Snyder <msnyder@msnyder-server.eng.vmware.com>
* gdb.base/break.exp: Replace uses of send_gdb / gdb_expect. * gdb.base/break.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/relational.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/relocate.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/restore.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/return.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/return2.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/sepdebug.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/setshow.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/setvar.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/shlib-call.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/shreloc.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/sigall.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/sigbpt.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/signull.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/so-impl-ld.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/varargs.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/volatile.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/watch_thread_num.exp: Replace uses of send_gdb / gdb_expect.
* gdb.base/watchpoint.exp: Replace uses of send_gdb / gdb_expect.
2010-05-26 Michael Snyder <msnyder@msnyder-server.eng.vmware.com> 2010-05-26 Michael Snyder <msnyder@msnyder-server.eng.vmware.com>

View file

@ -55,99 +55,25 @@ gdb_test "set variable y=2" "" "set variable y=2"
gdb_test "set variable z=2" "" "set variable z=2" gdb_test "set variable z=2" "" "set variable z=2"
gdb_test "set variable w=3" "" "set variable w=3" gdb_test "set variable w=3" "" "set variable w=3"
send_gdb "print x\n" gdb_test "print x" " = 14" "print value of x"
gdb_expect {
-re ".*14.*$gdb_prompt $" {
pass "print value of x"
}
-re ".*$gdb_prompt $" { fail "print value of x" }
timeout { fail "(timeout) print value of x" }
}
gdb_test "print y" " = 2" "print value of y"
send_gdb "print y\n" gdb_test "print z" " = 2" "print value of z"
gdb_expect {
-re ".*2.*$gdb_prompt $" {
pass "print value of y"
}
-re ".*$gdb_prompt $" { fail "print value of y" }
timeout { fail "(timeout) print value of y" }
}
send_gdb "print z\n" gdb_test "print w" " = 3" "print value of w"
gdb_expect {
-re ".*2.*$gdb_prompt $" {
pass "print value of z"
}
-re ".*$gdb_prompt $" { fail "print value of z" }
timeout { fail "(timeout) print value of z" }
}
send_gdb "print w\n" gdb_test "print x < y" "$false" "print value of x<y"
gdb_expect {
-re ".*3.*$gdb_prompt $" {
pass "print value of w"
}
-re ".*$gdb_prompt $" { fail "print value of w" }
timeout { fail "(timeout) print value of w" }
}
gdb_test "print x <= y" "$false" "print value of x<=y"
gdb_test "print x > y" "$true" "print value of x>y"
send_gdb "print x < y\n" gdb_test "print x >= y" "$true" "print value of x>=y"
gdb_expect {
-re ".*$false.*$gdb_prompt $" {
pass "print value of x<y"
}
-re ".*$gdb_prompt $" { fail "print value of x<y" }
timeout { fail "(timeout) print value of x<y" }
}
send_gdb "print x <= y\n" gdb_test "print x == y" "$false" "print value of x==y"
gdb_expect {
-re ".*$false.*$gdb_prompt $" {
pass "print value of x<=y"
}
-re ".*$gdb_prompt $" { fail "print value of x<=y" }
timeout { fail "(timeout) print value of x<=y" }
}
send_gdb "print x > y\n"
gdb_expect {
-re ".*$true.*$gdb_prompt $" {
pass "print value of x>y"
}
-re ".*$gdb_prompt $" { fail "print value of x>y" }
timeout { fail "(timeout) print value of x>y" }
}
send_gdb "print x >= y\n"
gdb_expect {
-re ".*$true.*$gdb_prompt $" {
pass "print value of x>=y"
}
-re ".*$gdb_prompt $" { fail "print value of x>=y" }
timeout { fail "(timeout) print value of x>=y" }
}
send_gdb "print x == y\n"
gdb_expect {
-re ".*$false.*$gdb_prompt $" {
pass "print value of x==y"
}
-re ".*$gdb_prompt $" { fail "print value of x==y" }
timeout { fail "(timeout) print value of x==y" }
}
send_gdb "print x != y\n"
gdb_expect {
-re ".*$true.*$gdb_prompt $" {
pass "print value of x!=y"
}
-re ".*$gdb_prompt $" { fail "print value of x!=y" }
timeout { fail "(timeout) print value of x!=y" }
}
gdb_test "print x != y" "$true" "print value of x!=y"
# Test associativity of <, >, <=, >=, ==, != # Test associativity of <, >, <=, >=, ==, !=
@ -156,70 +82,23 @@ gdb_test "set variable x=3" "" "set variable x"
gdb_test "set variable y=5" "" "set variable y" gdb_test "set variable y=5" "" "set variable y"
gdb_test "set variable z=2" "" "set variable z" gdb_test "set variable z=2" "" "set variable z"
gdb_test "print x < y < z" "$true" "print value of x<y<z"
gdb_test "print x <= y <= z" "$true" "print value of x<=y<=z"
send_gdb "print x < y < z\n" gdb_test "print x > y > z" "$false" "print value of x>y>z"
gdb_expect {
-re ".*$true.*\r\n$gdb_prompt $" {
pass "print value of x<y<z"
}
-re ".*$gdb_prompt $" { fail "print value of x<y<z" }
timeout { fail "(timeout) print value of x<y<z" }
}
send_gdb "print x <= y <= z\n" gdb_test "print x >= y >= z" "$false" "print value of x>=y>=z"
gdb_expect {
-re ".*$true\r\n$gdb_prompt $" {
pass "print value of x<=y<=z"
}
-re ".*$gdb_prompt $" { fail "print value of x<=y<=z" }
timeout { fail "(timeout) print value of x<=y<=z" }
}
send_gdb "print x > y > z\n"
gdb_expect {
-re ".*$false.*\r\n$gdb_prompt $" {
pass "print value of x>y>z"
}
-re 8".*$gdb_prompt $" { fail "print value of x>y>z" }
timeout { fail "(timeout) print value of x>y>z" }
}
send_gdb "print x >= y >= z\n"
gdb_expect {
-re ".*$false.*\r\n$gdb_prompt $" {
pass "print value of x>=y>=z"
}
-re ".*$gdb_prompt $" { fail "print value of x>=y>=z" }
timeout { fail "(timeout) print value of x>=y>=z" }
}
gdb_test "set variable x=2" "" "set variable x" gdb_test "set variable x=2" "" "set variable x"
gdb_test "set variable y=2" "" "set variable y" gdb_test "set variable y=2" "" "set variable y"
gdb_test "set variable z=1" "" "set variable z" gdb_test "set variable z=1" "" "set variable z"
gdb_test "print x == y == z" "$true" "print value of x==y==z"
send_gdb "print x == y == z\n"
gdb_expect {
-re ".*$true.*$gdb_prompt $" {
pass "print value of x==y==z"
}
-re ".*$gdb_prompt $" { fail "print value of x==y==z" }
timeout { fail "(timeout) print value of x==y==z" }
}
gdb_test "set variable z=0" "" "set variable z" gdb_test "set variable z=0" "" "set variable z"
gdb_test "print x != y != z" "$false" "print value of x!=y!=z"
send_gdb "print x != y != z\n"
gdb_expect {
-re ".*$false\r\n$gdb_prompt $" {
pass "print value of x!=y!=z"
}
-re ".*$gdb_prompt $" { fail "print value of x!=y!=z" }
timeout { fail "(timeout) print value of x!=y!=z" }
}
# test precedence rules on pairs of relational operators # test precedence rules on pairs of relational operators
@ -227,25 +106,10 @@ gdb_test "set variable x=0" "" "set variable x"
gdb_test "set variable y=2" "" "set variable y" gdb_test "set variable y=2" "" "set variable y"
gdb_test "set variable z=2" "" "set variable z" gdb_test "set variable z=2" "" "set variable z"
gdb_test "print x < y == z" "$false" "print value of x<y==z"
send_gdb "print x < y == z\n"
gdb_expect {
-re ".*$false.*$gdb_prompt $" {
pass "print value of x<y==z"
}
-re ".*$gdb_prompt $" { fail "print value of x<y==z" }
timeout { fail "(timeout) print value of x<y==z" }
}
# 0 2 2 # 0 2 2
send_gdb "print x < y != z\n" gdb_test "print x < y != z" "$true" "print value of x<y!=z"
gdb_expect {
-re ".*$true.*$gdb_prompt $" {
pass "print value of x<y!=z"
}
-re ".*$gdb_prompt $" { fail "print value of x<y!=z" }
timeout { fail "(timeout) print value of x<y!=z" }
}
gdb_test "set variable x=2" "" "set variable x" gdb_test "set variable x=2" "" "set variable x"
gdb_test "set variable y=3" "" "set variable y" gdb_test "set variable y=3" "" "set variable y"
@ -253,217 +117,80 @@ gdb_test "set variable z=1" "" "set variable z"
# 2 3 1 # 2 3 1
send_gdb "print x < y <= z\n" gdb_test "print x < y <= z" "$true" "print value of x<y<=z"
gdb_expect {
-re ".*$true.*$gdb_prompt $" {
pass "print value of x<y<=z"
}
-re ".*$gdb_prompt $" { fail "print value of x<y<=z" }
timeout { fail "(timeout) print value of x<y<=z" }
}
# 2 3 1 # 2 3 1
send_gdb "print x < y >= z\n" gdb_test "print x < y >= z" "$true" "print value of x<y>=z"
gdb_expect {
-re ".*$true.*$gdb_prompt $" {
pass "print value of x<y>=z"
}
-re ".*$gdb_prompt $" { fail "print value of x<y>=z" }
timeout { fail "(timeout) print value of x<y>=z" }
}
gdb_test "set variable z=0" "" " set variable z" gdb_test "set variable z=0" "" " set variable z"
# 2 3 0 # 2 3 0
send_gdb "print x < y > z\n" gdb_test "print x < y > z" "$true" "print value of x<y>z"
gdb_expect {
-re ".*$true.*$gdb_prompt $" {
pass "print value of x<y>z"
}
-re ".*$gdb_prompt $" { fail "print value of x<y>z" }
timeout { fail "(timeout) print value of x<y>z" }
}
gdb_test "set variable x=1" "" " set variable x" gdb_test "set variable x=1" "" " set variable x"
# 1 3 0 # 1 3 0
send_gdb "print x > y >= z\n" gdb_test "print x > y >= z" "$true" "print value of x>y>=z"
gdb_expect {
-re ".*$true.*$gdb_prompt $" {
pass "print value of x>y>=z"
}
-re ".*$gdb_prompt $" { fail "print value of x>y>=z" }
timeout { fail "(timeout) print value of x>y>=z" }
}
gdb_test "set variable z=2" "" " set variable z" gdb_test "set variable z=2" "" " set variable z"
# 1 3 2 # 1 3 2
send_gdb "print x > y == z\n" gdb_test "print x > y == z" "$false" "print value of x>y==z"
gdb_expect {
-re ".*$false.*$gdb_prompt $" {
pass "print value of x>y==z"
}
-re ".*$gdb_prompt $" { fail "print value of x>y==z" }
timeout { fail "(timeout) print value of x>y==z" }
}
gdb_test "set variable x=2" "" " set variable x" gdb_test "set variable x=2" "" " set variable x"
gdb_test "set variable z=0" "" " set variable z" gdb_test "set variable z=0" "" " set variable z"
# 2 3 0 # 2 3 0
send_gdb "print x > y != z\n" gdb_test "print x > y != z" "$false" "print value of x>y!=z"
gdb_expect {
-re ".*$false.*$gdb_prompt $" {
pass "print value of x>y!=z"
}
-re ".*$gdb_prompt $" { fail "print value of x>y!=z" }
timeout { fail "(timeout) print value of x>y!=z" }
}
gdb_test "set variable x=4" "" "set x to 4" gdb_test "set variable x=4" "" "set x to 4"
# 4 3 0 # 4 3 0
send_gdb "print x > y <= z\n" gdb_test "print x > y <= z" "$false" "print value of x>y<=z"
gdb_expect {
-re ".*$false.*$gdb_prompt $" {
pass "print value of x>y<=z"
}
-re ".*$gdb_prompt $" { fail "print value of x>y<=z" }
timeout { fail "(timeout) print value of x>y<=z" }
}
# 4 3 0 # 4 3 0
send_gdb "print x >= y == z\n" gdb_test "print x >= y == z" "$false" "print value of x>=y==z"
gdb_expect {
-re ".*$false\r\n$gdb_prompt $" {
pass "print value of x>=y==z"
}
-re ".*$gdb_prompt $" { fail "print value of x>=y==z" }
timeout { fail "(timeout) print value of x>=y==z" }
}
gdb_test "set variable x=2" "" " set variable x" gdb_test "set variable x=2" "" " set variable x"
# 2 3 0 # 2 3 0
send_gdb "print x >= y != z\n" gdb_test "print x >= y != z" "$false" "print value of x>=y!=z"
gdb_expect {
-re ".*$false\r\n$gdb_prompt $" {
pass "print value of x>=y!=z"
}
-re ".*$gdb_prompt $" { fail "print value of x>=y!=z" }
timeout { fail "(timeout) print value of x>=y!=z" }
}
gdb_test "set variable x=0" "" " set variable x" gdb_test "set variable x=0" "" " set variable x"
gdb_test "set variable z=4" "" " set variable z" gdb_test "set variable z=4" "" " set variable z"
# 0 3 4 # 0 3 4
send_gdb "print x >= y <= z\n" gdb_test "print x >= y <= z" "$true" "print value of x>=y<=z"
gdb_expect {
-re ".*$true\r\n$gdb_prompt $" {
pass "print value of x>=y<=z"
}
-re ".*$gdb_prompt $" { fail "print value of x>=y<=z" }
timeout { fail "(timeout) print value of x>=y<=z" }
}
# 0 3 4 # 0 3 4
send_gdb "print x <= y == z\n" gdb_test "print x <= y == z" "$false" "print value of x<=y==z"
gdb_expect {
-re ".*$false\r\n$gdb_prompt $" {
pass "print value of x<=y==z"
}
-re ".*$gdb_prompt $" { fail "print value of x<=y==z" }
timeout { fail "(timeout) print value of x<=y==z" }
}
gdb_test "set variable x=2" "" " set variable x" gdb_test "set variable x=2" "" " set variable x"
# 2 3 4 # 2 3 4
send_gdb "print x <= y != z\n" gdb_test "print x <= y != z" "$true" "print value of x<=y!=z"
gdb_expect {
-re ".*$true\r\n$gdb_prompt $" {
pass "print value of x<=y!=z"
}
-re ".*$gdb_prompt $" { fail "print value of x<=y!=z" }
timeout { fail "(timeout) print value of x<=y!=z" }
}
# 2 3 4 # 2 3 4
send_gdb "print x == y != z\n" gdb_test "print x == y != z" "$true" "print value of x==y!=z"
gdb_expect {
-re ".*$true\r\n$gdb_prompt $" {
pass "print value of x==y!=z"
}
-re ".*$gdb_prompt $" { fail "print value of x==y!=z" }
timeout { fail "(timeout) print value of x==y!=z" }
}
# test use of parenthesis to enforce different order of evaluation # test use of parenthesis to enforce different order of evaluation
gdb_test "set variable z=0" "" " set variable z" gdb_test "set variable z=0" "" " set variable z"
# 2 3 0 # 2 3 0
send_gdb "print x >= (y < z)\n" gdb_test "print x >= (y < z)" "$true" "print value of x>=(y<z)"
gdb_expect {
-re ".*$true\r\n$gdb_prompt $" {
pass "print value of x>=(y<z)"
}
-re ".*$gdb_prompt $" { fail "print value of x>=(y<z)" }
timeout { fail "(timeout) print value of x>=(y<z)" }
}
# 2 3 0 # 2 3 0
send_gdb "print x >= (y != z)\n" gdb_test "print x >= (y != z)" "$true" "print value of x>=(y!=z)"
gdb_expect {
-re ".*$true\r\n$gdb_prompt $" {
pass "print value of x>=(y!=z)"
}
-re ".*$gdb_prompt $" { fail "print value of x>=(y*!=z)" }
timeout { fail "(timeout) print value of x>=(y!=z)" }
}
# 2 3 0 # 2 3 0
send_gdb "print x == (y == z)\n" gdb_test "print x == (y == z)" "$false" "print value of x==(y==z)"
gdb_expect {
-re ".*$false\r\n$gdb_prompt $" {
pass "print value of x==(y==z)"
}
-re ".*$gdb_prompt $" { fail "print value of x==(y==z)" }
timeout { fail "(timeout) print value of x==(y==z)" }
}
gdb_test "set variable x=1" "" " set variable x" gdb_test "set variable x=1" "" " set variable x"
gdb_test "set variable z=4" "" " set variable z" gdb_test "set variable z=4" "" " set variable z"
# 1 3 4 # 1 3 4
send_gdb "print (x == y) < z\n" gdb_test "print (x == y) < z" "$true" "print value of (x==y)<z"
gdb_expect {
-re ".*$true\r\n$gdb_prompt $" {
pass "print value of (x==y)<z"
}
-re ".*$gdb_prompt $" { fail "print value of (x==y)<z" }
timeout { fail "(timeout) print value of (x==y)<z" }
}

View file

@ -32,29 +32,24 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug}]
} }
proc get_var_address { var } { proc get_var_address { var } {
global gdb_prompt hex global gdb_prompt hex
send_gdb "print &${var}\n" # Match output like:
# Match output like: # $1 = (int *) 0x0
# $1 = (int *) 0x0 # $5 = (int (*)()) 0
# $5 = (int (*)()) 0 # $6 = (int (*)()) 0x24 <function_bar>
# $6 = (int (*)()) 0x24 <function_bar>
gdb_expect { gdb_test_multiple "print &${var}" "get address of ${var}" {
-re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $" -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $" {
{ pass "get address of ${var}"
pass "get address of ${var}" if { $expect_out(1,string) == "0" } {
if { $expect_out(1,string) == "0" } { return "0x0"
return "0x0" } else {
} else { return $expect_out(1,string)
return $expect_out(1,string) }
}
} }
-re "${gdb_prompt} $" }
{ fail "get address of ${var} (unknown output)" } return ""
timeout
{ fail "get address of ${var} (timeout)" }
}
return ""
} }

View file

@ -69,15 +69,12 @@ proc restore_tests { } {
# Do a forced return from the callee. # Do a forced return from the callee.
set test "caller$c calls callee$e; return callee now" set test "caller$c calls callee$e; return callee now"
gdb_test_multiple "return 0" "$test" {
-re "Make .* return now.*y or n. $" { gdb_test "return 0" \
send_gdb "y\n" " caller$c .*" \
exp_continue "$test" \
} "Make .* return now.*y or n. $" \
-re " caller$c .*$gdb_prompt $" { "y"
pass "$test"
}
}
# Check that the values of the local variables are what # Check that the values of the local variables are what
# they should be. # they should be.

View file

@ -25,8 +25,8 @@ proc return_tests { } {
if { ! [ runto func1 ] } then { return 0 } if { ! [ runto func1 ] } then { return 0 }
send_gdb "return\n"
gdb_expect { gdb_test_multiple "return" "simple return" {
-re "Make .* return now.*y or n. $" { -re "Make .* return now.*y or n. $" {
send_gdb "y\n" send_gdb "y\n"
exp_continue exp_continue
@ -35,9 +35,9 @@ proc return_tests { } {
send_gdb "step\n" send_gdb "step\n"
exp_continue exp_continue
} }
-re ".*in main after func1.*$gdb_prompt $" { pass "simple return" } -re ".*in main after func1.*$gdb_prompt $" {
-re "$gdb_prompt $" { fail "simple return" } pass "simple return"
timeout { fail "(timeout) simple return" } }
} }
# Set breakpoints in other interesting functions. # Set breakpoints in other interesting functions.
@ -45,16 +45,17 @@ proc return_tests { } {
gdb_test "break func3" "" "break func3" gdb_test "break func3" "" "break func3"
gdb_test "continue" "return -5;" "continue to return of -5" gdb_test "continue" "return -5;" "continue to return of -5"
send_gdb "return 5\n"
gdb_expect { gdb_test_multiple "return 5" "return value 5" {
-re "Make .* return now.*y or n. $" { -re "Make .* return now.*y or n. $" {
send_gdb "y\n" send_gdb "y\n"
exp_continue exp_continue
} }
-re ".*tmp2 = func2.*$gdb_prompt $" { } -re ".*tmp2 = func2.*$gdb_prompt $" {
-re "$gdb_prompt $" { fail "did not return (integer test)" } # pass without comment
timeout { fail "(timeout) did not return (integer test)" } }
} }
gdb_test "next" "tmp3 = func3.*" "next over call to func2" gdb_test "next" "tmp3 = func3.*" "next over call to func2"
gdb_test "p tmp2" ".* = 5" "correct value returned (integer test)" gdb_test "p tmp2" ".* = 5" "correct value returned (integer test)"
@ -64,15 +65,15 @@ proc return_tests { } {
# Return of a double does not work for 68hc11 (need struct return # Return of a double does not work for 68hc11 (need struct return
# in memory). # in memory).
setup_xfail "m6811-*-*" setup_xfail "m6811-*-*"
send_gdb "return 5.0\n"
gdb_expect { gdb_test_multiple "return 5.0" "return value 5.0" {
-re "Make .* return now.*y or n. $" { -re "Make .* return now.*y or n. $" {
send_gdb "y\n" send_gdb "y\n"
exp_continue exp_continue
} }
-re ".*tmp3 = func3.*$gdb_prompt $" { } -re ".*tmp3 = func3.*$gdb_prompt $" {
-re "$gdb_prompt $" { fail "did not return (double test)" } # pass without comment
timeout { fail "(timeout) did not return (double test)" } }
} }
setup_xfail "m6811-*-*" setup_xfail "m6811-*-*"

View file

@ -36,26 +36,21 @@ proc return_1 { type } {
"set break on ${type}_func" "set break on ${type}_func"
gdb_test "continue" "Breakpoint.* ${type}_func.*" \ gdb_test "continue" "Breakpoint.* ${type}_func.*" \
"continue to ${type}_func" "continue to ${type}_func"
send_gdb "return testval.${type}_testval\n"
gdb_expect { gdb_test_multiple "return testval.${type}_testval" \
-re "Make ${type}_func return now.*y or n. $" { "return from ${type}_func" {
send_gdb "y\n" -re "Make ${type}_func return now.*y or n. $" {
exp_continue send_gdb "y\n"
exp_continue
}
-re ".*${type}_resultval *= ${type}_func.*$gdb_prompt $" {
send_gdb "step\n"
exp_continue
}
-re ".*${type}_checkpoint.*$gdb_prompt $" {
pass "return from ${type}_func"
}
} }
-re ".*${type}_resultval *= ${type}_func.*$gdb_prompt $" {
send_gdb "step\n"
exp_continue
}
-re ".*${type}_checkpoint.*$gdb_prompt $" {
pass "return from ${type}_func"
}
-re ".*$gdb_prompt $" {
fail "return from ${type}_func"
}
timeout {
fail "return from ${type}_func (timeout)"
}
}
gdb_test "print ${type}_resultval == testval.${type}_testval" ".* = 1" \ gdb_test "print ${type}_resultval == testval.${type}_testval" ".* = 1" \
"${type} value returned successfully" "${type} value returned successfully"
gdb_test "print ${type}_resultval != ${type}_returnval" ".* = 1" \ gdb_test "print ${type}_resultval != ${type}_returnval" ".* = 1" \
@ -69,8 +64,8 @@ proc return_void { } {
"set break on void_func" "set break on void_func"
gdb_test "continue" "Breakpoint.* void_func.*" \ gdb_test "continue" "Breakpoint.* void_func.*" \
"continue to void_func" "continue to void_func"
send_gdb "return \n"
gdb_expect { gdb_test_multiple "return" "return from void_func" {
-re "Make void_func return now.*y or n. $" { -re "Make void_func return now.*y or n. $" {
send_gdb "y\n" send_gdb "y\n"
exp_continue exp_continue
@ -82,12 +77,6 @@ proc return_void { } {
-re ".*void_checkpoint.*$gdb_prompt $" { -re ".*void_checkpoint.*$gdb_prompt $" {
pass "return from void_func" pass "return from void_func"
} }
-re ".*$gdb_prompt $" {
fail "return from void_func"
}
timeout {
fail "return from void_func (timeout)"
}
} }
gdb_test "print void_test == 0" ".* = 1" \ gdb_test "print void_test == 0" ".* = 1" \
"void function returned successfully" "void function returned successfully"

View file

@ -71,26 +71,6 @@ if [target_info exists gdb_stub] {
# test simple breakpoint setting commands # test simple breakpoint setting commands
# #
# Test deleting all breakpoints when there are none installed,
# GDB should not prompt for confirmation.
# Note that gdb-init.exp provides a "delete_breakpoints" proc
# for general use elsewhere.
send_gdb "delete breakpoints\n"
gdb_expect {
-re "Delete all breakpoints.*$" {
send_gdb "y\n"
gdb_expect {
-re "$gdb_prompt $" {
fail "Delete all breakpoints when none (unexpected prompt)"
}
timeout { fail "Delete all breakpoints when none (timeout after unexpected prompt)" }
}
}
-re ".*$gdb_prompt $" { pass "Delete all breakpoints when none" }
timeout { fail "Delete all breakpoints when none (timeout)" }
}
# #
# test break at function # test break at function
# #
@ -272,24 +252,22 @@ gdb_test "tbreak $srcfile:factorial" "Temporary breakpoint.*at.* file .*$srcfile
# #
# test break at line number # test break at line number
# #
send_gdb "tbreak $bp_location1\n"
gdb_expect {
-re "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location1.*$gdb_prompt $" { pass "Temporary breakpoint line number #1" }
-re ".*$gdb_prompt $" { pass "Temporary breakpoint line number #1" }
timeout { fail "breakpoint line number #1 (timeout)" }
}
gdb_test "tbreak $bp_location6" "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location6.*" "Temporary breakpoint line number #2" gdb_test "tbreak $bp_location1" \
"Temporary breakpoint.*at.* file .*$srcfile, line $bp_location1.*" \
"Temporary breakpoint line number #1"
gdb_test "tbreak $bp_location6" \
"Temporary breakpoint.*at.* file .*$srcfile, line $bp_location6.*" \
"Temporary breakpoint line number #2"
# #
# test break at line number in file # test break at line number in file
# #
send_gdb "tbreak $srcfile:$bp_location2\n"
gdb_expect { gdb_test "tbreak $srcfile:$bp_location2" \
-re "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location2.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location2.*" \
-re ".*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } "Temporary breakpoint line number in file #1"
timeout { fail "Temporary breakpoint line number in file #1 (timeout)" }
}
set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] set bp_location11 [gdb_get_line_number "set breakpoint 11 here"]
gdb_test "tbreak $srcfile:$bp_location11" "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location11.*" "Temporary breakpoint line number in file #2" gdb_test "tbreak $srcfile:$bp_location11" "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location11.*" "Temporary breakpoint line number in file #2"
@ -313,80 +291,54 @@ gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\]
# inappropriately. (There are no calls to those system functions # inappropriately. (There are no calls to those system functions
# in this test program.) # in this test program.)
# #
if ![runto_main] then { fail "break tests suppressed" } if ![runto_main] then { fail "sepdebug tests suppressed" }
send_gdb "catch\n"
gdb_expect {
-re "Catch requires an event name.*$gdb_prompt $"\
{pass "catch requires an event name"}
-re "$gdb_prompt $"\
{fail "catch requires an event name"}
timeout {fail "(timeout) catch requires an event name"}
}
gdb_test "catch" "Catch requires an event name.*" \
"catch requires an event name"
set name "set catch fork, never expected to trigger" set name "set catch fork, never expected to trigger"
send_gdb "catch fork\n" gdb_test_multiple "catch fork" $name {
gdb_expect { -re "Catchpoint \[0-9\]* .fork.*$gdb_prompt $" {
-re "Catchpoint \[0-9\]* .fork..*$gdb_prompt $" pass $name
{pass $name} }
-re "Catch of fork not yet implemented.*$gdb_prompt $" -re "Catch of fork not yet implemented.*$gdb_prompt $" {
{pass $name} pass $name
-re "$gdb_prompt $" }
{fail $name}
timeout {fail "(timeout) $name"}
} }
set name "set catch vfork, never expected to trigger"
send_gdb "catch vfork\n"
# If we are on HP-UX 10.20, we expect an error message to be # If we are on HP-UX 10.20, we expect an error message to be
# printed if we type "catch vfork" at the gdb gdb_prompt. This is # printed if we type "catch vfork" at the gdb gdb_prompt. This is
# because on HP-UX 10.20, we cannot catch vfork events. # because on HP-UX 10.20, we cannot catch vfork events.
if [istarget "hppa*-hp-hpux10.20"] then { set name "set catch vfork, never expected to trigger"
gdb_expect { gdb_test_multiple "catch vfork" $name {
-re "Catch of vfork events not supported on HP-UX 10.20..*$gdb_prompt $" -re "Catch of vfork events not supported on HP-UX 10.20.*" {
{pass $name} pass $name
-re "$gdb_prompt $"
{fail $name}
timeout {fail "(timeout) $name"}
} }
} else { -re "Catchpoint \[0-9\]* .vfork.*$gdb_prompt $" {
gdb_expect { pass $name
-re "Catchpoint \[0-9\]* .vfork..*$gdb_prompt $" }
{pass $name} -re "Catch of vfork not yet implemented.*$gdb_prompt $" {
-re "Catch of vfork not yet implemented.*$gdb_prompt $" pass $name
{pass $name}
-re "$gdb_prompt $"
{fail $name}
timeout {fail "(timeout) $name"}
} }
} }
set name "set catch exec, never expected to trigger" set name "set catch exec, never expected to trigger"
send_gdb "catch exec\n" gdb_test_multiple "catch exec" $name {
gdb_expect { -re "Catchpoint \[0-9\]* .exec.*$gdb_prompt $" {
-re "Catchpoint \[0-9\]* .exec..*$gdb_prompt $" pass $name
{pass $name} }
-re "Catch of exec not yet implemented.*$gdb_prompt $" -re "Catch of exec not yet implemented.*$gdb_prompt $" {
{pass $name} pass $name
-re "$gdb_prompt $" {fail $name} }
timeout {fail "(timeout) $name"}
} }
# Verify that GDB responds gracefully when asked to set a breakpoint # Verify that GDB responds gracefully when asked to set a breakpoint
# on a nonexistent source line. # on a nonexistent source line.
# #
send_gdb "break 999\n"
gdb_expect { gdb_test "break 999" "No line 999 in file .*" \
-re "No line 999 in file .*$gdb_prompt $"\ "break on non-existent source line"
{pass "break on non-existent source line"}
-re "$gdb_prompt $"\
{fail "break on non-existent source line"}
timeout {fail "(timeout) break on non-existent source line"}
}
# Run to the desired default location. If not positioned here, the # Run to the desired default location. If not positioned here, the
# tests below don't work. # tests below don't work.
@ -399,54 +351,32 @@ gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" "until bp_locatio
# the informational message about other breakpoints at the same # the informational message about other breakpoints at the same
# location. We'll hit that bird with this stone too. # location. We'll hit that bird with this stone too.
# #
send_gdb "break\n"
gdb_expect {
-re "Breakpoint \[0-9\]*.*$gdb_prompt $"\
{pass "break on default location, 1st time"}
-re "$gdb_prompt $"\
{fail "break on default location, 1st time"}
timeout {fail "(timeout) break on default location, 1st time"}
}
send_gdb "break\n" gdb_test "break" "Breakpoint \[0-9\]*.*" \
gdb_expect { "break on default location, 1st time"
-re "Note: breakpoint \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\
{pass "break on default location, 2nd time"}
-re "$gdb_prompt $"\
{fail "break on default location, 2nd time"}
timeout {fail "(timeout) break on default location, 2nd time"}
}
send_gdb "break\n" gdb_test "break" \
gdb_expect { "Note: breakpoint \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \
-re "Note: breakpoints \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ "break on default location, 2nd time"
{pass "break on default location, 3rd time"}
-re "$gdb_prompt $"\
{fail "break on default location, 3rd time"}
timeout {fail "(timeout) break on default location, 3rd time"}
}
send_gdb "break\n" gdb_test "break" \
gdb_expect { "Note: breakpoints \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \
-re "Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ "break on default location, 3rd time"
{pass "break on default location, 4th time"}
-re "$gdb_prompt $"\ gdb_test "break" \
{fail "break on default location, 4th time"} "Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \
timeout {fail "(timeout) break on default location, 4th time"} "break on default location, 4th time"
}
# Verify that a "silent" breakpoint can be set, and that GDB is indeed # Verify that a "silent" breakpoint can be set, and that GDB is indeed
# "silent" about its triggering. # "silent" about its triggering.
# #
if ![runto_main] then { fail "break tests suppressed" } if ![runto_main] then { fail "sepdebug tests suppressed" }
send_gdb "break $bp_location1\n" gdb_test_multiple "break $bp_location1" \
gdb_expect { "set to-be-silent break bp_location1" {
-re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $"\ -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $" {
{pass "set to-be-silent break bp_location1"} pass "set to-be-silent break bp_location1"
-re "$gdb_prompt $"\ }
{fail "set to-be-silent break bp_location1"}
timeout {fail "(timeout) set to-be-silent break bp_location1"}
} }
send_gdb "commands $expect_out(1,string)\n" send_gdb "commands $expect_out(1,string)\n"
@ -458,30 +388,14 @@ gdb_expect {
timeout {fail "(timeout) set silent break bp_location1"} timeout {fail "(timeout) set silent break bp_location1"}
} }
send_gdb "info break $expect_out(1,string)\n" gdb_test "info break $expect_out(1,string)\n" \
gdb_expect { "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*" \
-re "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*$gdb_prompt $"\ "info silent break bp_location1"
{pass "info silent break bp_location1"}
-re "$gdb_prompt $"\ gdb_test "continue" "Continuing.*" "hit silent break bp_location1"
{fail "info silent break bp_location1"}
timeout {fail "(timeout) info silent break bp_location1"} gdb_test "bt" "#0 main .* at .*:$bp_location1.*" \
} "stopped for silent break bp_location1"
send_gdb "continue\n"
gdb_expect {
-re "Continuing.\r\n$gdb_prompt $"\
{pass "hit silent break bp_location1"}
-re "$gdb_prompt $"\
{fail "hit silent break bp_location1"}
timeout {fail "(timeout) hit silent break bp_location1"}
}
send_gdb "bt\n"
gdb_expect {
-re "#0 main .* at .*:$bp_location1.*$gdb_prompt $"\
{pass "stopped for silent break bp_location1"}
-re "$gdb_prompt $"\
{fail "stopped for silent break bp_location1"}
timeout {fail "(timeout) stopped for silent break bp_location1"}
}
# Verify that GDB can at least parse a breakpoint with the # Verify that GDB can at least parse a breakpoint with the
# "thread" keyword. (We won't attempt to test here that a # "thread" keyword. (We won't attempt to test here that a
@ -489,61 +403,34 @@ gdb_expect {
# The gdb.threads subdirectory contains tests for that.) # The gdb.threads subdirectory contains tests for that.)
# #
set bp_location12 [gdb_get_line_number "set breakpoint 12 here"] set bp_location12 [gdb_get_line_number "set breakpoint 12 here"]
send_gdb "break $bp_location12 thread 999\n"
gdb_expect { gdb_test "break $bp_location12 thread 999" "Unknown thread 999.*" \
-re "Unknown thread 999.*$gdb_prompt $"\ "thread-specific breakpoint on non-existent thread disallowed"
{pass "thread-specific breakpoint on non-existent thread disallowed"}
-re "$gdb_prompt $"\ gdb_test "break $bp_location12 thread foo" \
{fail "thread-specific breakpoint on non-existent thread disallowed"} "Junk after thread keyword.*" \
timeout {fail "(timeout) thread-specific breakpoint on non-existent thread disallowed"} "thread-specific breakpoint on bogus thread ID disallowed"
}
send_gdb "break $bp_location12 thread foo\n"
gdb_expect {
-re "Junk after thread keyword..*$gdb_prompt $"\
{pass "thread-specific breakpoint on bogus thread ID disallowed"}
-re "$gdb_prompt $"\
{fail "thread-specific breakpoint on bogus thread ID disallowed"}
timeout {fail "(timeout) thread-specific breakpoint on bogus thread ID disallowed"}
}
# Verify that GDB responds gracefully to a breakpoint command with # Verify that GDB responds gracefully to a breakpoint command with
# trailing garbage. # trailing garbage.
# #
send_gdb "break $bp_location12 foo\n"
gdb_expect { gdb_test "break $bp_location12 foo" \
-re "Junk at end of arguments..*$gdb_prompt $"\ "Junk at end of arguments.*" \
{pass "breakpoint with trailing garbage disallowed"} "breakpoint with trailing garbage disallowed"
-re "$gdb_prompt $"\
{fail "breakpoint with trailing garbage disallowed"}
timeout {fail "(timeout) breakpoint with trailing garbage disallowed"}
}
# Verify that GDB responds gracefully to a "clear" command that has # Verify that GDB responds gracefully to a "clear" command that has
# no matching breakpoint. (First, get us off the current source line, # no matching breakpoint. (First, get us off the current source line,
# which we know has a breakpoint.) # which we know has a breakpoint.)
# #
send_gdb "next\n"
gdb_expect { gdb_test "next" "marker1.*" "step over breakpoint"
-re ".*$gdb_prompt $"\
{pass "step over breakpoint"} gdb_test "clear 81" "No breakpoint at 81.*" \
timeout {fail "(timeout) step over breakpoint"} "clear line has no breakpoint disallowed"
}
send_gdb "clear 81\n" gdb_test "clear" "No breakpoint at this line.*" \
gdb_expect { "clear current line has no breakpoint disallowed"
-re "No breakpoint at 81..*$gdb_prompt $"\
{pass "clear line has no breakpoint disallowed"}
-re "$gdb_prompt $"\
{fail "clear line has no breakpoint disallowed"}
timeout {fail "(timeout) clear line has no breakpoint disallowed"}
}
send_gdb "clear\n"
gdb_expect {
-re "No breakpoint at this line..*$gdb_prompt $"\
{pass "clear current line has no breakpoint disallowed"}
-re "$gdb_prompt $"\
{fail "clear current line has no breakpoint disallowed"}
timeout {fail "(timeout) clear current line has no breakpoint disallowed"}
}
# Verify that we can set and clear multiple breakpoints. # Verify that we can set and clear multiple breakpoints.
# #
@ -556,57 +443,35 @@ gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*}
# Verify that a breakpoint can be set via a convenience variable. # Verify that a breakpoint can be set via a convenience variable.
# #
send_gdb "set \$foo=$bp_location11\n"
gdb_expect { gdb_test "set \$foo=$bp_location11" "" \
-re "$gdb_prompt $"\ "set convenience variable \$foo to bp_location11"
{pass "set convenience variable \$foo to bp_location11"}
timeout {fail "(timeout) set convenience variable \$foo to bp_location11"} gdb_test "break \$foo" \
} "Breakpoint (\[0-9\]*) at .*, line $bp_location11.*" \
send_gdb "break \$foo\n" "set breakpoint via convenience variable"
gdb_expect {
-re "Breakpoint (\[0-9\]*) at .*, line $bp_location11.*$gdb_prompt $"\
{pass "set breakpoint via convenience variable"}
-re "$gdb_prompt $"\
{fail "set breakpoint via convenience variable"}
timeout {fail "(timeout) set breakpoint via convenience variable"}
}
# Verify that GDB responds gracefully to an attempt to set a # Verify that GDB responds gracefully to an attempt to set a
# breakpoint via a convenience variable whose type is not integer. # breakpoint via a convenience variable whose type is not integer.
# #
send_gdb "set \$foo=81.5\n"
gdb_expect { gdb_test_no_output "set \$foo=81.5" \
-re "$gdb_prompt $"\ "set convenience variable \$foo to 81.5"
{pass "set convenience variable \$foo to 81.5"}
timeout {fail "(timeout) set convenience variable \$foo to 81.5"} gdb_test "break \$foo" \
} "Convenience variables used in line specs must have integer values.*" \
send_gdb "break \$foo\n" "set breakpoint via non-integer convenience variable disallowed"
gdb_expect {
-re "Convenience variables used in line specs must have integer values..*$gdb_prompt $"\
{pass "set breakpoint via non-integer convenience variable disallowed"}
-re "$gdb_prompt $"\
{fail "set breakpoint via non-integer convenience variable disallowed"}
timeout {fail "(timeout) set breakpoint via non-integer convenience variable disallowed"}
}
# Verify that we can set and trigger a breakpoint in a user-called function. # Verify that we can set and trigger a breakpoint in a user-called function.
# #
send_gdb "break marker2\n"
gdb_expect { gdb_test "break marker2" \
-re "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*$gdb_prompt $"\ "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*" \
{pass "set breakpoint on to-be-called function"} "set breakpoint on to-be-called function"
-re "$gdb_prompt $"\
{fail "set breakpoint on to-be-called function"} gdb_test "print marker2(99)" \
timeout {fail "(timeout) set breakpoint on to-be-called function"} "The program being debugged stopped while in a function called from GDB.\r\nEvaluation of the expression containing the function\r\n.marker2. will be abandoned.\r\nWhen the function is done executing, GDB will silently stop.*" \
} "hit breakpoint on called function"
send_gdb "print marker2(99)\n"
gdb_expect {
-re "The program being debugged stopped while in a function called from GDB.\r\nEvaluation of the expression containing the function\r\n.marker2. will be abandoned.\r\nWhen the function is done executing, GDB will silently stop..*$gdb_prompt $"\
{pass "hit breakpoint on called function"}
-re "$gdb_prompt $"\
{fail "hit breakpoint on called function"}
timeout {fail "(timeout) hit breakpoint on called function"}
}
# As long as we're stopped (breakpointed) in a called function, # As long as we're stopped (breakpointed) in a called function,
# verify that we can successfully backtrace & such from here. # verify that we can successfully backtrace & such from here.
@ -614,47 +479,41 @@ gdb_expect {
# In this and the following test, the _sr4export check apparently is needed # In this and the following test, the _sr4export check apparently is needed
# for hppa*-*-hpux. # for hppa*-*-hpux.
# #
send_gdb "bt\n"
gdb_expect { gdb_test_multiple "bt" "backtrace while in called function" {
-re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*_sr4export.*$gdb_prompt $"\ -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*_sr4export.*$gdb_prompt $" {
{pass "backtrace while in called function"} pass "backtrace while in called function"
-re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*function called from gdb.*$gdb_prompt $"\ }
{pass "backtrace while in called function"} -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*function called from gdb.*$gdb_prompt $" {
-re "$gdb_prompt $"\ pass "backtrace while in called function"
{fail "backtrace while in called function"} }
timeout {fail "(timeout) backtrace while in called function"}
} }
# Return from the called function. For remote targets, it's important to do # Return from the called function. For remote targets, it's important to do
# this before runto_main, which otherwise may silently stop on the dummy # this before runto_main, which otherwise may silently stop on the dummy
# breakpoint inserted by GDB at the program's entry point. # breakpoint inserted by GDB at the program's entry point.
# #
send_gdb "finish\n"
gdb_expect { gdb_test_multiple "finish" "finish from called function" {
-re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.* in _sr4export.*$gdb_prompt $"\ -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.* in _sr4export.*$gdb_prompt $" {
{pass "finish from called function"} pass "finish from called function"
-re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*function called from gdb.*$gdb_prompt $"\ }
{pass "finish from called function"} -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*function called from gdb.*$gdb_prompt $" {
-re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*Value returned.*$gdb_prompt $"\ pass "finish from called function"
{pass "finish from called function"} }
-re "$gdb_prompt $"\ -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*Value returned.*$gdb_prompt $" {
{fail "finish from called function"} pass "finish from called function"
timeout {fail "(timeout) finish from called function"} }
} }
# Verify that GDB responds gracefully to a "finish" command with # Verify that GDB responds gracefully to a "finish" command with
# arguments. # arguments.
# #
if ![runto_main] then { fail "break tests suppressed" } if ![runto_main] then { fail "sepdebug tests suppressed" }
send_gdb "finish 123\n" gdb_test "finish 123" \
gdb_expect { "The \"finish\" command does not take any arguments.*" \
-re "The \"finish\" command does not take any arguments.\r\n$gdb_prompt $"\ "finish with arguments disallowed"
{pass "finish with arguments disallowed"}
-re "$gdb_prompt $"\
{fail "finish with arguments disallowed"}
timeout {fail "(timeout) finish with arguments disallowed"}
}
# Verify that GDB responds gracefully to a request to "finish" from # Verify that GDB responds gracefully to a request to "finish" from
# the outermost frame. On a stub that never exits, this will just # the outermost frame. On a stub that never exits, this will just
@ -662,79 +521,47 @@ gdb_expect {
# second condition. # second condition.
# #
send_gdb "finish\n" gdb_test_multiple "finish" "finish from outermost frame disallowed" {
gdb_expect { -re "\"finish\" not meaningful in the outermost frame.*$gdb_prompt $" {
-re "\"finish\" not meaningful in the outermost frame.\r\n$gdb_prompt $"\ pass "finish from outermost frame disallowed"
{pass "finish from outermost frame disallowed"} }
-re "Run till exit from.*\r\n$gdb_prompt $" { -re "Run till exit from.*$gdb_prompt $" {
pass "finish from outermost frame disallowed" pass "finish from outermost frame disallowed"
} }
-re "$gdb_prompt $"\
{fail "finish from outermost frame disallowed"}
timeout {fail "(timeout) finish from outermost frame disallowed"}
} }
# Verify that we can explicitly ask GDB to stop on all shared library # Verify that we can explicitly ask GDB to stop on all shared library
# events, and that it does so. # events, and that it does so.
# #
if [istarget "hppa*-*-hpux*"] then { if [istarget "hppa*-*-hpux*"] then {
if ![runto_main] then { fail "break tests suppressed" } if ![runto_main] then { fail "sepdebug tests suppressed" }
send_gdb "set stop-on-solib-events 1\n" gdb_test_no_output "set stop-on-solib-events 1" \
gdb_expect { "set stop-on-solib-events"
-re "$gdb_prompt $"\
{pass "set stop-on-solib-events"}
timeout {fail "(timeout) set stop-on-solib-events"}
}
send_gdb "run\n" gdb_test "run" \
gdb_expect { "Stopped due to shared library event.*" \
-re ".*Start it from the beginning.*y or n. $"\ "triggered stop-on-solib-events" \
{send_gdb "y\n" "Start it from the beginning.*y or n. $" \
gdb_expect { "y"
-re ".*Stopped due to shared library event.*$gdb_prompt $"\
{pass "triggered stop-on-solib-events"}
-re "$gdb_prompt $"\
{fail "triggered stop-on-solib-events"}
timeout {fail "(timeout) triggered stop-on-solib-events"}
}
}
-re "$gdb_prompt $"\
{fail "rerun for stop-on-solib-events"}
timeout {fail "(timeout) rerun for stop-on-solib-events"}
}
send_gdb "set stop-on-solib-events 0\n" gdb_test_no_output "set stop-on-solib-events 0" \
gdb_expect { "reset stop-on-solib-events"
-re "$gdb_prompt $"\
{pass "reset stop-on-solib-events"}
timeout {fail "(timeout) reset stop-on-solib-events"}
}
} }
# Hardware breakpoints are unsupported on HP-UX. Verify that GDB # Hardware breakpoints are unsupported on HP-UX. Verify that GDB
# gracefully responds to requests to create them. # gracefully responds to requests to create them.
# #
if [istarget "hppa*-*-hpux*"] then { if [istarget "hppa*-*-hpux*"] then {
if ![runto_main] then { fail "break tests suppressed" } if ![runto_main] then { fail "sepdebug tests suppressed" }
send_gdb "hbreak\n" gdb_test "hbreak" \
gdb_expect { "No hardware breakpoint support in the target.*" \
-re "No hardware breakpoint support in the target.*$gdb_prompt $"\ "hw breaks disallowed"
{pass "hw breaks disallowed"}
-re "$gdb_prompt $"\
{fail "hw breaks disallowed"}
timeout {fail "(timeout) hw breaks disallowed"}
}
send_gdb "thbreak\n" gdb_test "thbreak" \
gdb_expect { "No hardware breakpoint support in the target.*" \
-re "No hardware breakpoint support in the target.*$gdb_prompt $"\ "temporary hw breaks disallowed"
{pass "temporary hw breaks disallowed"}
-re "$gdb_prompt $"\
{fail "temporary hw breaks disallowed"}
timeout {fail "(timeout) temporary hw breaks disallowed"}
}
} }
#******** #********
@ -905,27 +732,21 @@ proc test_different_dir {type test_different_dir xfail} {
set bp_location13 [gdb_get_line_number "set breakpoint 13 here"] set bp_location13 [gdb_get_line_number "set breakpoint 13 here"]
set bp_location14 [gdb_get_line_number "set breakpoint 14 here"] set bp_location14 [gdb_get_line_number "set breakpoint 14 here"]
send_gdb "continue\n"
if {$xfail} { if {$xfail} {
setup_xfail "*-*-*" setup_xfail "*-*-*"
} }
gdb_expect {
-re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { gdb_test_multiple "continue" "run until breakpoint set at small function, optimized file" {
-re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*$gdb_prompt $" {
pass "run until breakpoint set at small function, optimized file" pass "run until breakpoint set at small function, optimized file"
} }
-re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { -re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*$gdb_prompt $" {
pass "run until breakpoint set at small function, optimized file" pass "run until breakpoint set at small function, optimized file"
} }
-re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" { -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*$gdb_prompt $" {
# marker4() is defined at line 46 when compiled with -DPROTOTYPES # marker4() is defined at line 46 when compiled with -DPROTOTYPES
pass "run until breakpoint set at small function, optimized file (line bp_location14)" pass "run until breakpoint set at small function, optimized file (line bp_location14)"
} }
-re ".*$gdb_prompt " {
fail "run until breakpoint set at small function, optimized file"
}
timeout {
fail "run until breakpoint set at small function, optimized file (timeout)"
}
} }
@ -933,8 +754,7 @@ proc test_different_dir {type test_different_dir xfail} {
if [istarget "*-*-vxworks*"] { if [istarget "*-*-vxworks*"] {
set timeout 10 set timeout 10
verbose "Timeout is now $timeout seconds" 2 verbose "Timeout is now $timeout seconds" 2
send_gdb "set args main\n" gdb_test_no_output "set args main"
gdb_expect -re ".*$gdb_prompt $" {}
} }
set pf_prefix $old_pf_prefix set pf_prefix $old_pf_prefix

View file

@ -54,27 +54,25 @@ if { ![runto_main] } {
gdb_test "show annotate" "Annotation_level is 0..*" "default annotation_level is zero" gdb_test "show annotate" "Annotation_level is 0..*" "default annotation_level is zero"
#test set annotate 2 #test set annotate 2
send_gdb "set annotate 2\n"
gdb_expect {
-re ".*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \
{ pass "set annotate 2" }
timeout { fail "(timeout) set annotate 2" }
}
send_gdb "show annotate\n" gdb_test_multiple "set annotate 2" "set annotate 2" {
gdb_expect { -re ".*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" {
-re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \ pass "set annotate 2"
{ pass "show annotate (2)" }
timeout { fail "(timeout) show annotate (2)" }
} }
}
gdb_test_multiple "show annotate" "show annotate 2" {
-re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" {
pass "show annotate 2"
}
}
#test annotation_level 2 #test annotation_level 2
send_gdb "info line 1\n" gdb_test_multiple "info line 1" "annotation_level 2" {
gdb_expect { -re ".*\032\032post-prompt.*Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" {
-re ".*\032\032post-prompt.*Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \ pass "annotation_level 2"
{ pass "annotation_level 2" }
timeout { fail "(timeout) annotation_level 2" }
} }
}
#test set annotate 1 #test set annotate 1
gdb_test "set annotate 1" ".*post-prompt.*" "set annotate 1" gdb_test "set annotate 1" ".*post-prompt.*" "set annotate 1"
@ -195,25 +193,27 @@ gdb_test "show listsize" "Number of source lines gdb will list by default is 100
if ![board_info target exists gdb_prompt] { if ![board_info target exists gdb_prompt] {
#test set prompt (FooBarBaz) #test set prompt (FooBarBaz)
set newprompt "\\(FooBarBaz\\)" set newprompt "\\(FooBarBaz\\)"
send_gdb "set prompt (FooBarBaz) \n"
gdb_expect { gdb_test_multiple "set prompt (FooBarBaz) " "set prompt FooBarBaz" {
-re "$newprompt $" { pass "set prompt (FooBarBaz) " } -re "$newprompt $" {
timeout { fail "(timeout) set prompt (FooBarBaz) " } pass "set prompt FooBarBaz"
}
} }
#test show prompt (FooBarBaz) #test show prompt (FooBarBaz)
send_gdb "show prompt\n"
gdb_expect { gdb_test_multiple "show prompt" "show prompt FooBarBaz" {
-re "Gdb's prompt is \"$newprompt \"..* $" \ -re "Gdb's prompt is \"$newprompt \"..* $" {
{ pass "show prompt (FooBarBaz) " } pass "show prompt FooBarBaz"
timeout { fail "(timeout) show prompt (FooBarBaz) " } }
} }
#test set prompt (gdb) #test set prompt (gdb)
send_gdb "set prompt (gdb) \n"
gdb_expect { gdb_test_multiple "set prompt (gdb) " "set prompt gdb" {
-re "$gdb_prompt $" { pass "set prompt (gdb) " } -re "$gdb_prompt $" {
timeout { fail "(timeout) set prompt (gdb) " } pass "set prompt gdb"
}
} }
} }

View file

@ -51,7 +51,7 @@ gdb_load $binfile
# #
# set it up at a breakpoint so we canplay with the variable values # set it up at a breakpoint so we canplay with the variable values
# #
send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $" gdb_test_no_output "set print sevenbit-strings"
if ![runto_main] then { if ![runto_main] then {
perror "couldn't run to breakpoint" perror "couldn't run to breakpoint"
@ -61,20 +61,16 @@ if ![runto_main] then {
# Determine expected output for unsigned long variables, # Determine expected output for unsigned long variables,
# the output varies with sizeof (unsigned long). # the output varies with sizeof (unsigned long).
set ulong_minus_1 4294967295 gdb_test_multiple "print sizeof (unsigned long)" "sizeof ulong" {
set ulong_minus_456 4294966840 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
send_gdb "print sizeof (unsigned long)\n" set ulong_minus_1 4294967295
gdb_expect { set ulong_minus_456 4294966840
-re ".\[0-9\]* = 4.*$gdb_prompt $" {} }
-re ".\[0-9\]* = 8.*$gdb_prompt $" { -re ".\[0-9\]* = 8.*$gdb_prompt $" {
set ulong_minus_1 18446744073709551615 set ulong_minus_1 18446744073709551615
set ulong_minus_456 18446744073709551160 set ulong_minus_456 18446744073709551160
} }
-re ".*$gdb_prompt $" { }
fail "getting sizeof unsigned long"
}
default { fail "(timeout) getting sizeof unsigned long" }
}
proc test_set { args } { proc test_set { args } {
global gdb_prompt global gdb_prompt

View file

@ -70,9 +70,9 @@ gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile} gdb_load ${binfile}
gdb_load_shlibs $lib1 $lib2 gdb_load_shlibs $lib1 $lib2
send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $" gdb_test_no_output "set print sevenbit-strings"
send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $" gdb_test_no_output "set print address off"
send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $" gdb_test_no_output "set width 0"
if ![runto_main] then { if ![runto_main] then {
@ -82,74 +82,38 @@ if ![runto_main] then {
#step -over #step -over
send_gdb "next\n" gdb_test "next" "g = shr1\\(g\\);" "next to shr1"
gdb_expect {
-re ".*g = shr1\\(g\\).*$gdb_prompt $" {pass "next to shr1"}
-re ".*$gdb_prompt $" { fail "next to shr1" }
timeout { fail "next to shr1 (timeout)" }
}
#print g #print g
send_gdb "print g\n" gdb_test "print g" "\[0-9\]* = 1" "print g"
gdb_expect {
-re ".*\[0-9\]* = 1.*$gdb_prompt $" {
pass "print g"
}
-re ".*$gdb_prompt $" { fail "print g" }
timeout { fail "(timeout) print g" }
}
#step -over #step -over
if ![gdb_skip_stdio_test "next over shr1"] { if ![gdb_skip_stdio_test "next over shr1"] {
send_gdb "next\n" gdb_test "next" \
gdb_expect { "address of sgs is $hex.*g = shr2\\(g\\);" \
-re ".*address of sgs is $hex.*g = shr2\\(g\\).*$gdb_prompt $" { "next over shr1"
pass "next over shr1" } else {
} gdb_test "next" "" ""
-re ".*$gdb_prompt $" { fail "next over shr1" } }
timeout { fail "next over shr1 (timeout)" }
}
} else {
gdb_test "next" "" ""
}
#print g #print g
send_gdb "print g\n" gdb_test "print g" "\[0-9\]* = 2" "print g"
gdb_expect {
-re ".*\[0-9\]* = 2.*$gdb_prompt $" {
pass "print g" }
-re ".*$gdb_prompt $" { fail "print g" }
timeout { fail "(timeout) print g" }
}
#print shr1(1) #print shr1(1)
if ![gdb_skip_stdio_test "print shr1(1)"] { if ![gdb_skip_stdio_test "print shr1(1)"] {
send_gdb "print shr1(1)\n" gdb_test "print shr1(1)" \
gdb_expect { "address of sgs is $hex.*\[0-9\]* = 2" \
-re ".*address of sgs is $hex.*\[0-9\]* = 2.*$gdb_prompt $" { "print shr1(1)"
pass "print shr1(1)" }
}
-re ".*$gdb_prompt $" { fail "print shr1(1)" }
timeout { fail "(timeout) print shr1(1)" }
}
}
#print shr1(g) #print shr1(g)
if ![gdb_skip_stdio_test "print shr1(g)"] { if ![gdb_skip_stdio_test "print shr1(g)"] {
send_gdb "print shr1(g)\n" gdb_test "print shr1(g)" \
gdb_expect { "address of sgs is $hex.*\[0-9\]* = 4" \
-re ".*address of sgs is $hex.*\[0-9\]* = 4.*$gdb_prompt $" { "print shr1(g)"
pass "print shr1(g)" }
}
-re ".*$gdb_prompt $" { fail "print shr1(g)" }
timeout { fail "(timeout) print shr1(g)" }
}
}
#break shr2 #break shr2
#go #go
@ -164,67 +128,38 @@ gdb_test "continue" \
#print shr1(1) #print shr1(1)
if ![gdb_skip_stdio_test "print shr1(1) 2nd time"] { if ![gdb_skip_stdio_test "print shr1(1) 2nd time"] {
send_gdb "print shr1(1)\n" gdb_test "print shr1(1)" \
gdb_expect { "address of sgs is $hex.*\[0-9\]* = 2" \
-re ".*address of sgs is $hex.*\[0-9\]* = 2.*$gdb_prompt $" { "print shr1(1) 2nd time"
pass "print shr1(1) 2nd time"
}
-re ".*$gdb_prompt $" { fail "print shr1(1) 2nd time" }
timeout { fail "(timeout) print shr1(1) 2nd time" }
}
} }
#print mainshr1(1) #print mainshr1(1)
send_gdb "print mainshr1(1)\n" gdb_test "print mainshr1(1)" "\[0-9\]* = 2" \
gdb_expect { "print mainshr1(1) from shlib func"
-re ".*\[0-9\]* = 2.*$gdb_prompt $" {
pass "print mainshr1(1) from shlib func"
}
-re ".*$gdb_prompt $" { fail "print mainshr1(1) from shlib func" }
timeout { fail "(timeout) print mainshr1(1) from shlib func" }
}
#step -return #step -return
send_gdb "step\n" # A step at this point will either take us entirely out of
# A step at this point will either take us entirely out of # the function or into the function's epilogue. The exact
# the function or into the function's epilogue. The exact # behavior will differ depending upon upon whether or not
# behavior will differ depending upon upon whether or not # the compiler emits line number information for the epilogue.
# the compiler emits line number information for the epilogue. gdb_test_multiple "step" "step out of shr2 to main" {
gdb_expect { -re "main \\(\\) at.*g = mainshr1\\(g\\);.*$gdb_prompt $" {
-re "main \\(\\) at.*g = mainshr1\\(g\\);.*$gdb_prompt $" { pass "step out of shr2 to main"
pass "step out of shr2 to main"
}
-re ".*\\\}.*$gdb_prompt $" {
pass "step out of shr2 to main (stopped in shr2 epilogue)"
send_gdb "step\n"
gdb_expect {
-re "main \\(\\) at.*g = mainshr1\\(g\\);.*$gdb_prompt $" { pass "step out of shr2 epilogue to main"}
-re ".*$gdb_prompt $" { fail "step out of shr2 epilogue to main" }
timeout { fail "step out of shr2 epilogue to main (timeout)" }
}
}
-re ".*$gdb_prompt $" { fail "step out of shr2" }
timeout { fail "step out of shr2 to main (timeout)" }
} }
-re ".*\\\}.*$gdb_prompt $" {
pass "step out of shr2 to main (stopped in shr2 epilogue)"
gdb_test "step" \
"main \\(\\) at.*g = mainshr1\\(g\\);" \
"step out of shr2 epilogue to main"
}
}
#print mainshr1(1) #print mainshr1(1)
send_gdb "print mainshr1(1)\n" gdb_test "print mainshr1(1)" "\[0-9\]* = 2" "print mainshr1(1)"
gdb_expect {
-re ".*\[0-9\]* = 2.*$gdb_prompt $" {
pass "print mainshr1(1)"
}
-re ".*$gdb_prompt $" { fail "print mainshr1(1) from main" }
timeout { fail "(timeout) print mainshr1(1) from main" }
}
#step #step
send_gdb "step\n" gdb_test "step" "mainshr1 \\(g=4\\) at.*return 2.g;" \
gdb_expect { "step into mainshr1"
-re ".*mainshr1 \\(g=4\\) at.*return 2.g;.*$gdb_prompt $" { pass "step into mainshr1"}
-re ".*$gdb_prompt $" { fail "step into mainshr1" }
timeout { fail "step into mainshr1 (timeout)" }
}
# Start with a fresh gdb. # Start with a fresh gdb.
@ -232,9 +167,10 @@ gdb_exit
gdb_start gdb_start
gdb_reinitialize_dir $srcdir/$subdir gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile} gdb_load ${binfile}
send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $" gdb_test_no_output "set print sevenbit-strings"
send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $" gdb_test_no_output "set print address off"
send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $" gdb_test_no_output "set width 0"
# PR's 16495, 18213 # PR's 16495, 18213
# test that we can re-set breakpoints in shared libraries # test that we can re-set breakpoints in shared libraries

View file

@ -91,29 +91,25 @@ if ![runto_main] then {
} }
proc get_var_address { var } { proc get_var_address { var } {
global gdb_prompt hex global gdb_prompt hex
send_gdb "print &${var}\n" # Match output like:
# Match output like: # $1 = (int *) 0x0
# $1 = (int *) 0x0 # $5 = (int (*)()) 0
# $5 = (int (*)()) 0 # $6 = (int (*)()) 0x24 <function_bar>
# $6 = (int (*)()) 0x24 <function_bar>
gdb_expect { gdb_test_multiple "print &${var}" "get address of ${var}" {
-re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $" -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $"
{ {
pass "get address of ${var}" pass "get address of ${var}"
if { $expect_out(1,string) == "0" } { if { $expect_out(1,string) == "0" } {
return "0x0" return "0x0"
} else { } else {
return $expect_out(1,string) return $expect_out(1,string)
} }
} }
-re "${gdb_prompt} $" }
{ fail "get address of ${var} (unknown output)" } return ""
timeout
{ fail "get address of ${var} (timeout)" }
}
return ""
} }
# #
@ -159,10 +155,8 @@ proc send_gdb_discard { command } {
global gdb_prompt global gdb_prompt
send_gdb "${command}\n"
# Discard output # Discard output
gdb_expect { gdb_test_multiple "${command}" "${command}" {
-re ".*\[\r\n]+${gdb_prompt} $" { -re ".*\[\r\n]+${gdb_prompt} $" {
return 1 return 1
} }

View file

@ -54,22 +54,12 @@ proc test_one_sig {nextsig} {
set need_another_continue 1 set need_another_continue 1
set missed_handler 0 set missed_handler 0
if $this_sig_supported then { if $this_sig_supported then {
send_gdb "continue\n"
if { $thissig == "IO" } { if { $thissig == "IO" } {
setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu" setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
} }
gdb_expect { gdb_test "continue" \
-re "Continuing.*Program received signal SIG$thissig.*$gdb_prompt $" { "Continuing.*Program received signal SIG$thissig.*" \
pass "get signal $thissig" "get signal $thissig"
}
-re ".*$gdb_prompt $" {
fail "get signal $thissig"
set need_another_continue 0
}
default {
fail "get signal $thissig (eof or timeout)"
}
}
} }
if [ istarget "alpha-dec-osf3*" ] then { if [ istarget "alpha-dec-osf3*" ] then {
# OSF/1-3.x is unable to continue with a job control stop signal. # OSF/1-3.x is unable to continue with a job control stop signal.
@ -84,7 +74,6 @@ proc test_one_sig {nextsig} {
} }
if $need_another_continue then { if $need_another_continue then {
send_gdb "continue\n"
if { $thissig == "URG" } { if { $thissig == "URG" } {
setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu" setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
} }
@ -92,7 +81,7 @@ proc test_one_sig {nextsig} {
if { $thissig == "PRIO" } { if { $thissig == "PRIO" } {
setup_xfail "*-*-*lynx*" setup_xfail "*-*-*lynx*"
} }
gdb_expect { gdb_test_multiple "continue" "send signal $thissig" {
-re "Breakpoint.*handle_$thissig.*$gdb_prompt $" { -re "Breakpoint.*handle_$thissig.*$gdb_prompt $" {
pass "send signal $thissig" pass "send signal $thissig"
} }
@ -104,8 +93,7 @@ proc test_one_sig {nextsig} {
} }
if { $missed_handler == "0" } then { if { $missed_handler == "0" } then {
send_gdb "signal 0\n" gdb_test_multiple "signal 0" "advance to $nextsig" {
gdb_expect {
-re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" { -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
pass "advance to $nextsig" pass "advance to $nextsig"
set sig_supported 1 set sig_supported 1
@ -114,8 +102,6 @@ proc test_one_sig {nextsig} {
pass "advance to $nextsig" pass "advance to $nextsig"
set sig_supported 0 set sig_supported 0
} }
-re ".*$gdb_prompt $" { fail "advance to $nextsig" }
default { fail "advance to $nextsig (eof or timeout)" }
} }
} }
set thissig $nextsig set thissig $nextsig

View file

@ -65,8 +65,7 @@ if ![runto_main] then {
# especially on targets without an MMU. Don't run the tests in that # especially on targets without an MMU. Don't run the tests in that
# case. # case.
send_gdb "x 0\n" gdb_test_multiple "x 0" "memory at address 0" {
gdb_expect {
-re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { } -re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { }
-re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { } -re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { }
-re ".*$gdb_prompt $" { -re ".*$gdb_prompt $" {

View file

@ -64,8 +64,7 @@ if ![runto_main] then {
# especially on targets without an MMU. Don't run the tests in that # especially on targets without an MMU. Don't run the tests in that
# case. # case.
send_gdb "x 0\n" gdb_test_multiple "x 0" "memory at address 0" {
gdb_expect {
-re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { } -re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { }
-re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { } -re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { }
-re ".*$gdb_prompt $" { -re ".*$gdb_prompt $" {

View file

@ -65,59 +65,30 @@ if ![runto_main] then { fail "implicit solibs tests suppressed" }
# Verify that we can step over the first shlib call. # Verify that we can step over the first shlib call.
# #
send_gdb "next\n" gdb_test "next" "21\[ \t\]*result = solib_main .result.;" \
gdb_expect { "step over solib call"
-re "21\[ \t\]*result = solib_main .result.*$gdb_prompt $"\
{pass "step over solib call"}
-re "$gdb_prompt $"\
{fail "step over solib call"}
timeout {fail "(timeout) step over solib call"}
}
# Verify that we can step into the second shlib call. # Verify that we can step into the second shlib call.
# #
send_gdb "step\n" gdb_test "step" "solib_main .arg=10000. at.*${libfile}.c:17.*" \
gdb_expect { "step into solib call"
-re "solib_main .arg=10000. at.*${libfile}.c:17.*$gdb_prompt $"\
{pass "step into solib call"}
-re "$gdb_prompt $"\
{fail "step into solib call"}
timeout {fail "(timeout) step into solib call"}
}
# Verify that we can step within the shlib call. # Verify that we can step within the shlib call.
# #
send_gdb "next\n" gdb_test "next" "18\[ \t\]*\}" "step in solib call"
gdb_expect {
-re "18\[ \t\]*\}.*$gdb_prompt $"\
{pass "step in solib call"}
-re "$gdb_prompt $"\
{fail "step in solib call"}
timeout {fail "(timeout) step in solib call"}
}
# Verify that we can step out of the shlib call, and back out into # Verify that we can step out of the shlib call, and back out into
# the caller. # the caller.
# #
send_gdb "next\n" gdb_test_multiple "next" "step out of solib call" {
gdb_expect {
-re "0x\[0-9a-f\]*\[ \t\]*9\[ \t\]*.*$gdb_prompt $" { -re "0x\[0-9a-f\]*\[ \t\]*9\[ \t\]*.*$gdb_prompt $" {
# we haven't left the callee yet, so do another next gdb_test "next" \
send_gdb "next\n" "main .. at.*so-impl-ld.c:22.*" \
gdb_expect { "step out of solib call"
-re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\ }
{pass "step out of solib call"} -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $" {
-re "$gdb_prompt $"\ pass "step out of solib call"
{fail "step out of solib call"}
timeout {fail "(timeout) step out of solib call"}
}
} }
-re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\
{pass "step out of solib call"}
-re "$gdb_prompt $"\
{fail "step out of solib call"}
timeout {fail "(timeout) step out of solib call"}
} }
gdb_exit gdb_exit

View file

@ -62,9 +62,10 @@ gdb_exit
gdb_start gdb_start
gdb_reinitialize_dir $srcdir/$subdir gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile} gdb_load ${binfile}
send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $" gdb_test_no_output "set print sevenbit-strings"
send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $" gdb_test_no_output "set print address off"
send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $" gdb_test_no_output "set width 0"
if [gdb_skip_stdio_test "varargs.exp"] { if [gdb_skip_stdio_test "varargs.exp"] {
# Nothing in this module is testable without printf. # Nothing in this module is testable without printf.
@ -89,57 +90,25 @@ if { $hp_aCC_compiler } {
gdb_test "set overload-resolution 0" "" gdb_test "set overload-resolution 0" ""
} }
send_gdb "print find_max1(5,1,2,3,4,5)\n" gdb_test "print find_max1(5,1,2,3,4,5)" \
gdb_expect { "find_max\\(5, 1, 2, 3, 4, 5\\) returns 5\[ \r\n\]+.\[0-9\]+ = 5" \
-re ".*find_max\\(5, 1, 2, 3, 4, 5\\) returns 5\[ \r\n\]+.\[0-9\]+ = 5.*$gdb_prompt $" { "print find_max1(5,1,2,3,4,5)"
pass "print find_max1(5,1,2,3,4,5)"
}
-re ".*$gdb_prompt $" { fail "print find_max1(5,1,2,3,4,5)" }
timeout { fail "(timeout) print find_max1(5,1,2,3,4,5)" }
}
gdb_test "print find_max1(1,3)" \
".*find_max\\(1, 3\\) returns 3\[ \r\n\]+.\[0-9\]+ = 3" \
"print find_max1(1,3)"
gdb_test "print find_max1(10,1,2,3,4,5,6,7,8,29,0)" \
".*find_max\\(10, 1, 2, 3, 4, 5, 6, 7, 8, 29, 0\\) returns 29\[ \r\n\]+.\[0-9\]+ = 29" \
"print find_max1(10,1,2,3,4,5,6,7,8,29,0)"
gdb_test "print find_max2(3,1,2,3)" \
send_gdb "print find_max1(1,3)\n" ".*find_max\\(3, 1, 2, 3\\) returns 3\[ \r\n\]+.\[0-9\]+ = 3" \
gdb_expect { "print find_max2(3,1,2,3)"
-re ".*find_max\\(1, 3\\) returns 3\[ \r\n\]+.\[0-9\]+ = 3.*$gdb_prompt $" {
pass "print find_max1(1,3)"
}
-re ".*$gdb_prompt $" { fail "print find_max1(1,3)" }
timeout { fail "(timeout) print find_max1(1,3)" }
}
send_gdb "print find_max1(10,1,2,3,4,5,6,7,8,29,0)\n"
gdb_expect {
-re ".*find_max\\(10, 1, 2, 3, 4, 5, 6, 7, 8, 29, 0\\) returns 29\[ \r\n\]+.\[0-9\]+ = 29.*$gdb_prompt $" {
pass "print find_max1(10,1,2,3,4,5,6,7,8,29,0)"
}
-re ".*$gdb_prompt $" { fail "print find_max1(10,1,2,3,4,5,6,7,8,29,0)" }
timeout { fail "(timeout) print find_max1(10,1,2,3,4,5,6,7,8,29,0)" }
}
send_gdb "print find_max2(3,1,2,3)\n"
gdb_expect {
-re ".*find_max\\(3, 1, 2, 3\\) returns 3\[ \r\n\]+.\[0-9\]+ = 3.*$gdb_prompt $" {
pass "print find_max2(3,1,2,3)"
}
-re ".*$gdb_prompt $" { fail "print find_max2(3,1,2,3)" }
timeout { fail "(timeout) print find_max2(3,1,2,3)" }
}
if {![target_info exists gdb,skip_float_tests]} { if {![target_info exists gdb,skip_float_tests]} {
send_gdb "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)\n" gdb_test "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)" \
gdb_expect { ".*find_max\\(.*\\) returns 17\\.000000\[ \r\n\]+.\[0-9\]+ = 17" \
-re ".*find_max\\(.*\\) returns 17\\.000000\[ \r\n\]+.\[0-9\]+ = 17.*$gdb_prompt $" { "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)"
pass "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)"
}
-re ".*$gdb_prompt $" { fail "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)" }
timeout { fail "(timeout) print find_max_double(5,1.0,17.0,2.0,3.0,4.0)" }
}
} }

View file

@ -87,28 +87,17 @@ proc local_compiler_xfail_check_2 { } {
} }
} }
send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" gdb_test "break marker1" "" ""
send_gdb "cont\n" gdb_test_multiple "cont" "continue to marker1" {
gdb_expect { -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
-re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" { pass "continue to marker1"
send_gdb "up\n"
gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "up from marker1" }
}
}
-re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
fail "continue to marker1 (demangling)"
send_gdb "up\n"
gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "up from marker1" }
}
}
-re "$gdb_prompt $" { fail "continue to marker1" }
timeout { fail "(timeout) continue to marker1" }
} }
-re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
fail "continue to marker1 (demangling)"
}
}
gdb_test "up" " in main .*" "up from marker1"
# As of Feb 1999, GCC does not issue info about volatility of vars, so # As of Feb 1999, GCC does not issue info about volatility of vars, so
# these tests are all expected to fail if GCC is the compiler. -sts # these tests are all expected to fail if GCC is the compiler. -sts
@ -248,11 +237,7 @@ gdb_test "ptype vendor" "type = const volatile unsigned char \\* const volatile.
# test function parameters # test function parameters
local_compiler_xfail_check local_compiler_xfail_check
local_compiler_xfail_check_2 local_compiler_xfail_check_2
send_gdb "ptype qux2\n"
gdb_expect { gdb_test "ptype qux2" \
-re "type = int \\(volatile unsigned char, const volatile int, volatile short( int)?, volatile long( int)? \\*, float \\* volatile, const volatile signed char \\* const volatile\\).*$gdb_prompt $" { "type = int \\(volatile unsigned char, const volatile int, volatile short( int)?, volatile long( int)? \\*, float \\* volatile, const volatile signed char \\* const volatile\\)" \
pass "ptype qux2" "ptype qux2"
}
-re ".*$gdb_prompt $" { fail "ptype qux2" }
timeout { fail "(timeout) ptype qux2" }
}

View file

@ -62,11 +62,10 @@ gdb_test "break thread_function" "Breakpoint \[0-9\].*" \
gdb_test "continue" ".*Breakpoint 2.*" "Stopped in thread_function" gdb_test "continue" ".*Breakpoint 2.*" "Stopped in thread_function"
send_gdb "thread\n" gdb_test_multiple "thread" "Thread command" {
gdb_expect { -re ".*Current thread is (\[0-9\]*).*$gdb_prompt $" {
-re ".*Current thread is (\[0-9\]*).*$gdb_prompt $" { pass "Thread command" } pass "Thread command"
-re ".*$gdb_prompt $" { fail "Thread command" } }
timeout { fail "(timeout) Thread command" }
} }
set thread_num "$expect_out(1,string)" set thread_num "$expect_out(1,string)"

View file

@ -161,40 +161,21 @@ proc test_simple_watchpoint {} {
# watches without a running inferior. The following testpoints used # watches without a running inferior. The following testpoints used
# to be in [initialize]. # to be in [initialize].
# #
send_gdb "watch ival3\n" gdb_test "watch ival3" \
gdb_expect { "\[Ww\]atchpoint 3: ival3" \
-re ".*\[Ww\]atchpoint 3: ival3\r\n$gdb_prompt $" { "set watchpoint on ival3"
pass "set watchpoint on ival3"
}
-re ".*$gdb_prompt $" { fail "set watchpoint on ival3" }
timeout { fail "set watchpoint on ival3 (timeout)" }
}
set wp_set 1 set wp_set 1
send_gdb "info watch\n" gdb_test "info watch" \
gdb_expect { "3\[ \]*.*watchpoint.*ival3" \
-re "3\[ \]*.*watchpoint.*ival3\r\n$gdb_prompt $" { "watchpoint found in watchpoint/breakpoint table"
pass "watchpoint found in watchpoint/breakpoint table"
}
-re ".*$gdb_prompt $" {
fail "watchpoint found in watchpoint/breakpoint table"
}
timeout {
fail "watchpoint found in watchpoint/breakpoint table"
}
}
# After installing the watchpoint, we disable it until we are ready # After installing the watchpoint, we disable it until we are ready
# to use it. This allows the test program to run at full speed until # to use it. This allows the test program to run at full speed until
# we get to the first marker function. # we get to the first marker function.
send_gdb "disable 3\n" gdb_test "disable 3" "disable 3" "disable watchpoint"
gdb_expect {
-re "disable 3\[\r\n\]+$gdb_prompt $" { pass "disable watchpoint" }
-re ".*$gdb_prompt $" { fail "disable watchpoint" }
timeout { fail "disable watchpoint (timeout)" }
}
} }
# After reaching the marker function, enable the watchpoint. # After reaching the marker function, enable the watchpoint.
@ -455,6 +436,7 @@ proc test_watchpoint_triggered_in_syscall {} {
# If we send_gdb "123\n" before gdb has switched the tty, then it goes # If we send_gdb "123\n" before gdb has switched the tty, then it goes
# to gdb, not the inferior, and we lose. So that is why we have # to gdb, not the inferior, and we lose. So that is why we have
# watchpoint.c prompt us, so we can wait for that prompt. # watchpoint.c prompt us, so we can wait for that prompt.
send_gdb "continue\n"; send_gdb "continue\n";
gdb_expect { gdb_expect {
-re "Continuing\\.\r\ntype stuff for buf now:" { -re "Continuing\\.\r\ntype stuff for buf now:" {