aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2010-05-27 23:44:51 +0000
committerMichael Snyder <msnyder@vmware.com>2010-05-27 23:44:51 +0000
commit02746bbc9f260f92b3abb96d862f4e75fd6f3fc0 (patch)
treeed11da9352953a731de7da35b050de94f2979877 /gdb
parent2245442480a7de9c1e2364416b928500ad87bcab (diff)
downloadgdb-02746bbc9f260f92b3abb96d862f4e75fd6f3fc0.zip
gdb-02746bbc9f260f92b3abb96d862f4e75fd6f3fc0.tar.gz
gdb-02746bbc9f260f92b3abb96d862f4e75fd6f3fc0.tar.bz2
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog18
-rw-r--r--gdb/testsuite/gdb.base/relational.exp363
-rw-r--r--gdb/testsuite/gdb.base/relocate.exp39
-rw-r--r--gdb/testsuite/gdb.base/restore.exp15
-rw-r--r--gdb/testsuite/gdb.base/return.exp31
-rw-r--r--gdb/testsuite/gdb.base/return2.exp43
-rw-r--r--gdb/testsuite/gdb.base/sepdebug.exp510
-rw-r--r--gdb/testsuite/gdb.base/setshow.exp56
-rw-r--r--gdb/testsuite/gdb.base/setvar.exp18
-rw-r--r--gdb/testsuite/gdb.base/shlib-call.exp162
-rw-r--r--gdb/testsuite/gdb.base/shreloc.exp42
-rw-r--r--gdb/testsuite/gdb.base/sigall.exp24
-rw-r--r--gdb/testsuite/gdb.base/sigbpt.exp3
-rw-r--r--gdb/testsuite/gdb.base/signull.exp3
-rw-r--r--gdb/testsuite/gdb.base/so-impl-ld.exp53
-rw-r--r--gdb/testsuite/gdb.base/varargs.exp69
-rw-r--r--gdb/testsuite/gdb.base/volatile.exp43
-rw-r--r--gdb/testsuite/gdb.base/watch_thread_num.exp9
-rw-r--r--gdb/testsuite/gdb.base/watchpoint.exp34
19 files changed, 449 insertions, 1086 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 2600867..07d446f 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,6 +1,24 @@
2010-05-27 Michael Snyder <msnyder@msnyder-server.eng.vmware.com>
* 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>
diff --git a/gdb/testsuite/gdb.base/relational.exp b/gdb/testsuite/gdb.base/relational.exp
index c0b3dba..10eb35a 100644
--- a/gdb/testsuite/gdb.base/relational.exp
+++ b/gdb/testsuite/gdb.base/relational.exp
@@ -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 w=3" "" "set variable w=3"
-send_gdb "print x\n"
-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" }
- }
-
-
-send_gdb "print y\n"
-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_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_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" }
- }
-
-
-
-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 ".*$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" " = 14" "print value of x"
+gdb_test "print y" " = 2" "print value of y"
+
+gdb_test "print z" " = 2" "print value of z"
+
+gdb_test "print w" " = 3" "print value of w"
+
+gdb_test "print x < y" "$false" "print value of x<y"
+
+gdb_test "print x <= y" "$false" "print value of x<=y"
+
+gdb_test "print x > y" "$true" "print value of x>y"
+
+gdb_test "print x >= y" "$true" "print value of x>=y"
+
+gdb_test "print x == y" "$false" "print value of x==y"
+
+gdb_test "print x != y" "$true" "print value of x!=y"
# 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 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_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 ".*$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 "print x > y > z" "$false" "print value of x>y>z"
+
+gdb_test "print x >= y >= z" "$false" "print value of x>=y>=z"
gdb_test "set variable x=2" "" "set variable x"
gdb_test "set variable y=2" "" "set variable y"
gdb_test "set variable z=1" "" "set variable 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 "print x == y == z" "$true" "print value of x==y==z"
gdb_test "set variable z=0" "" "set variable 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 "print x != y != z" "$false" "print value of x!=y!=z"
# 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 z=2" "" "set variable 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" }
- }
+gdb_test "print x < y == z" "$false" "print value of x<y==z"
# 0 2 2
-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 "print x < y != z" "$true" "print value of x<y!=z"
gdb_test "set variable x=2" "" "set variable x"
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
-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 "print x < y <= z" "$true" "print value of x<y<=z"
# 2 3 1
-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 "print x < y >= z" "$true" "print value of x<y>=z"
gdb_test "set variable z=0" "" " set variable z"
-
# 2 3 0
-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 "print x < y > z" "$true" "print value of x<y>z"
gdb_test "set variable x=1" "" " set variable x"
# 1 3 0
-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 "print x > y >= z" "$true" "print value of x>y>=z"
gdb_test "set variable z=2" "" " set variable z"
# 1 3 2
-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" }
- }
-
+gdb_test "print x > y == z" "$false" "print value of x>y==z"
gdb_test "set variable x=2" "" " set variable x"
gdb_test "set variable z=0" "" " set variable z"
# 2 3 0
-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" }
- }
-
+gdb_test "print x > y != z" "$false" "print value of x>y!=z"
gdb_test "set variable x=4" "" "set x to 4"
# 4 3 0
-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" }
- }
+gdb_test "print x > y <= z" "$false" "print value of x>y<=z"
# 4 3 0
-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 "print x >= y == z" "$false" "print value of x>=y==z"
gdb_test "set variable x=2" "" " set variable x"
# 2 3 0
-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 "print x >= y != z" "$false" "print value of x>=y!=z"
gdb_test "set variable x=0" "" " set variable x"
gdb_test "set variable z=4" "" " set variable z"
# 0 3 4
-send_gdb "print x >= y <= z\n"
-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" }
- }
+gdb_test "print x >= y <= z" "$true" "print value of x>=y<=z"
# 0 3 4
-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 "print x <= y == z" "$false" "print value of x<=y==z"
gdb_test "set variable x=2" "" " set variable x"
# 2 3 4
-send_gdb "print x <= y != z\n"
-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" }
- }
-
+gdb_test "print x <= y != z" "$true" "print value of x<=y!=z"
# 2 3 4
-send_gdb "print x == y != z\n"
-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" }
- }
+gdb_test "print x == y != z" "$true" "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"
# 2 3 0
-send_gdb "print x >= (y < z)\n"
-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)" }
- }
-
+gdb_test "print x >= (y < z)" "$true" "print value of x>=(y<z)"
# 2 3 0
-send_gdb "print x >= (y != z)\n"
-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)" }
- }
+gdb_test "print x >= (y != z)" "$true" "print value of x>=(y!=z)"
# 2 3 0
-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 "print x == (y == z)" "$false" "print value of x==(y==z)"
gdb_test "set variable x=1" "" " set variable x"
gdb_test "set variable z=4" "" " set variable z"
# 1 3 4
-send_gdb "print (x == y) < z\n"
-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" }
- }
-
-
-
-
-
+gdb_test "print (x == y) < z" "$true" "print value of (x==y)<z"
diff --git a/gdb/testsuite/gdb.base/relocate.exp b/gdb/testsuite/gdb.base/relocate.exp
index 4c58ba8..8943c59 100644
--- a/gdb/testsuite/gdb.base/relocate.exp
+++ b/gdb/testsuite/gdb.base/relocate.exp
@@ -32,29 +32,24 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug}]
}
proc get_var_address { var } {
- global gdb_prompt hex
-
- send_gdb "print &${var}\n"
- # Match output like:
- # $1 = (int *) 0x0
- # $5 = (int (*)()) 0
- # $6 = (int (*)()) 0x24 <function_bar>
- gdb_expect {
- -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $"
- {
- pass "get address of ${var}"
- if { $expect_out(1,string) == "0" } {
- return "0x0"
- } else {
- return $expect_out(1,string)
- }
+ global gdb_prompt hex
+
+ # Match output like:
+ # $1 = (int *) 0x0
+ # $5 = (int (*)()) 0
+ # $6 = (int (*)()) 0x24 <function_bar>
+
+ gdb_test_multiple "print &${var}" "get address of ${var}" {
+ -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $" {
+ pass "get address of ${var}"
+ if { $expect_out(1,string) == "0" } {
+ return "0x0"
+ } else {
+ return $expect_out(1,string)
+ }
}
- -re "${gdb_prompt} $"
- { fail "get address of ${var} (unknown output)" }
- timeout
- { fail "get address of ${var} (timeout)" }
- }
- return ""
+ }
+ return ""
}
diff --git a/gdb/testsuite/gdb.base/restore.exp b/gdb/testsuite/gdb.base/restore.exp
index bd4e645..4a2eb87 100644
--- a/gdb/testsuite/gdb.base/restore.exp
+++ b/gdb/testsuite/gdb.base/restore.exp
@@ -69,15 +69,12 @@ proc restore_tests { } {
# Do a forced return from the callee.
set test "caller$c calls callee$e; return callee now"
- gdb_test_multiple "return 0" "$test" {
- -re "Make .* return now.*y or n. $" {
- send_gdb "y\n"
- exp_continue
- }
- -re " caller$c .*$gdb_prompt $" {
- pass "$test"
- }
- }
+
+ gdb_test "return 0" \
+ " caller$c .*" \
+ "$test" \
+ "Make .* return now.*y or n. $" \
+ "y"
# Check that the values of the local variables are what
# they should be.
diff --git a/gdb/testsuite/gdb.base/return.exp b/gdb/testsuite/gdb.base/return.exp
index 66c8287..f1b9fd7 100644
--- a/gdb/testsuite/gdb.base/return.exp
+++ b/gdb/testsuite/gdb.base/return.exp
@@ -25,8 +25,8 @@ proc return_tests { } {
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. $" {
send_gdb "y\n"
exp_continue
@@ -35,9 +35,9 @@ proc return_tests { } {
send_gdb "step\n"
exp_continue
}
- -re ".*in main after func1.*$gdb_prompt $" { pass "simple return" }
- -re "$gdb_prompt $" { fail "simple return" }
- timeout { fail "(timeout) simple return" }
+ -re ".*in main after func1.*$gdb_prompt $" {
+ pass "simple return"
+ }
}
# Set breakpoints in other interesting functions.
@@ -45,16 +45,17 @@ proc return_tests { } {
gdb_test "break func3" "" "break func3"
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. $" {
send_gdb "y\n"
exp_continue
}
- -re ".*tmp2 = func2.*$gdb_prompt $" { }
- -re "$gdb_prompt $" { fail "did not return (integer test)" }
- timeout { fail "(timeout) did not return (integer test)" }
+ -re ".*tmp2 = func2.*$gdb_prompt $" {
+ # pass without comment
+ }
}
+
gdb_test "next" "tmp3 = func3.*" "next over call to func2"
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
# in memory).
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. $" {
send_gdb "y\n"
exp_continue
}
- -re ".*tmp3 = func3.*$gdb_prompt $" { }
- -re "$gdb_prompt $" { fail "did not return (double test)" }
- timeout { fail "(timeout) did not return (double test)" }
+ -re ".*tmp3 = func3.*$gdb_prompt $" {
+ # pass without comment
+ }
}
setup_xfail "m6811-*-*"
diff --git a/gdb/testsuite/gdb.base/return2.exp b/gdb/testsuite/gdb.base/return2.exp
index a1284dc..f3d69d4 100644
--- a/gdb/testsuite/gdb.base/return2.exp
+++ b/gdb/testsuite/gdb.base/return2.exp
@@ -36,26 +36,21 @@ proc return_1 { type } {
"set break on ${type}_func"
gdb_test "continue" "Breakpoint.* ${type}_func.*" \
"continue to ${type}_func"
- send_gdb "return testval.${type}_testval\n"
- gdb_expect {
- -re "Make ${type}_func return now.*y or n. $" {
- 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 ".*$gdb_prompt $" {
- fail "return from ${type}_func"
- }
- timeout {
- fail "return from ${type}_func (timeout)"
+
+ gdb_test_multiple "return testval.${type}_testval" \
+ "return from ${type}_func" {
+ -re "Make ${type}_func return now.*y or n. $" {
+ 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"
+ }
}
- }
gdb_test "print ${type}_resultval == testval.${type}_testval" ".* = 1" \
"${type} value returned successfully"
gdb_test "print ${type}_resultval != ${type}_returnval" ".* = 1" \
@@ -69,8 +64,8 @@ proc return_void { } {
"set break on void_func"
gdb_test "continue" "Breakpoint.* 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. $" {
send_gdb "y\n"
exp_continue
@@ -82,12 +77,6 @@ proc return_void { } {
-re ".*void_checkpoint.*$gdb_prompt $" {
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" \
"void function returned successfully"
diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp
index 3825077..7bf91c4 100644
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -71,26 +71,6 @@ if [target_info exists gdb_stub] {
# 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
#
@@ -272,24 +252,22 @@ gdb_test "tbreak $srcfile:factorial" "Temporary breakpoint.*at.* file .*$srcfile
#
# 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
#
-send_gdb "tbreak $srcfile:$bp_location2\n"
-gdb_expect {
- -re "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location2.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" }
- -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" }
- timeout { fail "Temporary breakpoint line number in file #1 (timeout)" }
-}
+
+gdb_test "tbreak $srcfile:$bp_location2" \
+ "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location2.*" \
+ "Temporary breakpoint line number in file #1"
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"
@@ -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
# in this test program.)
#
-if ![runto_main] then { fail "break 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"}
-}
+if ![runto_main] then { fail "sepdebug tests suppressed" }
+gdb_test "catch" "Catch requires an event name.*" \
+ "catch requires an event name"
set name "set catch fork, never expected to trigger"
-send_gdb "catch fork\n"
-gdb_expect {
- -re "Catchpoint \[0-9\]* .fork..*$gdb_prompt $"
- {pass $name}
- -re "Catch of fork not yet implemented.*$gdb_prompt $"
- {pass $name}
- -re "$gdb_prompt $"
- {fail $name}
- timeout {fail "(timeout) $name"}
+gdb_test_multiple "catch fork" $name {
+ -re "Catchpoint \[0-9\]* .fork.*$gdb_prompt $" {
+ pass $name
+ }
+ -re "Catch of fork not yet implemented.*$gdb_prompt $" {
+ pass $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
# printed if we type "catch vfork" at the gdb gdb_prompt. This is
# because on HP-UX 10.20, we cannot catch vfork events.
-if [istarget "hppa*-hp-hpux10.20"] then {
- gdb_expect {
- -re "Catch of vfork events not supported on HP-UX 10.20..*$gdb_prompt $"
- {pass $name}
- -re "$gdb_prompt $"
- {fail $name}
- timeout {fail "(timeout) $name"}
+set name "set catch vfork, never expected to trigger"
+gdb_test_multiple "catch vfork" $name {
+ -re "Catch of vfork events not supported on HP-UX 10.20.*" {
+ pass $name
}
-} else {
- gdb_expect {
- -re "Catchpoint \[0-9\]* .vfork..*$gdb_prompt $"
- {pass $name}
- -re "Catch of vfork not yet implemented.*$gdb_prompt $"
- {pass $name}
- -re "$gdb_prompt $"
- {fail $name}
- timeout {fail "(timeout) $name"}
+ -re "Catchpoint \[0-9\]* .vfork.*$gdb_prompt $" {
+ pass $name
+ }
+ -re "Catch of vfork not yet implemented.*$gdb_prompt $" {
+ pass $name
}
}
set name "set catch exec, never expected to trigger"
-send_gdb "catch exec\n"
-gdb_expect {
- -re "Catchpoint \[0-9\]* .exec..*$gdb_prompt $"
- {pass $name}
- -re "Catch of exec not yet implemented.*$gdb_prompt $"
- {pass $name}
- -re "$gdb_prompt $" {fail $name}
- timeout {fail "(timeout) $name"}
+gdb_test_multiple "catch exec" $name {
+ -re "Catchpoint \[0-9\]* .exec.*$gdb_prompt $" {
+ pass $name
+ }
+ -re "Catch of exec not yet implemented.*$gdb_prompt $" {
+ pass $name
+ }
}
# Verify that GDB responds gracefully when asked to set a breakpoint
# on a nonexistent source line.
#
-send_gdb "break 999\n"
-gdb_expect {
- -re "No line 999 in file .*$gdb_prompt $"\
- {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"}
-}
+
+gdb_test "break 999" "No line 999 in file .*" \
+ "break on non-existent source line"
# Run to the desired default location. If not positioned here, the
# 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
# 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_expect {
- -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"}
-}
+gdb_test "break" "Breakpoint \[0-9\]*.*" \
+ "break on default location, 1st time"
-send_gdb "break\n"
-gdb_expect {
- -re "Note: breakpoints \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\
- {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"}
-}
+gdb_test "break" \
+ "Note: breakpoint \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \
+ "break on default location, 2nd time"
-send_gdb "break\n"
-gdb_expect {
- -re "Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\
- {pass "break on default location, 4th time"}
- -re "$gdb_prompt $"\
- {fail "break on default location, 4th time"}
- timeout {fail "(timeout) break on default location, 4th time"}
-}
+gdb_test "break" \
+ "Note: breakpoints \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \
+ "break on default location, 3rd time"
+
+gdb_test "break" \
+ "Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \
+ "break on default location, 4th time"
# Verify that a "silent" breakpoint can be set, and that GDB is indeed
# "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_expect {
- -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $"\
- {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"}
+gdb_test_multiple "break $bp_location1" \
+ "set to-be-silent break bp_location1" {
+ -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $" {
+ pass "set to-be-silent break bp_location1"
+ }
}
send_gdb "commands $expect_out(1,string)\n"
@@ -458,30 +388,14 @@ gdb_expect {
timeout {fail "(timeout) set silent break bp_location1"}
}
-send_gdb "info break $expect_out(1,string)\n"
-gdb_expect {
- -re "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*$gdb_prompt $"\
- {pass "info silent break bp_location1"}
- -re "$gdb_prompt $"\
- {fail "info silent break bp_location1"}
- timeout {fail "(timeout) info 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"}
-}
+gdb_test "info break $expect_out(1,string)\n" \
+ "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*" \
+ "info silent break bp_location1"
+
+gdb_test "continue" "Continuing.*" "hit silent break bp_location1"
+
+gdb_test "bt" "#0 main .* at .*:$bp_location1.*" \
+ "stopped for silent break bp_location1"
# Verify that GDB can at least parse a breakpoint with the
# "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.)
#
set bp_location12 [gdb_get_line_number "set breakpoint 12 here"]
-send_gdb "break $bp_location12 thread 999\n"
-gdb_expect {
- -re "Unknown thread 999.*$gdb_prompt $"\
- {pass "thread-specific breakpoint on non-existent thread disallowed"}
- -re "$gdb_prompt $"\
- {fail "thread-specific breakpoint on non-existent thread disallowed"}
- timeout {fail "(timeout) thread-specific breakpoint on non-existent thread 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"}
-}
+
+gdb_test "break $bp_location12 thread 999" "Unknown thread 999.*" \
+ "thread-specific breakpoint on non-existent thread disallowed"
+
+gdb_test "break $bp_location12 thread foo" \
+ "Junk after thread keyword.*" \
+ "thread-specific breakpoint on bogus thread ID disallowed"
# Verify that GDB responds gracefully to a breakpoint command with
# trailing garbage.
#
-send_gdb "break $bp_location12 foo\n"
-gdb_expect {
- -re "Junk at end of arguments..*$gdb_prompt $"\
- {pass "breakpoint with trailing garbage disallowed"}
- -re "$gdb_prompt $"\
- {fail "breakpoint with trailing garbage disallowed"}
- timeout {fail "(timeout) breakpoint with trailing garbage disallowed"}
-}
+
+gdb_test "break $bp_location12 foo" \
+ "Junk at end of arguments.*" \
+ "breakpoint with trailing garbage disallowed"
# Verify that GDB responds gracefully to a "clear" command that has
# no matching breakpoint. (First, get us off the current source line,
# which we know has a breakpoint.)
#
-send_gdb "next\n"
-gdb_expect {
- -re ".*$gdb_prompt $"\
- {pass "step over breakpoint"}
- timeout {fail "(timeout) step over breakpoint"}
-}
-send_gdb "clear 81\n"
-gdb_expect {
- -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"}
-}
+
+gdb_test "next" "marker1.*" "step over breakpoint"
+
+gdb_test "clear 81" "No breakpoint at 81.*" \
+ "clear line has no breakpoint disallowed"
+
+gdb_test "clear" "No breakpoint at this line.*" \
+ "clear current line has no breakpoint disallowed"
# 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.
#
-send_gdb "set \$foo=$bp_location11\n"
-gdb_expect {
- -re "$gdb_prompt $"\
- {pass "set convenience variable \$foo to bp_location11"}
- timeout {fail "(timeout) set convenience variable \$foo to bp_location11"}
-}
-send_gdb "break \$foo\n"
-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"}
-}
+
+gdb_test "set \$foo=$bp_location11" "" \
+ "set convenience variable \$foo to bp_location11"
+
+gdb_test "break \$foo" \
+ "Breakpoint (\[0-9\]*) at .*, line $bp_location11.*" \
+ "set breakpoint via convenience variable"
# Verify that GDB responds gracefully to an attempt to set a
# breakpoint via a convenience variable whose type is not integer.
#
-send_gdb "set \$foo=81.5\n"
-gdb_expect {
- -re "$gdb_prompt $"\
- {pass "set convenience variable \$foo to 81.5"}
- timeout {fail "(timeout) set convenience variable \$foo to 81.5"}
-}
-send_gdb "break \$foo\n"
-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"}
-}
+
+gdb_test_no_output "set \$foo=81.5" \
+ "set convenience variable \$foo to 81.5"
+
+gdb_test "break \$foo" \
+ "Convenience variables used in line specs must have integer values.*" \
+ "set breakpoint via non-integer convenience variable disallowed"
# Verify that we can set and trigger a breakpoint in a user-called function.
#
-send_gdb "break marker2\n"
-gdb_expect {
- -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*$gdb_prompt $"\
- {pass "set breakpoint on to-be-called function"}
- -re "$gdb_prompt $"\
- {fail "set breakpoint on to-be-called function"}
- timeout {fail "(timeout) set breakpoint on to-be-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"}
-}
+
+gdb_test "break marker2" \
+ "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*" \
+ "set breakpoint on to-be-called function"
+
+gdb_test "print marker2(99)" \
+ "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"
# As long as we're stopped (breakpointed) in a called function,
# 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
# for hppa*-*-hpux.
#
-send_gdb "bt\n"
-gdb_expect {
- -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*_sr4export.*$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 $"\
- {pass "backtrace while in called function"}
- -re "$gdb_prompt $"\
- {fail "backtrace while in called function"}
- timeout {fail "(timeout) backtrace while in called function"}
+
+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 $" {
+ 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"
+ }
}
# 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
# breakpoint inserted by GDB at the program's entry point.
#
-send_gdb "finish\n"
-gdb_expect {
- -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.* in _sr4export.*$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 $"\
- {pass "finish from called function"}
- -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*Value returned.*$gdb_prompt $"\
- {pass "finish from called function"}
- -re "$gdb_prompt $"\
- {fail "finish from called function"}
- timeout {fail "(timeout) finish from called function"}
+
+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 $" {
+ 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.*Value returned.*$gdb_prompt $" {
+ pass "finish from called function"
+ }
}
# Verify that GDB responds gracefully to a "finish" command with
# arguments.
#
-if ![runto_main] then { fail "break tests suppressed" }
+if ![runto_main] then { fail "sepdebug tests suppressed" }
-send_gdb "finish 123\n"
-gdb_expect {
- -re "The \"finish\" command does not take any arguments.\r\n$gdb_prompt $"\
- {pass "finish with arguments disallowed"}
- -re "$gdb_prompt $"\
- {fail "finish with arguments disallowed"}
- timeout {fail "(timeout) finish with arguments disallowed"}
-}
+gdb_test "finish 123" \
+ "The \"finish\" command does not take any arguments.*" \
+ "finish with arguments disallowed"
# Verify that GDB responds gracefully to a request to "finish" from
# the outermost frame. On a stub that never exits, this will just
@@ -662,79 +521,47 @@ gdb_expect {
# second condition.
#
-send_gdb "finish\n"
-gdb_expect {
- -re "\"finish\" not meaningful in the outermost frame.\r\n$gdb_prompt $"\
- {pass "finish from outermost frame disallowed"}
- -re "Run till exit from.*\r\n$gdb_prompt $" {
- pass "finish from outermost frame disallowed"
- }
- -re "$gdb_prompt $"\
- {fail "finish from outermost frame disallowed"}
- timeout {fail "(timeout) finish from outermost frame disallowed"}
+gdb_test_multiple "finish" "finish from outermost frame disallowed" {
+ -re "\"finish\" not meaningful in the outermost frame.*$gdb_prompt $" {
+ pass "finish from outermost frame disallowed"
+ }
+ -re "Run till exit from.*$gdb_prompt $" {
+ pass "finish from outermost frame disallowed"
+ }
}
# Verify that we can explicitly ask GDB to stop on all shared library
# events, and that it does so.
#
if [istarget "hppa*-*-hpux*"] then {
- if ![runto_main] then { fail "break tests suppressed" }
-
- send_gdb "set stop-on-solib-events 1\n"
- gdb_expect {
- -re "$gdb_prompt $"\
- {pass "set stop-on-solib-events"}
- timeout {fail "(timeout) set stop-on-solib-events"}
- }
-
- send_gdb "run\n"
- gdb_expect {
- -re ".*Start it from the beginning.*y or n. $"\
- {send_gdb "y\n"
- gdb_expect {
- -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_expect {
- -re "$gdb_prompt $"\
- {pass "reset stop-on-solib-events"}
- timeout {fail "(timeout) reset stop-on-solib-events"}
- }
+ if ![runto_main] then { fail "sepdebug tests suppressed" }
+
+ gdb_test_no_output "set stop-on-solib-events 1" \
+ "set stop-on-solib-events"
+
+ gdb_test "run" \
+ "Stopped due to shared library event.*" \
+ "triggered stop-on-solib-events" \
+ "Start it from the beginning.*y or n. $" \
+ "y"
+
+ gdb_test_no_output "set stop-on-solib-events 0" \
+ "reset stop-on-solib-events"
}
# Hardware breakpoints are unsupported on HP-UX. Verify that GDB
# gracefully responds to requests to create them.
#
if [istarget "hppa*-*-hpux*"] then {
- if ![runto_main] then { fail "break tests suppressed" }
-
- send_gdb "hbreak\n"
- gdb_expect {
- -re "No hardware breakpoint support in the target.*$gdb_prompt $"\
- {pass "hw breaks disallowed"}
- -re "$gdb_prompt $"\
- {fail "hw breaks disallowed"}
- timeout {fail "(timeout) hw breaks disallowed"}
- }
-
- send_gdb "thbreak\n"
- gdb_expect {
- -re "No hardware breakpoint support in the target.*$gdb_prompt $"\
- {pass "temporary hw breaks disallowed"}
- -re "$gdb_prompt $"\
- {fail "temporary hw breaks disallowed"}
- timeout {fail "(timeout) temporary hw breaks disallowed"}
- }
+ if ![runto_main] then { fail "sepdebug tests suppressed" }
+
+ gdb_test "hbreak" \
+ "No hardware breakpoint support in the target.*" \
+ "hw breaks disallowed"
+
+ gdb_test "thbreak" \
+ "No hardware breakpoint support in the target.*" \
+ "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_location14 [gdb_get_line_number "set breakpoint 14 here"]
- send_gdb "continue\n"
if {$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"
}
- -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"
}
- -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
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*"] {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
- send_gdb "set args main\n"
- gdb_expect -re ".*$gdb_prompt $" {}
+ gdb_test_no_output "set args main"
}
set pf_prefix $old_pf_prefix
diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp
index 4bee4eb..78f6b64 100644
--- a/gdb/testsuite/gdb.base/setshow.exp
+++ b/gdb/testsuite/gdb.base/setshow.exp
@@ -54,27 +54,25 @@ if { ![runto_main] } {
gdb_test "show annotate" "Annotation_level is 0..*" "default annotation_level is zero"
#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" }
+
+gdb_test_multiple "set annotate 2" "set annotate 2" {
+ -re ".*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" {
+ pass "set annotate 2"
}
+}
-send_gdb "show annotate\n"
-gdb_expect {
- -re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \
- { 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
-send_gdb "info line 1\n"
-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.*$" \
- { pass "annotation_level 2" }
- timeout { fail "(timeout) annotation_level 2" }
+gdb_test_multiple "info line 1" "annotation_level 2" {
+ -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"
}
+}
#test 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] {
#test set prompt (FooBarBaz)
set newprompt "\\(FooBarBaz\\)"
- send_gdb "set prompt (FooBarBaz) \n"
- gdb_expect {
- -re "$newprompt $" { pass "set prompt (FooBarBaz) " }
- timeout { fail "(timeout) set prompt (FooBarBaz) " }
+
+ gdb_test_multiple "set prompt (FooBarBaz) " "set prompt FooBarBaz" {
+ -re "$newprompt $" {
+ pass "set prompt FooBarBaz"
+ }
}
#test show prompt (FooBarBaz)
- send_gdb "show prompt\n"
- gdb_expect {
- -re "Gdb's prompt is \"$newprompt \"..* $" \
- { pass "show prompt (FooBarBaz) " }
- timeout { fail "(timeout) show prompt (FooBarBaz) " }
+
+ gdb_test_multiple "show prompt" "show prompt FooBarBaz" {
+ -re "Gdb's prompt is \"$newprompt \"..* $" {
+ pass "show prompt FooBarBaz"
+ }
}
#test set prompt (gdb)
- send_gdb "set prompt (gdb) \n"
- gdb_expect {
- -re "$gdb_prompt $" { pass "set prompt (gdb) " }
- timeout { fail "(timeout) set prompt (gdb) " }
+
+ gdb_test_multiple "set prompt (gdb) " "set prompt gdb" {
+ -re "$gdb_prompt $" {
+ pass "set prompt gdb"
+ }
}
}
diff --git a/gdb/testsuite/gdb.base/setvar.exp b/gdb/testsuite/gdb.base/setvar.exp
index 5594ac9..d6dc131 100644
--- a/gdb/testsuite/gdb.base/setvar.exp
+++ b/gdb/testsuite/gdb.base/setvar.exp
@@ -51,7 +51,7 @@ gdb_load $binfile
#
# 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 {
perror "couldn't run to breakpoint"
@@ -61,20 +61,16 @@ if ![runto_main] then {
# Determine expected output for unsigned long variables,
# the output varies with sizeof (unsigned long).
-set ulong_minus_1 4294967295
-set ulong_minus_456 4294966840
-send_gdb "print sizeof (unsigned long)\n"
-gdb_expect {
- -re ".\[0-9\]* = 4.*$gdb_prompt $" {}
+gdb_test_multiple "print sizeof (unsigned long)" "sizeof ulong" {
+ -re ".\[0-9\]* = 4.*$gdb_prompt $" {
+ set ulong_minus_1 4294967295
+ set ulong_minus_456 4294966840
+ }
-re ".\[0-9\]* = 8.*$gdb_prompt $" {
set ulong_minus_1 18446744073709551615
set ulong_minus_456 18446744073709551160
}
- -re ".*$gdb_prompt $" {
- fail "getting sizeof unsigned long"
- }
- default { fail "(timeout) getting sizeof unsigned long" }
-}
+}
proc test_set { args } {
global gdb_prompt
diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp
index b902e53..a11199a 100644
--- a/gdb/testsuite/gdb.base/shlib-call.exp
+++ b/gdb/testsuite/gdb.base/shlib-call.exp
@@ -70,9 +70,9 @@ gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
gdb_load_shlibs $lib1 $lib2
-send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
-send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
-send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
+gdb_test_no_output "set print sevenbit-strings"
+gdb_test_no_output "set print address off"
+gdb_test_no_output "set width 0"
if ![runto_main] then {
@@ -82,74 +82,38 @@ if ![runto_main] then {
#step -over
- send_gdb "next\n"
- 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)" }
- }
-
-
+gdb_test "next" "g = shr1\\(g\\);" "next to shr1"
#print g
-send_gdb "print g\n"
-gdb_expect {
- -re ".*\[0-9\]* = 1.*$gdb_prompt $" {
- pass "print g"
- }
- -re ".*$gdb_prompt $" { fail "print g" }
- timeout { fail "(timeout) print g" }
- }
-
+gdb_test "print g" "\[0-9\]* = 1" "print g"
#step -over
- if ![gdb_skip_stdio_test "next over shr1"] {
- send_gdb "next\n"
- gdb_expect {
- -re ".*address of sgs is $hex.*g = shr2\\(g\\).*$gdb_prompt $" {
- pass "next over shr1"
- }
- -re ".*$gdb_prompt $" { fail "next over shr1" }
- timeout { fail "next over shr1 (timeout)" }
- }
- } else {
- gdb_test "next" "" ""
- }
+if ![gdb_skip_stdio_test "next over shr1"] {
+ gdb_test "next" \
+ "address of sgs is $hex.*g = shr2\\(g\\);" \
+ "next over shr1"
+} else {
+ gdb_test "next" "" ""
+}
#print g
-send_gdb "print g\n"
-gdb_expect {
- -re ".*\[0-9\]* = 2.*$gdb_prompt $" {
- pass "print g" }
- -re ".*$gdb_prompt $" { fail "print g" }
- timeout { fail "(timeout) print g" }
- }
+gdb_test "print g" "\[0-9\]* = 2" "print g"
#print shr1(1)
- if ![gdb_skip_stdio_test "print shr1(1)"] {
- send_gdb "print shr1(1)\n"
- gdb_expect {
- -re ".*address of sgs is $hex.*\[0-9\]* = 2.*$gdb_prompt $" {
- pass "print shr1(1)"
- }
- -re ".*$gdb_prompt $" { fail "print shr1(1)" }
- timeout { fail "(timeout) print shr1(1)" }
- }
- }
+if ![gdb_skip_stdio_test "print shr1(1)"] {
+ gdb_test "print shr1(1)" \
+ "address of sgs is $hex.*\[0-9\]* = 2" \
+ "print shr1(1)"
+}
#print shr1(g)
- if ![gdb_skip_stdio_test "print shr1(g)"] {
- send_gdb "print shr1(g)\n"
- gdb_expect {
- -re ".*address of sgs is $hex.*\[0-9\]* = 4.*$gdb_prompt $" {
- pass "print shr1(g)"
- }
- -re ".*$gdb_prompt $" { fail "print shr1(g)" }
- timeout { fail "(timeout) print shr1(g)" }
- }
- }
+if ![gdb_skip_stdio_test "print shr1(g)"] {
+ gdb_test "print shr1(g)" \
+ "address of sgs is $hex.*\[0-9\]* = 4" \
+ "print shr1(g)"
+}
#break shr2
#go
@@ -164,67 +128,38 @@ gdb_test "continue" \
#print shr1(1)
if ![gdb_skip_stdio_test "print shr1(1) 2nd time"] {
- send_gdb "print shr1(1)\n"
- gdb_expect {
- -re ".*address of sgs is $hex.*\[0-9\]* = 2.*$gdb_prompt $" {
- pass "print shr1(1) 2nd time"
- }
- -re ".*$gdb_prompt $" { fail "print shr1(1) 2nd time" }
- timeout { fail "(timeout) print shr1(1) 2nd time" }
- }
+ gdb_test "print shr1(1)" \
+ "address of sgs is $hex.*\[0-9\]* = 2" \
+ "print shr1(1) 2nd time"
}
#print mainshr1(1)
-send_gdb "print mainshr1(1)\n"
-gdb_expect {
- -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" }
- }
+gdb_test "print mainshr1(1)" "\[0-9\]* = 2" \
+ "print mainshr1(1) from shlib func"
#step -return
- send_gdb "step\n"
- # A step at this point will either take us entirely out of
- # the function or into the function's epilogue. The exact
- # behavior will differ depending upon upon whether or not
- # the compiler emits line number information for the epilogue.
- gdb_expect {
- -re "main \\(\\) at.*g = mainshr1\\(g\\);.*$gdb_prompt $" {
- 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)" }
+# A step at this point will either take us entirely out of
+# the function or into the function's epilogue. The exact
+# behavior will differ depending upon upon whether or not
+# the compiler emits line number information for the epilogue.
+gdb_test_multiple "step" "step out of shr2 to main" {
+ -re "main \\(\\) at.*g = mainshr1\\(g\\);.*$gdb_prompt $" {
+ pass "step out of shr2 to main"
+ }
+ -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)
-send_gdb "print mainshr1(1)\n"
-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" }
- }
+gdb_test "print mainshr1(1)" "\[0-9\]* = 2" "print mainshr1(1)"
#step
- send_gdb "step\n"
- gdb_expect {
- -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)" }
- }
+gdb_test "step" "mainshr1 \\(g=4\\) at.*return 2.g;" \
+ "step into mainshr1"
# Start with a fresh gdb.
@@ -232,9 +167,10 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
-send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
-send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
-send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
+gdb_test_no_output "set print sevenbit-strings"
+gdb_test_no_output "set print address off"
+gdb_test_no_output "set width 0"
+
# PR's 16495, 18213
# test that we can re-set breakpoints in shared libraries
diff --git a/gdb/testsuite/gdb.base/shreloc.exp b/gdb/testsuite/gdb.base/shreloc.exp
index 4c92205..ce5c324 100644
--- a/gdb/testsuite/gdb.base/shreloc.exp
+++ b/gdb/testsuite/gdb.base/shreloc.exp
@@ -91,29 +91,25 @@ if ![runto_main] then {
}
proc get_var_address { var } {
- global gdb_prompt hex
-
- send_gdb "print &${var}\n"
- # Match output like:
- # $1 = (int *) 0x0
- # $5 = (int (*)()) 0
- # $6 = (int (*)()) 0x24 <function_bar>
- gdb_expect {
- -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $"
+ global gdb_prompt hex
+
+ # Match output like:
+ # $1 = (int *) 0x0
+ # $5 = (int (*)()) 0
+ # $6 = (int (*)()) 0x24 <function_bar>
+
+ gdb_test_multiple "print &${var}" "get address of ${var}" {
+ -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $"
{
- pass "get address of ${var}"
- if { $expect_out(1,string) == "0" } {
- return "0x0"
- } else {
- return $expect_out(1,string)
- }
+ pass "get address of ${var}"
+ if { $expect_out(1,string) == "0" } {
+ return "0x0"
+ } else {
+ return $expect_out(1,string)
+ }
}
- -re "${gdb_prompt} $"
- { fail "get address of ${var} (unknown output)" }
- timeout
- { fail "get address of ${var} (timeout)" }
- }
- return ""
+ }
+ return ""
}
#
@@ -159,10 +155,8 @@ proc send_gdb_discard { command } {
global gdb_prompt
- send_gdb "${command}\n"
-
# Discard output
- gdb_expect {
+ gdb_test_multiple "${command}" "${command}" {
-re ".*\[\r\n]+${gdb_prompt} $" {
return 1
}
diff --git a/gdb/testsuite/gdb.base/sigall.exp b/gdb/testsuite/gdb.base/sigall.exp
index cd436c7..1fbf3e5 100644
--- a/gdb/testsuite/gdb.base/sigall.exp
+++ b/gdb/testsuite/gdb.base/sigall.exp
@@ -54,22 +54,12 @@ proc test_one_sig {nextsig} {
set need_another_continue 1
set missed_handler 0
if $this_sig_supported then {
- send_gdb "continue\n"
if { $thissig == "IO" } {
setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
}
- gdb_expect {
- -re "Continuing.*Program received signal SIG$thissig.*$gdb_prompt $" {
- pass "get signal $thissig"
- }
- -re ".*$gdb_prompt $" {
- fail "get signal $thissig"
- set need_another_continue 0
- }
- default {
- fail "get signal $thissig (eof or timeout)"
- }
- }
+ gdb_test "continue" \
+ "Continuing.*Program received signal SIG$thissig.*" \
+ "get signal $thissig"
}
if [ istarget "alpha-dec-osf3*" ] then {
# 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 {
- send_gdb "continue\n"
if { $thissig == "URG" } {
setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
}
@@ -92,7 +81,7 @@ proc test_one_sig {nextsig} {
if { $thissig == "PRIO" } {
setup_xfail "*-*-*lynx*"
}
- gdb_expect {
+ gdb_test_multiple "continue" "send signal $thissig" {
-re "Breakpoint.*handle_$thissig.*$gdb_prompt $" {
pass "send signal $thissig"
}
@@ -104,8 +93,7 @@ proc test_one_sig {nextsig} {
}
if { $missed_handler == "0" } then {
- send_gdb "signal 0\n"
- gdb_expect {
+ gdb_test_multiple "signal 0" "advance to $nextsig" {
-re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
pass "advance to $nextsig"
set sig_supported 1
@@ -114,8 +102,6 @@ proc test_one_sig {nextsig} {
pass "advance to $nextsig"
set sig_supported 0
}
- -re ".*$gdb_prompt $" { fail "advance to $nextsig" }
- default { fail "advance to $nextsig (eof or timeout)" }
}
}
set thissig $nextsig
diff --git a/gdb/testsuite/gdb.base/sigbpt.exp b/gdb/testsuite/gdb.base/sigbpt.exp
index 6a6c58e..99656d8 100644
--- a/gdb/testsuite/gdb.base/sigbpt.exp
+++ b/gdb/testsuite/gdb.base/sigbpt.exp
@@ -65,8 +65,7 @@ if ![runto_main] then {
# especially on targets without an MMU. Don't run the tests in that
# case.
-send_gdb "x 0\n"
-gdb_expect {
+gdb_test_multiple "x 0" "memory at address 0" {
-re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { }
-re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { }
-re ".*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.base/signull.exp b/gdb/testsuite/gdb.base/signull.exp
index a66e28c..aec6bee 100644
--- a/gdb/testsuite/gdb.base/signull.exp
+++ b/gdb/testsuite/gdb.base/signull.exp
@@ -64,8 +64,7 @@ if ![runto_main] then {
# especially on targets without an MMU. Don't run the tests in that
# case.
-send_gdb "x 0\n"
-gdb_expect {
+gdb_test_multiple "x 0" "memory at address 0" {
-re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { }
-re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { }
-re ".*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.base/so-impl-ld.exp b/gdb/testsuite/gdb.base/so-impl-ld.exp
index c01b38d..1d11716 100644
--- a/gdb/testsuite/gdb.base/so-impl-ld.exp
+++ b/gdb/testsuite/gdb.base/so-impl-ld.exp
@@ -65,59 +65,30 @@ if ![runto_main] then { fail "implicit solibs tests suppressed" }
# Verify that we can step over the first shlib call.
#
-send_gdb "next\n"
-gdb_expect {
- -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"}
-}
+gdb_test "next" "21\[ \t\]*result = solib_main .result.;" \
+ "step over solib call"
# Verify that we can step into the second shlib call.
#
-send_gdb "step\n"
-gdb_expect {
- -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"}
-}
+gdb_test "step" "solib_main .arg=10000. at.*${libfile}.c:17.*" \
+ "step into solib call"
# Verify that we can step within the shlib call.
#
-send_gdb "next\n"
-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"}
-}
+gdb_test "next" "18\[ \t\]*\}" "step in solib call"
# Verify that we can step out of the shlib call, and back out into
# the caller.
#
-send_gdb "next\n"
-gdb_expect {
+gdb_test_multiple "next" "step out of solib call" {
-re "0x\[0-9a-f\]*\[ \t\]*9\[ \t\]*.*$gdb_prompt $" {
- # we haven't left the callee yet, so do another next
- send_gdb "next\n"
- gdb_expect {
- -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_test "next" \
+ "main .. at.*so-impl-ld.c:22.*" \
+ "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 $"\
- {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
diff --git a/gdb/testsuite/gdb.base/varargs.exp b/gdb/testsuite/gdb.base/varargs.exp
index ef8b6cb..3cde8ea 100644
--- a/gdb/testsuite/gdb.base/varargs.exp
+++ b/gdb/testsuite/gdb.base/varargs.exp
@@ -62,9 +62,10 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
-send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
-send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
-send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
+gdb_test_no_output "set print sevenbit-strings"
+gdb_test_no_output "set print address off"
+gdb_test_no_output "set width 0"
+
if [gdb_skip_stdio_test "varargs.exp"] {
# Nothing in this module is testable without printf.
@@ -89,57 +90,25 @@ if { $hp_aCC_compiler } {
gdb_test "set overload-resolution 0" ""
}
-send_gdb "print find_max1(5,1,2,3,4,5)\n"
-gdb_expect {
- -re ".*find_max\\(5, 1, 2, 3, 4, 5\\) returns 5\[ \r\n\]+.\[0-9\]+ = 5.*$gdb_prompt $" {
- 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)" }
- }
-
-
-
-
-send_gdb "print find_max1(1,3)\n"
-gdb_expect {
- -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)" }
- }
-
+gdb_test "print find_max1(5,1,2,3,4,5)" \
+ "find_max\\(5, 1, 2, 3, 4, 5\\) returns 5\[ \r\n\]+.\[0-9\]+ = 5" \
+ "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)"
-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)" }
- }
+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)" \
+ ".*find_max\\(3, 1, 2, 3\\) returns 3\[ \r\n\]+.\[0-9\]+ = 3" \
+ "print find_max2(3,1,2,3)"
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_expect {
- -re ".*find_max\\(.*\\) returns 17\\.000000\[ \r\n\]+.\[0-9\]+ = 17.*$gdb_prompt $" {
- 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)" }
- }
+ gdb_test "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)" \
+ ".*find_max\\(.*\\) returns 17\\.000000\[ \r\n\]+.\[0-9\]+ = 17" \
+ "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)"
}
diff --git a/gdb/testsuite/gdb.base/volatile.exp b/gdb/testsuite/gdb.base/volatile.exp
index a9ea984..ecb3455 100644
--- a/gdb/testsuite/gdb.base/volatile.exp
+++ b/gdb/testsuite/gdb.base/volatile.exp
@@ -87,28 +87,17 @@ proc local_compiler_xfail_check_2 { } {
}
}
-send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
-
- send_gdb "cont\n"
- gdb_expect {
- -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
- 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" }
+gdb_test "break marker1" "" ""
+
+gdb_test_multiple "cont" "continue to marker1" {
+ -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
+ pass "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
# 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
local_compiler_xfail_check
local_compiler_xfail_check_2
-send_gdb "ptype qux2\n"
-gdb_expect {
- -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 $" {
- pass "ptype qux2"
- }
- -re ".*$gdb_prompt $" { fail "ptype qux2" }
- timeout { fail "(timeout) ptype qux2" }
- }
+
+gdb_test "ptype qux2" \
+ "type = int \\(volatile unsigned char, const volatile int, volatile short( int)?, volatile long( int)? \\*, float \\* volatile, const volatile signed char \\* const volatile\\)" \
+ "ptype qux2"
diff --git a/gdb/testsuite/gdb.base/watch_thread_num.exp b/gdb/testsuite/gdb.base/watch_thread_num.exp
index b4f0f3b..e551a1e 100644
--- a/gdb/testsuite/gdb.base/watch_thread_num.exp
+++ b/gdb/testsuite/gdb.base/watch_thread_num.exp
@@ -62,11 +62,10 @@ gdb_test "break thread_function" "Breakpoint \[0-9\].*" \
gdb_test "continue" ".*Breakpoint 2.*" "Stopped in thread_function"
-send_gdb "thread\n"
-gdb_expect {
- -re ".*Current thread is (\[0-9\]*).*$gdb_prompt $" { pass "Thread command" }
- -re ".*$gdb_prompt $" { fail "Thread command" }
- timeout { fail "(timeout) Thread command" }
+gdb_test_multiple "thread" "Thread command" {
+ -re ".*Current thread is (\[0-9\]*).*$gdb_prompt $" {
+ pass "Thread command"
+ }
}
set thread_num "$expect_out(1,string)"
diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index b53faef..cada4ba 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -161,40 +161,21 @@ proc test_simple_watchpoint {} {
# watches without a running inferior. The following testpoints used
# to be in [initialize].
#
- send_gdb "watch ival3\n"
- gdb_expect {
- -re ".*\[Ww\]atchpoint 3: ival3\r\n$gdb_prompt $" {
- pass "set watchpoint on ival3"
- }
- -re ".*$gdb_prompt $" { fail "set watchpoint on ival3" }
- timeout { fail "set watchpoint on ival3 (timeout)" }
- }
+ gdb_test "watch ival3" \
+ "\[Ww\]atchpoint 3: ival3" \
+ "set watchpoint on ival3"
set wp_set 1
- send_gdb "info watch\n"
- gdb_expect {
- -re "3\[ \]*.*watchpoint.*ival3\r\n$gdb_prompt $" {
- 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"
- }
- }
+ gdb_test "info watch" \
+ "3\[ \]*.*watchpoint.*ival3" \
+ "watchpoint found in watchpoint/breakpoint table"
# 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
# we get to the first marker function.
- send_gdb "disable 3\n"
- gdb_expect {
- -re "disable 3\[\r\n\]+$gdb_prompt $" { pass "disable watchpoint" }
- -re ".*$gdb_prompt $" { fail "disable watchpoint" }
- timeout { fail "disable watchpoint (timeout)" }
- }
+ gdb_test "disable 3" "disable 3" "disable 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
# 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.
+
send_gdb "continue\n";
gdb_expect {
-re "Continuing\\.\r\ntype stuff for buf now:" {