aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2010-06-01 18:18:35 +0000
committerMichael Snyder <msnyder@vmware.com>2010-06-01 18:18:35 +0000
commitf8d3bf8f5206c7084bd9e639394c15716562a041 (patch)
tree95030c802594ef1f585e9022211e9e2350571902 /gdb
parent285d560d3afdd33d59c7f9ee0abe6e854df299e4 (diff)
downloadgdb-f8d3bf8f5206c7084bd9e639394c15716562a041.zip
gdb-f8d3bf8f5206c7084bd9e639394c15716562a041.tar.gz
gdb-f8d3bf8f5206c7084bd9e639394c15716562a041.tar.bz2
2010-05-25 Michael Snyder <msnyder@vmware.com>
* gdb.cp/annota2.exp: Replace uses of send_gdb / gdb_expect. * gdb.cp/annota3.exp: Replace uses of send_gdb / gdb_expect. * gdb.cp/anon-union.exp: Replace uses of send_gdb / gdb_expect. * gdb.cp/cplusfuncs.exp: Replace uses of send_gdb / gdb_expect. * gdb.cp/demangle.exp: Replace uses of send_gdb / gdb_expect. * gdb.cp/formatted-ref.exp: Replace uses of send_gdb / gdb_expect. * gdb.cp/local.exp: Replace uses of send_gdb / gdb_expect. * gdb.cp/method.exp: Replace uses of send_gdb / gdb_expect. * gdb.cp/misc.exp: Replace uses of send_gdb / gdb_expect. * gdb.cp/namespace.exp: Replace uses of send_gdb / gdb_expect. * gdb.cp/ovldbreak.exp: Replace uses of send_gdb / gdb_expect. * gdb.cp/pr-1023.exp: Replace uses of send_gdb / gdb_expect. * gdb.cp/ref-types.exp: Replace uses of send_gdb / gdb_expect. * gdb.cp/templates.exp: Replace uses of send_gdb / gdb_expect. * gdb.cp/userdef.exp: Replace uses of send_gdb / gdb_expect.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog18
-rw-r--r--gdb/testsuite/gdb.cp/annota2.exp81
-rw-r--r--gdb/testsuite/gdb.cp/annota3.exp12
-rw-r--r--gdb/testsuite/gdb.cp/anon-union.exp259
-rw-r--r--gdb/testsuite/gdb.cp/cplusfuncs.exp503
-rw-r--r--gdb/testsuite/gdb.cp/demangle.exp72
-rw-r--r--gdb/testsuite/gdb.cp/formatted-ref.exp4
-rw-r--r--gdb/testsuite/gdb.cp/local.exp54
-rw-r--r--gdb/testsuite/gdb.cp/method.exp78
-rw-r--r--gdb/testsuite/gdb.cp/misc.exp34
-rw-r--r--gdb/testsuite/gdb.cp/namespace.exp131
-rw-r--r--gdb/testsuite/gdb.cp/ovldbreak.exp3
-rw-r--r--gdb/testsuite/gdb.cp/pr-1023.exp9
-rw-r--r--gdb/testsuite/gdb.cp/ref-types.exp528
-rw-r--r--gdb/testsuite/gdb.cp/templates.exp430
-rw-r--r--gdb/testsuite/gdb.cp/userdef.exp20
16 files changed, 740 insertions, 1496 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8b868a9..8d2032e 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,21 @@
+2010-06-01 Michael Snyder <msnyder@vmware.com>
+
+ * gdb.cp/annota2.exp: Replace uses of send_gdb / gdb_expect.
+ * gdb.cp/annota3.exp: Replace uses of send_gdb / gdb_expect.
+ * gdb.cp/anon-union.exp: Replace uses of send_gdb / gdb_expect.
+ * gdb.cp/cplusfuncs.exp: Replace uses of send_gdb / gdb_expect.
+ * gdb.cp/demangle.exp: Replace uses of send_gdb / gdb_expect.
+ * gdb.cp/formatted-ref.exp: Replace uses of send_gdb / gdb_expect.
+ * gdb.cp/local.exp: Replace uses of send_gdb / gdb_expect.
+ * gdb.cp/method.exp: Replace uses of send_gdb / gdb_expect.
+ * gdb.cp/misc.exp: Replace uses of send_gdb / gdb_expect.
+ * gdb.cp/namespace.exp: Replace uses of send_gdb / gdb_expect.
+ * gdb.cp/ovldbreak.exp: Replace uses of send_gdb / gdb_expect.
+ * gdb.cp/pr-1023.exp: Replace uses of send_gdb / gdb_expect.
+ * gdb.cp/ref-types.exp: Replace uses of send_gdb / gdb_expect.
+ * gdb.cp/templates.exp: Replace uses of send_gdb / gdb_expect.
+ * gdb.cp/userdef.exp: Replace uses of send_gdb / gdb_expect.
+
2010-06-01 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/commands.exp (begin commands on watch): Remove excessive
diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp
index 7c767c9..b335301 100644
--- a/gdb/testsuite/gdb.cp/annota2.exp
+++ b/gdb/testsuite/gdb.cp/annota2.exp
@@ -62,8 +62,7 @@ set main_line 25
# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
-send_gdb "set height 0\n"
-gdb_expect -re "$gdb_prompt $"
+gdb_test_no_output "set height 0"
#
# break at main
@@ -90,12 +89,11 @@ gdb_expect {
timeout { fail "annotation set at level 2 (timeout)" }
}
-send_gdb "run\n"
- gdb_expect {
- -re "$main_line.*$gdb_prompt$" { pass "run until main breakpoint" }
- -re ".*$gdb_prompt$" { fail "run until main breakpoint" }
- timeout { fail "run until main breakpoint (timeout)" }
- }
+gdb_test_multiple "run" "run until main breakpoint" {
+ -re "$main_line.*$gdb_prompt$" {
+ pass "run until main breakpoint"
+ }
+}
#
# print class 'a' with public fields.
@@ -105,12 +103,10 @@ send_gdb "run\n"
# annotate-field-value
# annotate-field-end
#
-send_gdb "print a\n"
-gdb_expect {
- -re "\r\n\032\032post-prompt\r\n\r\n\032\032value-history-begin 1 -\r\n.*= \r\n\032\032value-history-value\r\n\\{\r\n\032\032field-begin -\r\nx\r\n\032\032field-name-end\r\n = \r\n\032\032field-value\r\n1\r\n\032\032field-end\r\n, \r\n\032\032field-begin -\r\ny\r\n\032\032field-name-end\r\n = \r\n\032\032field-value\r\n2\r\n\032\032field-end\r\n\\}\r\n\r\n\032\032value-history-end\r\n$gdb_prompt$" \
- { pass "print class" }
- -re ".*$gdb_prompt$" { fail "print class" }
- timeout { fail "print class (timeout)" }
+gdb_test_multiple "print a" "print class" {
+ -re "\r\n\032\032post-prompt\r\n\r\n\032\032value-history-begin 1 -\r\n.*= \r\n\032\032value-history-value\r\n\\{\r\n\032\032field-begin -\r\nx\r\n\032\032field-name-end\r\n = \r\n\032\032field-value\r\n1\r\n\032\032field-end\r\n, \r\n\032\032field-begin -\r\ny\r\n\032\032field-name-end\r\n = \r\n\032\032field-value\r\n2\r\n\032\032field-end\r\n\\}\r\n\r\n\032\032value-history-end\r\n$gdb_prompt$" {
+ pass "print class"
+ }
}
#
@@ -119,12 +115,10 @@ gdb_expect {
# annotate-exited
# `a.x is 1' is asynchronous regarding to `frames-invalid'.
#
-send_gdb "continue\n"
-gdb_expect {
- -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n\r\nProgram exited normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
- { pass "continue until exit" }
- -re ".*$gdb_prompt$" { fail "continue to exit" }
- timeout { fail "continue to exit (timeout)" }
+gdb_test_multiple "continue" "continue until exit" {
+ -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)*\r\na.x is 1\r\n\(\r\n\032\032frames-invalid\r\n\)*\r\n\032\032exited 0\r\n\r\nProgram exited normally.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
+ pass "continue until exit"
+ }
}
#
@@ -147,12 +141,10 @@ gdb_expect {
#
# break at first line of main.
#
-send_gdb "break 22\n"
-gdb_expect {
- -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n$gdb_prompt$" \
- { pass "breakpoint at main" }
- -re ".*$gdb_prompt$" { fail "break at main" }
- timeout { fail "break at main (timeout)" }
+gdb_test_multiple "break 22" "break at main" {
+ -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n$gdb_prompt$" {
+ pass "breakpoint at main"
+ }
}
#
@@ -164,37 +156,32 @@ set main_line 22
# run program up to breakpoint.
#
-
-send_gdb "run\n"
- gdb_expect {
- -re "$main_line.*$gdb_prompt$" { pass "run until main breakpoint" }
- -re ".*$gdb_prompt$" { fail "run until main breakpoint" }
- timeout { fail "run until main breakpoint (timeout)" }
- }
+gdb_test_multiple "run" "run until main breakpoint" {
+ -re "$main_line.*$gdb_prompt$" {
+ pass "run until main breakpoint"
+ }
+}
#
# set up a watch point on a.x
#
-send_gdb "watch a.x\n"
-gdb_expect {
- -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\n.*atchpoint 3: a.x\r\n$gdb_prompt$" \
- { pass "set watch on a.x" }
- -re ".*$gdb_prompt$" { fail "set watch on a.x" }
- timeout { fail "set watch on a.x (timeout)" }
+gdb_test_multiple "watch a.x" "set watch on a.x" {
+ -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\n.*atchpoint 3: a.x\r\n$gdb_prompt$" {
+ pass "set watch on a.x"
+ }
}
#
# do a next, so that the watchpoint triggers. This will test:
# annotate-watchpoint
#
-send_gdb "next\n"
-gdb_expect {
- -re "\r\n\032\032post-prompt\r\n\r\n(\032\032breakpoints-invalid\r\n\r\n)*\032\032starting\r\n\r\n(\032\032frames-invalid\r\n\r\n)*\032\032watchpoint 3\r\n.*atchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\n\r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*$srcfile\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$decimal\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" \
- { pass "watch triggered on a.x" }
- -re "\r\n\032\032post-prompt\r\n\r\n(\032\032breakpoints-invalid\r\n\r\n)*\032\032starting\r\n\r\n(\032\032frames-invalid\r\n\r\n)*\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
- { kfail "gdb/38" "watch triggered on a.x" }
- -re ".*$gdb_prompt$" { fail "watch triggered on a.x" }
- timeout { fail "watch triggered on a.x (timeout)" }
+gdb_test_multiple "next" "watch triggered on a.x" {
+ -re "\r\n\032\032post-prompt\r\n\r\n(\032\032breakpoints-invalid\r\n\r\n)*\032\032starting\r\n\r\n(\032\032frames-invalid\r\n\r\n)*\032\032watchpoint 3\r\n.*atchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\n\r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*$srcfile\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$decimal\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" {
+ pass "watch triggered on a.x"
+ }
+ -re "\r\n\032\032post-prompt\r\n\r\n(\032\032breakpoints-invalid\r\n\r\n)*\032\032starting\r\n\r\n(\032\032frames-invalid\r\n\r\n)*\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
+ kfail "gdb/38" "watch triggered on a.x"
+ }
}
diff --git a/gdb/testsuite/gdb.cp/annota3.exp b/gdb/testsuite/gdb.cp/annota3.exp
index f7a1d5f..c394b4e 100644
--- a/gdb/testsuite/gdb.cp/annota3.exp
+++ b/gdb/testsuite/gdb.cp/annota3.exp
@@ -61,8 +61,7 @@ set main_line 25
# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
-send_gdb "set height 0\n"
-gdb_expect -re "$gdb_prompt $"
+gdb_test_no_output "set height 0"
#
# break at main
@@ -184,20 +183,13 @@ gdb_expect_list "set watch on a.x" "$gdb_prompt$" {
# do a next, so that the watchpoint triggers. This will test:
# annotate-watchpoint
#
-send_gdb "next\n"
-gdb_expect {
+gdb_test_multiple "next" "watch triggered on a.x" {
-re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n\r\n\032\032watchpoint 3\r\n.*atchpoint 3: a.x\r\n\r\nOld value = 0\r\nNew value = 1\r\n\r\n(\032\032frame-begin 0 0x\[0-9a-z\]+\r\n|)main \\(\\) at .*$srcfile:$decimal\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" {
pass "watch triggered on a.x"
}
-re "\r\n\032\032post-prompt\r\n\r\n\032\032starting\r\n\r\n\032\032source .*$srcfile.*beg:$hex\r\n\r\n\032\032stopped\r\n$gdb_prompt$" {
kfail "gdb/38" "watch triggered on a.x"
}
- -re ".*$gdb_prompt$" {
- fail "watch triggered on a.x"
- }
- timeout {
- fail "watch triggered on a.x (timeout)"
- }
}
#
diff --git a/gdb/testsuite/gdb.cp/anon-union.exp b/gdb/testsuite/gdb.cp/anon-union.exp
index 7a31427..d0290c7 100644
--- a/gdb/testsuite/gdb.cp/anon-union.exp
+++ b/gdb/testsuite/gdb.cp/anon-union.exp
@@ -51,8 +51,7 @@ if ![runto_main] then {
continue
}
-send_gdb "set width 0\n"
-gdb_expect -re "$gdb_prompt $"
+gdb_test_no_output "set width 0"
#send_gdb "ptype foo\n"
#gdb_expect {
@@ -75,269 +74,103 @@ gdb_expect -re "$gdb_prompt $"
# NOTE: Add -- ptype foo.x, etc. when things are working
#Initialize foo
-send_gdb "next\n"
-gdb_expect {
- -re "40\[ \t\]*foo.paper = 33;\r\n$gdb_prompt $" {
- pass "next 1"
- }
- -re ".*$gdb_prompt $" { fail "next 1" }
- timeout { fail "(timeout) next 1" }
-}
+gdb_test "next" "40\[ \t\]*foo.paper = 33;" "next 1"
# Print out the big anon union.
-send_gdb "print foo\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 0, cloth = 0\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
- pass "print foo 1"
- }
- -re ".*$gdb_prompt $" { fail "print foo 1" }
- timeout { fail "(timeout) print foo 1" }
-}
+gdb_test "print foo" \
+ "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 0, cloth = 0\}, num2 = \{two = 0, three = 0\}\}" \
+ "print foo 1"
# Step over assignment to member
-send_gdb "next\n"
-gdb_expect {
- -re "41\[ \t\]*foo.pebble = 44;\r\n$gdb_prompt $" {
- pass "next 1"
- }
- -re ".*$gdb_prompt $" { fail "next 1" }
- timeout { fail "(timeout) next 1" }
-}
+gdb_test "next" "41\[ \t\]*foo.pebble = 44;" "next 2"
# Now print out anon union again
-send_gdb "print foo\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 33, cloth = 33\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
- pass "print foo 2"
- }
- -re ".*$gdb_prompt $" { fail "print foo 2" }
- timeout { fail "(timeout) print foo 2" }
-}
+gdb_test "print foo" \
+ "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 33, cloth = 33\}, num2 = \{two = 0, three = 0\}\}" \
+ "print foo 2"
# Modify the member just set
-send_gdb "set var foo.cloth = 35\n"
-gdb_expect {
- -re "\r\n$gdb_prompt $" {
- pass "set var foo.cloth"
- }
- timeout { fail "(timeout) set var foo.cloth" }
-}
+gdb_test_no_output "set var foo.cloth = 35" "set var foo.cloth"
# Now print out anon union again to see if the right member was set
-send_gdb "print foo\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
- pass "print foo 3"
- }
- -re ".*$gdb_prompt $" { fail "print foo 3" }
- timeout { fail "(timeout) print foo 3" }
-}
-
+gdb_test "print foo" \
+ "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
+ "print foo 3"
# Step over next assignment to member
-send_gdb "next\n"
-gdb_expect {
- -re "42\[ \t\]*foo.mux = 55;\r\n$gdb_prompt $" {
- pass "next 2"
- }
- -re ".*$gdb_prompt $" { fail "next 2" }
- timeout { fail "(timeout) next 2" }
-}
+gdb_test "next" "42\[ \t\]*foo.mux = 55;" "next 3"
# Now print out anon union again
-send_gdb "print foo\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 44, x = \{rock = 44, rock2 = 0\}, \{qux = 44, mux = 44\}, boulder = 44\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
- pass "print foo 4"
- }
- -re ".*$gdb_prompt $" { fail "print foo 4" }
- timeout { fail "(timeout) print foo 4" }
-}
+gdb_test "print foo" \
+ "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 44, x = \{rock = 44, rock2 = 0\}, \{qux = 44, mux = 44\}, boulder = 44\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
+ "print foo 4"
# Modify the member just set
-send_gdb "set var foo.pebble = 45\n"
-gdb_expect {
- -re "\r\n$gdb_prompt $" {
- pass "set var foo.pebble"
- }
- timeout { fail "(timeout) set var foo.pebble" }
-}
+gdb_test_no_output "set var foo.pebble = 45" "set var foo.pebble"
# Now print out anon union again to see if the right member was set
-send_gdb "print foo\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 45, x = \{rock = 45, rock2 = 0\}, \{qux = 45, mux = 45\}, boulder = 45\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
- pass "print foo 5"
- }
- -re ".*$gdb_prompt $" { fail "print foo 5" }
- timeout { fail "(timeout) print foo 5" }
-}
+gdb_test "print foo" \
+ "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 45, x = \{rock = 45, rock2 = 0\}, \{qux = 45, mux = 45\}, boulder = 45\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
+ "print foo 5"
# Modify another member at a different level
-send_gdb "set var foo.qux = 46\n"
-gdb_expect {
- -re "\r\n$gdb_prompt $" {
- pass "set var foo.qux"
- }
- timeout { fail "(timeout) set var foo.qux" }
-}
+gdb_test_no_output "set var foo.qux = 46" "set var foo.qux"
# Now print out anon union again to see if the right member was set
-send_gdb "print foo\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 46, x = \{rock = 46, rock2 = 0\}, \{qux = 46, mux = 46\}, boulder = 46\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
- pass "print foo 6"
- }
- -re ".*$gdb_prompt $" { fail "print foo 6" }
- timeout { fail "(timeout) print foo 6" }
-}
+gdb_test "print foo" \
+ "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 46, x = \{rock = 46, rock2 = 0\}, \{qux = 46, mux = 46\}, boulder = 46\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
+ "print foo 6"
# Modify the member at another level, but not the first one in the union
-send_gdb "set var foo.mux = 47\n"
-gdb_expect {
- -re "\r\n$gdb_prompt $" {
- pass "set var foo.mux"
- }
- timeout { fail "(timeout) set var foo.mux" }
-}
+gdb_test_no_output "set var foo.mux = 47" "set var foo.mux"
# Now print out anon union again to see if things worked
-send_gdb "print foo\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 47, x = \{rock = 47, rock2 = 0\}, \{qux = 47, mux = 47\}, boulder = 47\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
- pass "print foo 7"
- }
- -re ".*$gdb_prompt $" { fail "print foo 7" }
- timeout { fail "(timeout) print foo 7" }
-}
+gdb_test "print foo" \
+ "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 47, x = \{rock = 47, rock2 = 0\}, \{qux = 47, mux = 47\}, boulder = 47\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
+ "print foo 7"
# Modify a member of a struct in an anon union
-send_gdb "set var foo.x.rock = 48\n"
-gdb_expect {
- -re "\r\n$gdb_prompt $" {
- pass "set var foo.x.rock"
- }
- timeout { fail "(timeout) set var foo.x.rock" }
-}
+gdb_test_no_output "set var foo.x.rock = 48" "set var foo.x.rock"
# Now print out anon union again to see if things worked
-send_gdb "print foo\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 48, x = \{rock = 48, rock2 = 0\}, \{qux = 48, mux = 48\}, boulder = 48\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
- pass "print foo 8"
- }
- -re ".*$gdb_prompt $" { fail "print foo 8" }
- timeout { fail "(timeout) print foo 8" }
-}
+gdb_test "print foo" \
+ "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 48, x = \{rock = 48, rock2 = 0\}, \{qux = 48, mux = 48\}, boulder = 48\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
+ "print foo 8"
# Modify a member of a struct in an anon union, but something
# that doesn't alias to some other union member
-send_gdb "set var foo.x.rock2 = 49\n"
-gdb_expect {
- -re "\r\n$gdb_prompt $" {
- pass "set var foo.x.rock2"
- }
- timeout { fail "(timeout) set var foo.x.rock2" }
-}
+gdb_test_no_output "set var foo.x.rock2 = 49" "set var foo.x.rock2"
# Now print out anon union again to see if things worked
-send_gdb "print foo\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 48, x = \{rock = 48, rock2 = 49\}, \{qux = 48, mux = 48\}, boulder = 48\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}\r\n$gdb_prompt $" {
- pass "print foo 9"
- }
- -re ".*$gdb_prompt $" { fail "print foo 9" }
- timeout { fail "(timeout) print foo 9" }
-}
-
+gdb_test "print foo" \
+ "\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 48, x = \{rock = 48, rock2 = 49\}, \{qux = 48, mux = 48\}, boulder = 48\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
+ "print foo 9"
# Step over next four assignments
-send_gdb "next 4\n"
-gdb_expect {
- -re "53\[ \t\]*w = 45;\r\n$gdb_prompt $" {
- pass "next 3"
- }
- -re ".*$gdb_prompt $" { fail "next 3" }
- timeout { fail "(timeout) next 3" }
-}
+gdb_test "next 4" "53\[ \t\]*w = 45;" "next 4"
# Tests for anon unions that are not members of a class or struct
-send_gdb "print w\n"
-gdb_expect {
- -re "\\$\[0-9\]* = 0\r\n$gdb_prompt $" {
- pass "print w 1"
- }
- -re ".*$gdb_prompt $" { fail "print w 1" }
- timeout { fail "(timeout) print w 1" }
-}
+gdb_test "print w" "\\$\[0-9\]* = 0" "print w 1"
-send_gdb "print z\n"
-gdb_expect {
- -re "\\$\[0-9\]* = 0\r\n$gdb_prompt $" {
- pass "print z 1"
- }
- -re ".*$gdb_prompt $" { fail "print z 1" }
- timeout { fail "(timeout) print z 1" }
-}
+gdb_test "print z" "\\$\[0-9\]* = 0" "print z 1"
# Step over next assignment to w
-send_gdb "next\n"
-gdb_expect {
- -re "55\[ \t\]*int j = 0;\r\n$gdb_prompt $" {
- pass "next 4"
- }
- -re ".*$gdb_prompt $" { fail "next 4" }
- timeout { fail "(timeout) next 4" }
-}
+gdb_test "next" "55\[ \t\]*int j = 0;" "next 5"
# See if the change in value is noticed
-send_gdb "print w\n"
-gdb_expect {
- -re "\\$\[0-9\]* = 45\r\n$gdb_prompt $" {
- pass "print w 2"
- }
- -re ".*$gdb_prompt $" { fail "print w 2" }
- timeout { fail "(timeout) print w 2" }
-}
+gdb_test "print w" "\\$\[0-9\]* = 45" "print w 2"
# See if z shows the same value
-send_gdb "print z\n"
-gdb_expect {
- -re "\\$\[0-9\]* = 45\r\n$gdb_prompt $" {
- pass "print z 2"
- }
- -re ".*$gdb_prompt $" { fail "print z 2" }
- timeout { fail "(timeout) print z 2" }
-}
+gdb_test "print z" "\\$\[0-9\]* = 45" pass "print z 2"
# Set the anon union member
-send_gdb "set var z = 27\n"
-gdb_expect {
- -re "\r\n$gdb_prompt $" {
- pass "set var z"
- }
- timeout { fail "(timeout) set var z" }
-}
+gdb_test_no_output "set var z = 27" "set var z"
# See if the change in value is noticed
-send_gdb "print w\n"
-gdb_expect {
- -re "\\$\[0-9\]* = 27\r\n$gdb_prompt $" {
- pass "print w 3"
- }
- -re ".*$gdb_prompt $" { fail "print w 3" }
- timeout { fail "(timeout) print w 3" }
-}
+gdb_test "print w" "\\$\[0-9\]* = 27" "print w 3"
# See if z shows the same value
-send_gdb "print z\n"
-gdb_expect {
- -re "\\$\[0-9\]* = 27\r\n$gdb_prompt $" {
- pass "print z 3"
- }
- -re ".*$gdb_prompt $" { fail "print z 3" }
- timeout { fail "(timeout) print z 3" }
-}
+gdb_test "print z" "\\$\[0-9\]* = 27" "print z 3"
diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.exp b/gdb/testsuite/gdb.cp/cplusfuncs.exp
index 96b57ca..d33c8e1 100644
--- a/gdb/testsuite/gdb.cp/cplusfuncs.exp
+++ b/gdb/testsuite/gdb.cp/cplusfuncs.exp
@@ -99,278 +99,194 @@ proc probe_demangler { } {
global dm_type_unsigned_long
global dm_type_typedef
- send_gdb "print &foo::operator,(foo&)\n"
- gdb_expect {
- -re ".*foo::operator, \\(.*foo.*&.*\\).*\r\n$gdb_prompt $" {
- # v2 demangler
- set dm_operator_comma ", "
- pass "detect dm_operator_comma"
+ gdb_test_multiple "print &foo::operator,(foo&)" \
+ "detect dm_operator_comma" {
+ -re ".*foo::operator, \\(.*foo.*&.*\\).*\r\n$gdb_prompt $" {
+ # v2 demangler
+ set dm_operator_comma ", "
+ pass "detect dm_operator_comma"
+ }
+ -re ".*foo::operator,\\(.*foo.*&.*\\).*\r\n$gdb_prompt $" {
+ # v3 demangler
+ pass "detect dm_operator_comma"
+ }
+ }
+
+ gdb_test_multiple "print &foo::operator char*($dm_type_void)" \
+ "detect dm_operator_char_star" {
+ -re ".*foo::operator char \\*\\(void\\).*\r\n$gdb_prompt $" {
+ # v2 demangler or GDB type printer
+ set dm_operator_char_star "char *"
+ set dm_operator_char_star_quoted "char \\*"
+ pass "detect dm_operator_char_star"
+ }
+ -re ".*foo::operator char\\*\\(\\).*\r\n$gdb_prompt $" {
+ # v3 demangler
+ pass "detect dm_operator_char_star"
+ }
+ }
+
+ gdb_test_multiple "print &dm_type_char_star" \
+ "detect dm_type_char_star" {
+ -re ".*dm_type_char_star\\(char \\*\\).*\r\n$gdb_prompt $" {
+ # v2 demangler
+ set dm_type_char_star "char *"
+ set dm_type_char_star_quoted "char \\*"
+ pass "detect dm_type_char_star"
+ }
+ -re ".*dm_type_char_star\\(char\\*\\).*\r\n$gdb_prompt $" {
+ # v3 demangler
+ pass "detect dm_type_char_star"
+ }
+ }
+
+ gdb_test_multiple "print &dm_type_foo_ref" \
+ "detect dm_type_foo_ref" {
+ -re ".*dm_type_foo_ref\\(foo &\\).*\r\n$gdb_prompt $" {
+ # v2 demangler
+ set dm_type_foo_ref "foo &"
+ pass "detect dm_type_foo_ref"
+ }
+ -re ".*dm_type_foo_ref\\(foo&\\).*\r\n$gdb_prompt $" {
+ # v3 demangler
+ pass "detect dm_type_foo_ref"
+ }
+ }
+
+ gdb_test_multiple "print &dm_type_int_star" \
+ "detect dm_type_int_star" {
+ -re ".*dm_type_int_star\\(int \\*\\).*\r\n$gdb_prompt $" {
+ # v2 demangler
+ set dm_type_int_star "int *"
+ pass "detect dm_type_int_star"
+ }
+ -re ".*dm_type_int_star\\(int\\*\\).*\r\n$gdb_prompt $" {
+ # v3 demangler
+ pass "detect dm_type_int_star"
+ }
+ }
+
+ gdb_test_multiple "print &dm_type_long_star" \
+ "detect dm_type_long_star" {
+ -re ".*dm_type_long_star\\(long \\*\\).*\r\n$gdb_prompt $" {
+ # v2 demangler
+ set dm_type_long_star "long *"
+ pass "detect dm_type_long_star"
+ }
+ -re ".*dm_type_long_star\\(long\\*\\).*\r\n$gdb_prompt $" {
+ # v3 demangler
+ pass "detect dm_type_long_star"
+ }
+ -re ".*dm_type_long_star\\(long int \\*\\).*\r\n$gdb_prompt $" {
+ # GCC v3 and GDB's type printer
+ set dm_type_long_star "long int *"
+ pass "detect dm_type_long_star"
+ }
+ }
+
+ gdb_test_multiple "print &dm_type_unsigned_int" \
+ "detect dm_type_unsigned_int" {
+ -re ".*dm_type_unsigned_int\\(unsigned int\\).*\r\n$gdb_prompt $" {
+ # v2 demangler
+ set dm_type_unsigned_int "unsigned int"
+ pass "detect dm_type_unsigned_int"
+ }
+ -re ".*dm_type_unsigned_int\\(unsigned\\).*\r\n$gdb_prompt $" {
+ # v3 demangler
+ pass "detect dm_type_unsigned_int"
+ }
+ }
+
+ gdb_test_multiple "print &dm_type_void" \
+ "detect dm_type_void" {
+ -re ".*dm_type_void\\(void\\).*\r\n$gdb_prompt $" {
+ # v2 demangler
+ set dm_type_void "void"
+ pass "detect dm_type_void"
+ }
+ -re ".*dm_type_void\\(\\).*\r\n$gdb_prompt $" {
+ # v3 demangler
+ pass "detect dm_type_void"
+ }
+ }
+
+ gdb_test_multiple "print &dm_type_void_star" \
+ "detect dm_type_void_star" {
+ -re ".*dm_type_void_star\\(void \\*\\).*\r\n$gdb_prompt $" {
+ # v2 demangler
+ set dm_type_void_star "void *"
+ pass "detect dm_type_void_star"
+ }
+ -re ".*dm_type_void_star\\(void\\*\\).*\r\n$gdb_prompt $" {
+ # v3 demangler
+ pass "detect dm_type_void_star"
+ }
+ }
+
+ gdb_test_multiple "print &dm_type_short" \
+ "detect dm_type_short" {
+ -re ".*dm_type_short\\(short\\).*\r\n$gdb_prompt $" {
+ # v2 and v3 demanglers
+ pass "detect dm_type_short"
+ }
+ -re ".*dm_type_short\\(short int\\).*\r\n$gdb_prompt $" {
+ # GDB type printer
+ set dm_type_short "short int"
+ pass "detect dm_type_short"
+ }
+ }
+
+ gdb_test_multiple "print &dm_type_unsigned_short" \
+ "detect dm_type_unsigned_short" {
+ -re ".*dm_type_unsigned_short\\(unsigned short\\).*\r\n$gdb_prompt $" {
+ # v2 and v3 demanglers
+ pass "detect dm_type_unsigned_short"
+ }
+ -re ".*dm_type_unsigned_short\\(short unsigned int\\).*\r\n$gdb_prompt $" {
+ # GDB type printer
+ set dm_type_unsigned_short "short unsigned int"
+ pass "detect dm_type_unsigned_short"
+ }
+ }
+
+ gdb_test_multiple "print &dm_type_long" \
+ "detect dm_type_long" {
+ -re ".*dm_type_long\\(long\\).*\r\n$gdb_prompt $" {
+ # v2 and v3 demanglers
+ pass "detect dm_type_long"
+ }
+ -re ".*dm_type_long\\(long int\\).*\r\n$gdb_prompt $" {
+ # GDB type printer
+ set dm_type_long "long int"
+ pass "detect dm_type_long"
+ }
+ }
+
+ gdb_test_multiple "print &dm_type_unsigned_long" \
+ "detect dm_type_unsigned_long" {
+ -re ".*dm_type_unsigned_long\\(unsigned long\\).*\r\n$gdb_prompt $" {
+ # v2 and v3 demanglers
+ pass "detect dm_type_unsigned_long"
+ }
+ -re ".*dm_type_unsigned_long\\(long unsigned int\\).*\r\n$gdb_prompt $" {
+ # GDB type printer
+ set dm_type_unsigned_long "long unsigned int"
+ pass "detect dm_type_unsigned_long"
+ }
+ }
+
+ gdb_test_multiple "print &dm_type_typedef" \
+ "detect dm_type_typedef" {
+ -re ".*dm_type_typedef\\(int\\).*\r\n$gdb_prompt $" {
+ # v2 and v3 demanglers
+ pass "detect dm_type_typedef"
+ }
+ -re ".*dm_type_typedef\\(myint\\).*\r\n$gdb_prompt $" {
+ # GDB type printer
+ set dm_type_typedef 1
+ pass "detect dm_type_typedef"
+ }
}
- -re ".*foo::operator,\\(.*foo.*&.*\\).*\r\n$gdb_prompt $" {
- # v3 demangler
- pass "detect dm_operator_comma"
- }
- -re ".*$gdb_prompt $" {
- fail "detect dm_operator_comma"
- }
- timeout {
- fail "detect dm_operator_comma"
- }
- }
-
- send_gdb "print &foo::operator char*($dm_type_void)\n"
- gdb_expect {
- -re ".*foo::operator char \\*\\(void\\).*\r\n$gdb_prompt $" {
- # v2 demangler or GDB type printer
- set dm_operator_char_star "char *"
- set dm_operator_char_star_quoted "char \\*"
- pass "detect dm_operator_char_star"
- }
- -re ".*foo::operator char\\*\\(\\).*\r\n$gdb_prompt $" {
- # v3 demangler
- pass "detect dm_operator_char_star"
- }
- -re ".*$gdb_prompt $" {
- fail "detect dm_operator_char_star"
- }
- timeout {
- fail "detect dm_operator_char_star"
- }
- }
-
- send_gdb "print &dm_type_char_star\n"
- gdb_expect {
- -re ".*dm_type_char_star\\(char \\*\\).*\r\n$gdb_prompt $" {
- # v2 demangler
- set dm_type_char_star "char *"
- set dm_type_char_star_quoted "char \\*"
- pass "detect dm_type_char_star"
- }
- -re ".*dm_type_char_star\\(char\\*\\).*\r\n$gdb_prompt $" {
- # v3 demangler
- pass "detect dm_type_char_star"
- }
- -re ".*$gdb_prompt $" {
- fail "detect dm_type_char_star"
- }
- timeout {
- fail "detect dm_type_char_star (timeout)"
- }
- }
-
- send_gdb "print &dm_type_foo_ref\n"
- gdb_expect {
- -re ".*dm_type_foo_ref\\(foo &\\).*\r\n$gdb_prompt $" {
- # v2 demangler
- set dm_type_foo_ref "foo &"
- pass "detect dm_type_foo_ref"
- }
- -re ".*dm_type_foo_ref\\(foo&\\).*\r\n$gdb_prompt $" {
- # v3 demangler
- pass "detect dm_type_foo_ref"
- }
- -re ".*$gdb_prompt $" {
- fail "detect dm_type_foo_ref"
- }
- timeout {
- fail "detect dm_type_foo_ref (timeout)"
- }
- }
-
- send_gdb "print &dm_type_int_star\n"
- gdb_expect {
- -re ".*dm_type_int_star\\(int \\*\\).*\r\n$gdb_prompt $" {
- # v2 demangler
- set dm_type_int_star "int *"
- pass "detect dm_type_int_star"
- }
- -re ".*dm_type_int_star\\(int\\*\\).*\r\n$gdb_prompt $" {
- # v3 demangler
- pass "detect dm_type_int_star"
- }
- -re ".*$gdb_prompt $" {
- fail "detect dm_type_int_star"
- }
- timeout {
- fail "detect dm_type_int_star (timeout)"
- }
- }
-
- send_gdb "print &dm_type_long_star\n"
- gdb_expect {
- -re ".*dm_type_long_star\\(long \\*\\).*\r\n$gdb_prompt $" {
- # v2 demangler
- set dm_type_long_star "long *"
- pass "detect dm_type_long_star"
- }
- -re ".*dm_type_long_star\\(long\\*\\).*\r\n$gdb_prompt $" {
- # v3 demangler
- pass "detect dm_type_long_star"
- }
- -re ".*dm_type_long_star\\(long int \\*\\).*\r\n$gdb_prompt $" {
- # GCC v3 and GDB's type printer
- set dm_type_long_star "long int *"
- pass "detect dm_type_long_star"
- }
- -re ".*$gdb_prompt $" {
- fail "detect dm_type_long_star"
- }
- timeout {
- fail "detect dm_type_long_star (timeout)"
- }
- }
-
- send_gdb "print &dm_type_unsigned_int\n"
- gdb_expect {
- -re ".*dm_type_unsigned_int\\(unsigned int\\).*\r\n$gdb_prompt $" {
- # v2 demangler
- set dm_type_unsigned_int "unsigned int"
- pass "detect dm_type_unsigned_int"
- }
- -re ".*dm_type_unsigned_int\\(unsigned\\).*\r\n$gdb_prompt $" {
- # v3 demangler
- pass "detect dm_type_unsigned_int"
- }
- -re ".*$gdb_prompt $" {
- fail "detect dm_type_unsigned_int"
- }
- timeout {
- fail "detect dm_unsigned int (timeout)"
- }
- }
-
- send_gdb "print &dm_type_void\n"
- gdb_expect {
- -re ".*dm_type_void\\(void\\).*\r\n$gdb_prompt $" {
- # v2 demangler
- set dm_type_void "void"
- pass "detect dm_type_void"
- }
- -re ".*dm_type_void\\(\\).*\r\n$gdb_prompt $" {
- # v3 demangler
- pass "detect dm_type_void"
- }
- -re ".*$gdb_prompt $" {
- fail "detect dm_type_void"
- }
- timeout {
- fail "detect dm_type_void (timeout)"
- }
- }
-
- send_gdb "print &dm_type_void_star\n"
- gdb_expect {
- -re ".*dm_type_void_star\\(void \\*\\).*\r\n$gdb_prompt $" {
- # v2 demangler
- set dm_type_void_star "void *"
- pass "detect dm_type_void_star"
- }
- -re ".*dm_type_void_star\\(void\\*\\).*\r\n$gdb_prompt $" {
- # v3 demangler
- pass "detect dm_type_void_star"
- }
- -re ".*$gdb_prompt $" {
- fail "detect dm_type_void_star"
- }
- timeout {
- fail "detect dm_type_void_star (timeout)"
- }
- }
-
- send_gdb "print &dm_type_short\n"
- gdb_expect {
- -re ".*dm_type_short\\(short\\).*\r\n$gdb_prompt $" {
- # v2 and v3 demanglers
- pass "detect dm_type_short"
- }
- -re ".*dm_type_short\\(short int\\).*\r\n$gdb_prompt $" {
- # GDB type printer
- set dm_type_short "short int"
- pass "detect dm_type_short"
- }
- -re ".*$gdb_prompt $" {
- fail "detect dm_type_short"
- }
- timeout {
- fail "detect dm_type_short (timeout)"
- }
- }
-
- send_gdb "print &dm_type_unsigned_short\n"
- gdb_expect {
- -re ".*dm_type_unsigned_short\\(unsigned short\\).*\r\n$gdb_prompt $" {
- # v2 and v3 demanglers
- pass "detect dm_type_unsigned_short"
- }
- -re ".*dm_type_unsigned_short\\(short unsigned int\\).*\r\n$gdb_prompt $" {
- # GDB type printer
- set dm_type_unsigned_short "short unsigned int"
- pass "detect dm_type_unsigned_short"
- }
- -re ".*$gdb_prompt $" {
- fail "detect dm_type_unsigned_short"
- }
- timeout {
- fail "detect dm_type_unsigned_short (timeout)"
- }
- }
-
- send_gdb "print &dm_type_long\n"
- gdb_expect {
- -re ".*dm_type_long\\(long\\).*\r\n$gdb_prompt $" {
- # v2 and v3 demanglers
- pass "detect dm_type_long"
- }
- -re ".*dm_type_long\\(long int\\).*\r\n$gdb_prompt $" {
- # GDB type printer
- set dm_type_long "long int"
- pass "detect dm_type_long"
- }
- -re ".*$gdb_prompt $" {
- fail "detect dm_type_long"
- }
- timeout {
- fail "detect dm_type_long (timeout)"
- }
- }
-
- send_gdb "print &dm_type_unsigned_long\n"
- gdb_expect {
- -re ".*dm_type_unsigned_long\\(unsigned long\\).*\r\n$gdb_prompt $" {
- # v2 and v3 demanglers
- pass "detect dm_type_unsigned_long"
- }
- -re ".*dm_type_unsigned_long\\(long unsigned int\\).*\r\n$gdb_prompt $" {
- # GDB type printer
- set dm_type_unsigned_long "long unsigned int"
- pass "detect dm_type_unsigned_long"
- }
- -re ".*$gdb_prompt $" {
- fail "detect dm_type_unsigned_long"
- }
- timeout {
- fail "detect dm_type_unsigned_long (timeout)"
- }
- }
-
- send_gdb "print &dm_type_typedef\n"
- gdb_expect {
- -re ".*dm_type_typedef\\(int\\).*\r\n$gdb_prompt $" {
- # v2 and v3 demanglers
- pass "detect dm_type_typedef"
- }
- -re ".*dm_type_typedef\\(myint\\).*\r\n$gdb_prompt $" {
- # GDB type printer
- set dm_type_typedef 1
- pass "detect dm_type_typedef"
- }
- -re ".*$gdb_prompt $" {
- fail "detect dm_type_typedef"
- }
- timeout {
- fail "detect dm_type_typedef (timeout)"
- }
- }
}
#
@@ -381,19 +297,11 @@ proc probe_demangler { } {
proc info_func_regexp { name demangled } {
global gdb_prompt
- send_gdb "info function $name\n"
regsub {\\\(void\\\)} $demangled {\(\)} demangled
- gdb_expect {
- -re ".*File .*:\r\n(class |)$demangled\r\n.*$gdb_prompt $" {
- pass "info function for \"$name\""
- }
- -re ".*$gdb_prompt $" {
- fail "info function for \"$name\""
- }
- timeout {
- fail "info function for \"$name\" (timeout)"
- }
- }
+
+ gdb_test "info function $name" \
+ "File .*:\r\n(class|)${demangled}.*" \
+ "info function for \"$name\""
}
#
@@ -419,18 +327,8 @@ proc print_addr_2 { name good } {
set good_pattern [string_to_regexp $good]
- send_gdb "print &$name\n"
- gdb_expect {
- -re ".* = .* $hex <$good_pattern>\r\n$gdb_prompt $" {
- pass "print &$name"
- }
- -re ".*$gdb_prompt $" {
- fail "print &$name"
- }
- timeout {
- fail "print &$name (timeout)"
- }
- }
+ gdb_test "print &$name" \
+ ".* = .* $hex <$good_pattern>"
}
# NOTE: carlton/2003-01-16: hairyfunc5-6 fail on GCC 3.x (for at least
@@ -447,20 +345,13 @@ proc print_addr_2_kfail { name good bad bugid } {
set good_pattern [string_to_regexp $good]
set bad_pattern [string_to_regexp $bad]
- send_gdb "print &$name\n"
- gdb_expect {
+ gdb_test_multiple "print &$name" "print &$name" {
-re ".* = .* $hex <$good_pattern>\r\n$gdb_prompt $" {
pass "print &$name"
}
-re ".* = .* $hex <$bad_pattern>\r\n$gdb_prompt $" {
kfail $bugid "print &$name"
}
- -re ".*$gdb_prompt $" {
- fail "print &$name"
- }
- timeout {
- fail "print &$name (timeout)"
- }
}
}
@@ -712,10 +603,8 @@ proc do_tests {} {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
- send_gdb "set language c++\n"
- gdb_expect -re "$gdb_prompt $"
- send_gdb "set width 0\n"
- gdb_expect -re "$gdb_prompt $"
+ gdb_test_no_output "set language c++"
+ gdb_test_no_output "set width 0"
runto_main
diff --git a/gdb/testsuite/gdb.cp/demangle.exp b/gdb/testsuite/gdb.cp/demangle.exp
index d00b8fe..11bc121 100644
--- a/gdb/testsuite/gdb.cp/demangle.exp
+++ b/gdb/testsuite/gdb.cp/demangle.exp
@@ -32,35 +32,35 @@ proc set_demangling_style {style} {
global gdb_prompt
global current_demangling_style
- send_gdb "set demangle-style $style\n"
- gdb_expect {
- -re "set demangle-style $style\[\r\n\]+$gdb_prompt $" {
- pass "$style: set demangle-style"
+ gdb_test_multiple "set demangle-style $style" \
+ "$style: set demangle-style" {
+ -re "set demangle-style $style\[\r\n\]+$gdb_prompt $" {
+ pass "$style: set demangle-style"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "$style: set demangle-style"
+ error "set_demangling_style: set style"
+ }
+ timeout {
+ fail "$style: set demangle-style (timeout)"
+ error "set_demangling_style: set style"
+ }
}
- -re ".*$gdb_prompt $" {
- fail "$style: set demangle-style"
- error "set_demangling_style: set style"
- }
- timeout {
- fail "$style: set demangle-style (timeout)"
- error "set_demangling_style: set style"
- }
- }
- send_gdb "show demangle-style\n"
- gdb_expect {
- -re "The current C\[+\]+ demangling style is \"$style\".\r\n$gdb_prompt $" {
- pass "$style: check demangling style"
- }
- -re ".*$gdb_prompt $" {
- fail "$style: check demangling style"
- error "set_demangling_style: check style"
- }
- timeout {
- fail "$style: check demangling style (timeout)"
- error "set_demangling_style: check style"
+ gdb_test_multiple "show demangle-style" \
+ "$style: check demangling style" {
+ -re "The current C\[+\]+ demangling style is \"$style\".\r\n$gdb_prompt $" {
+ pass "$style: check demangling style"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "$style: check demangling style"
+ error "set_demangling_style: check style"
+ }
+ timeout {
+ fail "$style: check demangling style (timeout)"
+ error "set_demangling_style: check style"
+ }
}
- }
set current_demangling_style $style
}
@@ -531,19 +531,13 @@ proc test_gnu_style_demangling {} {
## 1999-04-19: "Fix from Dale Hawkins". Shouldn't segfault.
# Accept even a dubious demangling; the string is ambiguous.
- send_gdb "maintenance demangle __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator\n"
- gdb_expect {
+
+ gdb_test_multiple "maintenance demangle __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator" "gnu: __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator" {
-re "virtual function thunk \\(delta:-64\\) for CosNaming::_proxy_NamingContext::_0RL__list\\(unsigned long, _CORBA_Unbounded_Sequence<CosNaming::Binding> \\*\\&, CosNaming::BindingIterator \\*\\&\\)\r\n$gdb_prompt $" {
- pass "gnu: __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator"
+ pass "gnu: __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator"
}
-re ".*Can't demangle \"__thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator\"\r\n$gdb_prompt $" {
- pass "gnu: __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator"
- }
- -re ".*$gdb_prompt $" {
- fail "gnu: __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator"
- }
- timeout {
- fail "gnu: __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator (timeout)"
+ pass "gnu: __thunk_64__0RL__list__Q29CosNaming20_proxy_NamingContextUlRPt25_CORBA_Unbounded_Sequence1ZQ29CosNaming7BindingRPQ29CosNaming15BindingIterator"
}
}
}
@@ -1558,10 +1552,8 @@ proc do_tests {} {
gdb_exit
gdb_start
- send_gdb "set language c++\n"
- gdb_expect -re "$gdb_prompt $"
- send_gdb "set width 0\n"
- gdb_expect -re "$gdb_prompt $"
+ gdb_test_no_output "set language c++"
+ gdb_test_no_output "set width 0"
# Using catch_demangling_errors this way ensures that, if one of
# the functions raises a Tcl error, then it'll get reported, and
diff --git a/gdb/testsuite/gdb.cp/formatted-ref.exp b/gdb/testsuite/gdb.cp/formatted-ref.exp
index 7e2071f..449844f 100644
--- a/gdb/testsuite/gdb.cp/formatted-ref.exp
+++ b/gdb/testsuite/gdb.cp/formatted-ref.exp
@@ -47,8 +47,7 @@ proc get_address { var } {
global expect_out
global gdb_prompt
- send_gdb "print &$var\n"
- gdb_expect {
+ gdb_test_multiple "print &$var" "find address of $var" {
-re "\\$\[0-9\]+ = \\(.*\\) (0x\[0-9a-f\]+).*$gdb_prompt $" {
return $expect_out(1,string)
}
@@ -57,6 +56,7 @@ proc get_address { var } {
return ""
}
}
+ return ""
}
proc test_p_x { var type val addr } {
diff --git a/gdb/testsuite/gdb.cp/local.exp b/gdb/testsuite/gdb.cp/local.exp
index fa7e3e8..7f1633c4 100644
--- a/gdb/testsuite/gdb.cp/local.exp
+++ b/gdb/testsuite/gdb.cp/local.exp
@@ -176,9 +176,9 @@ gdb_test "up" ".*main.*" "up from marker2"
# Make sure that `Local' isn't in scope here; it's local to foobar.
# setup_kfail "gdb/825"
-send_gdb "ptype Local\n"
+
set eol "\[\t \]*\[\r\n\]+\[\t \]*"
-gdb_expect {
+gdb_test_multiple "ptype Local" "Local out of scope" {
-re "No symbol \"Local\" in current context.*${gdb_prompt} $" {
pass "Local out of scope"
}
@@ -193,12 +193,6 @@ gdb_expect {
# gcc 3.X abi-2 -gstabs+
kfail gdb/825 "Local out of scope"
}
- -re ".*${gdb_prompt} $" {
- fail "Local out of scope"
- }
- timeout {
- fail "Local out of scope (timeout)"
- }
}
@@ -237,15 +231,22 @@ gdb_expect {
#
# chastain 2004-01-02
-send_gdb "ptype InnerLocal\n"
-gdb_expect {
- -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*(InnerLocal::|)NestedInnerLocal nest1;\[\r\n\t \]*int il_foo\\((unsigned char const|const unsigned char) *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal (pattern 1)" }
- -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*(InnerLocal::|)NestedInnerLocal nest1;\[\r\n\t \]*InnerLocal *& operator *=\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((void|)\\);\[\r\n\t \]*int il_foo\\(unsigned char const *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal (pattern 2)" }
- -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:36\\).*$gdb_prompt $" { pass "ptype InnerLocal (old HP aCC)" }
- -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal4::NestedInnerLocal nest1;\r\n\r\n\[\t \]*int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\\(Local at.*local\.cc:\[0-9\]+\\)\r\n\}.*$gdb_prompt $" { pass "ptype InnerLocal (old HP aCC)" }
- -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*(InnerLocal::|)NestedInnerLocal nest1;\[\r\n\t \]* int il_foo\\(unsigned char const *&\\);\[\r\n\t \]*InnerLocal *& operator *=\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((void|)\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype InnerLocal (pattern 5)" }
- -re ".*$gdb_prompt $" { fail "ptype InnerLocal" }
- timeout { fail "(timeout) ptype InnerLocal" }
+gdb_test_multiple "ptype InnerLocal" "ptype InnerLocal" {
+ -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*(InnerLocal::|)NestedInnerLocal nest1;\[\r\n\t \]*int il_foo\\((unsigned char const|const unsigned char) *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" {
+ pass "ptype InnerLocal (pattern 1)"
+ }
+ -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*(InnerLocal::|)NestedInnerLocal nest1;\[\r\n\t \]*InnerLocal *& operator *=\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((void|)\\);\[\r\n\t \]*int il_foo\\(unsigned char const *&\\);\[\r\n\t \]*\}.*$gdb_prompt $" {
+ pass "ptype InnerLocal (pattern 2)"
+ }
+ -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:36\\).*$gdb_prompt $" {
+ pass "ptype InnerLocal (old HP aCC)"
+ }
+ -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal4::NestedInnerLocal nest1;\r\n\r\n\[\t \]*int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\\(Local at.*local\.cc:\[0-9\]+\\)\r\n\}.*$gdb_prompt $" {
+ pass "ptype InnerLocal (old HP aCC)"
+ }
+ -re "type = class InnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*char ilc;\[\r\n\t \]*int \\* *ip;\[\r\n\t \]*(InnerLocal::|)NestedInnerLocal nest1;\[\r\n\t \]* int il_foo\\(unsigned char const *&\\);\[\r\n\t \]*InnerLocal *& operator *=\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((main${sep}::|)InnerLocal const *&\\);\[\r\n\t \]*InnerLocal\\((void|)\\);\[\r\n\t \]*\}.*$gdb_prompt $" {
+ pass "ptype InnerLocal (pattern 5)"
+ }
}
#---
@@ -268,15 +269,16 @@ gdb_expect {
# class support, but once we fix PR gdb/482, we should delete this
# test.
-send_gdb "ptype NestedInnerLocal\n"
-gdb_expect {
- -re "type = class NestedInnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*int nil;\[\r\n\t \]*int nil_foo\\(int\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype NestedInnerLocal" }
- -re "type = class NestedInnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*int nil;\[\r\n\t \]*NestedInnerLocal *& *operator *= *\\((main${sep}::|)InnerLocal::NestedInnerLocal const *&\\);\[\r\n\t \]*NestedInnerLocal\\((main${sep}::|)InnerLocal::NestedInnerLocal const *&\\);\[\r\n\t \]*NestedInnerLocal\\((void|)\\);\[\r\n\t \]*int nil_foo\\(int\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype NestedInnerLocal" }
- -re "No symbol \"NestedInnerLocal\" in current context\.\r\n$gdb_prompt $" {
- pass "ptype NestedInnerLocal"
- }
- -re ".*$gdb_prompt $" { fail "ptype NestedInnerLocal" }
- timeout { fail "(timeout) ptype NestedInnerLocal" }
+gdb_test_multiple "ptype NestedInnerLocal" "ptype NestedInnerLocal" {
+ -re "type = class NestedInnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*int nil;\[\r\n\t \]*int nil_foo\\(int\\);\[\r\n\t \]*\}.*$gdb_prompt $" {
+ pass "ptype NestedInnerLocal"
+ }
+ -re "type = class NestedInnerLocal \{\[\r\n\t \]*public:\[\r\n\t \]*int nil;\[\r\n\t \]*NestedInnerLocal *& *operator *= *\\((main${sep}::|)InnerLocal::NestedInnerLocal const *&\\);\[\r\n\t \]*NestedInnerLocal\\((main${sep}::|)InnerLocal::NestedInnerLocal const *&\\);\[\r\n\t \]*NestedInnerLocal\\((void|)\\);\[\r\n\t \]*int nil_foo\\(int\\);\[\r\n\t \]*\}.*$gdb_prompt $" {
+ pass "ptype NestedInnerLocal"
+ }
+ -re "No symbol \"NestedInnerLocal\" in current context\.\r\n$gdb_prompt $" {
+ pass "ptype NestedInnerLocal"
+ }
}
set re_class "((struct|class) InnerLocal::NestedInnerLocal \{${ws}public:|struct InnerLocal::NestedInnerLocal \{)"
diff --git a/gdb/testsuite/gdb.cp/method.exp b/gdb/testsuite/gdb.cp/method.exp
index db21f29..6324202 100644
--- a/gdb/testsuite/gdb.cp/method.exp
+++ b/gdb/testsuite/gdb.cp/method.exp
@@ -105,26 +105,24 @@ gdb_test "print x" \
get_debug_format
-send_gdb "print this\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \\(const (class |)A *\\* *(const|)\\) $hex\r\n$gdb_prompt $" {
- pass "print this in A::bar"
- }
- -re "\\$\[0-9\]* = \\((class |)A *\\* *(const|)\\) $hex\r\n$gdb_prompt $" {
- # gcc versions up to 3.0.4 with -gstabs+ do not emit "const" indicators,
- # so the output is "A *". It should be "const A *" or "const A * const".
- setup_xfail_format "stabs"
- fail "print this in A::bar (missing const)"
- }
- -re "\\$\[0-9\]* = \\(const (class |)\{\\.\\.\\.\} *\\* *(const|)\\) $hex\r\n$gdb_prompt $" {
- # gcc versions gcc-3_1-branch%20020404 and HEAD%20020404 with -gstabs+
- # produce good stabs, but gdb prints "const class {...} *" const.
- # This is PR gdb/277.
- # setup_kfail "gdb/277"
- fail "print this in A::bar (gdb/277)"
- }
- -re ".*$gdb_prompt $" { fail "print this in A::bar" }
- timeout { fail "(timeout) print this in A::bar" }
+gdb_test_multiple "print this" "print this in A::bar" {
+ -re "\\$\[0-9\]* = \\(const (class |)A *\\* *(const|)\\) $hex\r\n$gdb_prompt $" {
+ pass "print this in A::bar"
+ }
+ -re "\\$\[0-9\]* = \\((class |)A *\\* *(const|)\\) $hex\r\n$gdb_prompt $" {
+ # gcc versions up to 3.0.4 with -gstabs+ do not emit "const"
+ # indicators, so the output is "A *". It should be "const A
+ # *" or "const A * const".
+ setup_xfail_format "stabs"
+ fail "print this in A::bar (missing const)"
+ }
+ -re "\\$\[0-9\]* = \\(const (class |)\{\\.\\.\\.\} *\\* *(const|)\\) $hex\r\n$gdb_prompt $" {
+ # gcc versions gcc-3_1-branch%20020404 and HEAD%20020404 with -gstabs+
+ # produce good stabs, but gdb prints "const class {...} *" const.
+ # This is PR gdb/277.
+ # setup_kfail "gdb/277"
+ fail "print this in A::bar (gdb/277)"
+ }
}
# Check again with funk::getFunky (this is the original test case
@@ -158,36 +156,30 @@ gdb_test "print res" \
# Check ptype of class -- should show const/volatile methods
-send_gdb "ptype A\n"
-gdb_expect {
- -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) (const volatile|volatile const);\r\n\}\r\n$gdb_prompt $" {
- pass "ptype A"
- }
- -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*A & operator=\\(A const ?&\\);\r\n\[ \]*A\\(A const ?&\\);\r\n\[ \]*A\\((void|)\\);\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) (const volatile|volatile const);\r\n\}\r\n$gdb_prompt $" {
- pass "ptype A"
- }
- -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) (const volatile|volatile const);\r\n\[ \]*A & operator=\\(A const ?&\\);\r\n\[ \]*A\\(A const ?&\\);\r\n\[ \]*A\\((void|)\\);\r\n\}\r\n$gdb_prompt $" {
- pass "ptype A"
- }
- -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\);\r\n\[ \]*int qux\\(int, float\\) const;\r\n\}\r\n$gdb_prompt $" {
- pass "ptype A (HP aCC bug -- volatile not indicated)"
- }
- -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) const volatile;\r\n\}\r\n$gdb_prompt $" {
- pass "ptype A"
- }
- -re ".*$gdb_prompt $" { fail "ptype A" }
- timeout { fail "(timeout) ptype A" }
+gdb_test_multiple "ptype A" "ptype A" {
+ -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) (const volatile|volatile const);\r\n\}\r\n$gdb_prompt $" {
+ pass "ptype A"
+ }
+ -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*A & operator=\\(A const ?&\\);\r\n\[ \]*A\\(A const ?&\\);\r\n\[ \]*A\\((void|)\\);\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) (const volatile|volatile const);\r\n\}\r\n$gdb_prompt $" {
+ pass "ptype A"
+ }
+ -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) (const volatile|volatile const);\r\n\[ \]*A & operator=\\(A const ?&\\);\r\n\[ \]*A\\(A const ?&\\);\r\n\[ \]*A\\((void|)\\);\r\n\}\r\n$gdb_prompt $" {
+ pass "ptype A"
+ }
+ -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\);\r\n\[ \]*int qux\\(int, float\\) const;\r\n\}\r\n$gdb_prompt $" {
+ pass "ptype A (HP aCC bug -- volatile not indicated)"
+ }
+ -re "type = class A \{\r\n\[ \]*public:\r\n\[ \]*int x;\r\n\[ \]*int y;\r\n\r\n\[ \]*int foo\\(int\\);\r\n\[ \]*int bar\\(int\\) const;\r\n\[ \]*int baz\\(int, char\\) volatile;\r\n\[ \]*int qux\\(int, float\\) const volatile;\r\n\}\r\n$gdb_prompt $" {
+ pass "ptype A"
+ }
}
-send_gdb "cont\n"
-gdb_expect {
+gdb_test_multiple "cont" "finish program" {
-re "Continuing.\r\n\r\nProgram exited normally.*$gdb_prompt $" {
pass "finish program"
}
-re "Continuing.* EXIT code 0.*Program exited normally.*$gdb_prompt $" {
pass "finish program (exit wrapper)"
}
- -re ".*$gdb_prompt $" { fail "finish program" }
- default:{ fail "finish program (timeout)" }
}
diff --git a/gdb/testsuite/gdb.cp/misc.exp b/gdb/testsuite/gdb.cp/misc.exp
index 7ff9305..cf22a48 100644
--- a/gdb/testsuite/gdb.cp/misc.exp
+++ b/gdb/testsuite/gdb.cp/misc.exp
@@ -39,39 +39,17 @@ proc deduce_language_of_main {} {
# See what language gdb thinks main() is, prior to reading full symbols.
# I think this fails for COFF targets.
- send_gdb "show language\n"
- gdb_expect {
- -re ".* source language is \"auto; currently c\[+\]+\".*$gdb_prompt $" {
- pass "deduced language is C++, before full symbols"
- }
- -re ".*$gdb_prompt $" {
- fail "source language not correct for C++ (psymtabs only)"
- return
- }
- timeout {
- fail "can't show language (timeout)"
- return
- }
- }
+ gdb_test "show language" \
+ "source language is \"auto; currently c\[+\]+\".*" \
+ "deduced language is C++, before full symbols"
runto_main
# See if our idea of the language has changed.
- send_gdb "show language\n"
- gdb_expect {
- -re ".* source language is \"auto; currently c\[+\]+\".*$gdb_prompt $" {
- pass "deduced language is C++, after full symbols"
- }
- -re ".*$gdb_prompt $" {
- fail "source language not correct for C++ (full symbols)"
- return
- }
- timeout {
- fail "can't show language (timeout)"
- return
- }
- }
+ gdb_test "show language" \
+ "source language is \"auto; currently c\[+\]+\".*" \
+ "deduced language is C++, after full symbols"
}
proc test_expr { args } {
diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp
index 2fc0a4e..97521a1 100644
--- a/gdb/testsuite/gdb.cp/namespace.exp
+++ b/gdb/testsuite/gdb.cp/namespace.exp
@@ -87,77 +87,48 @@ gdb_test "up" ".*main.*" "up from marker1"
# I'm including versions both with and without quotes; for tests that
# shouldn't work with quotes, I'm only including one version.
-send_gdb "print 'AAA::c'\n"
-gdb_expect {
- -re "\\$\[0-9\]* = 0 '\\\\(0|000)'\r\n$gdb_prompt $" { pass "print 'AAA::c'" }
- -re ".*$gdb_prompt $" { fail "print 'AAA::c'" }
- timeout { fail "(timeout) print 'AAA::c'" }
-}
+gdb_test "print 'AAA::c'" \
+ "\\$\[0-9\]* = 0 '\\\\(0|000)'" \
+ "print 'AAA::c'"
-send_gdb "print AAA::c\n"
-gdb_expect {
- -re "\\$\[0-9\]* = 0 '\\\\(0|000)'\r\n$gdb_prompt $" { pass "print AAA::c" }
- -re ".*$gdb_prompt $" { fail "print AAA::c" }
- timeout { fail "(timeout) print AAA::c" }
-}
+gdb_test "print AAA::c" \
+ "\\$\[0-9\]* = 0 '\\\\(0|000)'" \
+ "print AAA::c"
# An object declared using "using".
-send_gdb "print ina\n"
-gdb_expect {
- -re "\\$\[0-9\]+ = {xx = 33}.*$gdb_prompt $" {
- pass "print ina"
- }
- -re ".*$gdb_prompt $" { fail "print ina" }
- timeout { fail "(timeout) print ina" }
-}
+gdb_test "print ina" "\\$\[0-9\]+ = {xx = 33}"
-send_gdb "ptype ina\n"
-gdb_expect {
- -re "type = class (AAA::|)inA \{\r\n\[ \]*public:\r\n\[ \]*int xx;\r\n\[ \]*\r\n\[ \]*.*int fum\\(int\\);\r\n\}\r\n$gdb_prompt $" {
- pass "ptype ina"
- }
- -re "type = class (AAA::|)inA \{\r\n\[ \]*public:\r\n\[ \]*int xx;\r\n\[ \]*\r\n\[ \]*int fum\\(int\\);\r\n.*\}\r\n$gdb_prompt $" {
- pass "ptype ina"
- }
- -re ".*$gdb_prompt $" { fail "ptype ina" }
- timeout { fail "(timeout) ptype ina" }
+gdb_test_multiple "ptype ina" "ptype ina" {
+ -re "type = class (AAA::|)inA \{\r\n\[ \]*public:\r\n\[ \]*int xx;\r\n\[ \]*\r\n\[ \]*.*int fum\\(int\\);\r\n\}\r\n$gdb_prompt $" {
+ pass "ptype ina"
+ }
+ -re "type = class (AAA::|)inA \{\r\n\[ \]*public:\r\n\[ \]*int xx;\r\n\[ \]*\r\n\[ \]*int fum\\(int\\);\r\n.*\}\r\n$gdb_prompt $" {
+ pass "ptype ina"
+ }
}
# Check all functions are known to GDB
setup_xfail hppa*-*-*11* CLLbs14869
-send_gdb "info func xyzq\n"
-gdb_expect {
- -re "All functions.*File.*namespace.cc:\r\nint AAA::A_xyzq\\(int\\);\r\nint BBB::B_xyzq\\(int\\);\r\nchar AAA::xyzq\\(char\\);\r\nchar BBB::xyzq\\(char\\);\r\nchar BBB::CCC::xyzq\\(char\\);\r\nchar BBB::Class::xyzq\\(char\\);\r\n$gdb_prompt $" {
- pass "info func xyzq"
- }
- -re "All functions.*File.*namespace.cc:\r\nint AAA::A_xyzq\\(int\\);\r\nchar AAA::xyzq\\(char\\);\r\nint BBB::B_xyzq\\(int\\);\r\nchar BBB::CCC::xyzq\\(char\\);\r\nchar BBB::Class::xyzq\\(char\\);\r\nchar BBB::xyzq\\(char\\);\r\n$gdb_prompt $" {
- pass "info func xyzq"
- }
- -re ".*$gdb_prompt $" { fail "info func xyzq" }
- timeout { fail "(timeout) info func xyzq" }
+gdb_test_multiple "info func xyzq" "info func xyzq" {
+ -re "All functions.*File.*namespace.cc:\r\nint AAA::A_xyzq\\(int\\);\r\nint BBB::B_xyzq\\(int\\);\r\nchar AAA::xyzq\\(char\\);\r\nchar BBB::xyzq\\(char\\);\r\nchar BBB::CCC::xyzq\\(char\\);\r\nchar BBB::Class::xyzq\\(char\\);\r\n$gdb_prompt $" {
+ pass "info func xyzq"
+ }
+ -re "All functions.*File.*namespace.cc:\r\nint AAA::A_xyzq\\(int\\);\r\nchar AAA::xyzq\\(char\\);\r\nint BBB::B_xyzq\\(int\\);\r\nchar BBB::CCC::xyzq\\(char\\);\r\nchar BBB::Class::xyzq\\(char\\);\r\nchar BBB::xyzq\\(char\\);\r\n$gdb_prompt $" {
+ pass "info func xyzq"
+ }
}
# Call a function in a namespace
-send_gdb "print 'AAA::xyzq'('x')\n"
-gdb_expect {
- -re "\\$\[0-9\]* = 97 'a'\r\n$gdb_prompt $" {
- pass "print 'AAA::xyzq'('x')"
- }
- -re ".*$gdb_prompt $" { fail "print 'AAA::xyzq'('x')" }
- timeout { fail "(timeout) print 'AAA::xyzq'('x')" }
-}
-
-send_gdb "print AAA::xyzq('x')\n"
-gdb_expect {
- -re "\\$\[0-9\]* = 97 'a'\r\n$gdb_prompt $" {
- pass "print AAA::xyzq('x')"
- }
- -re ".*$gdb_prompt $" { fail "print AAA::xyzq('x')" }
- timeout { fail "(timeout) print AAA::xyzq('x')" }
-}
+gdb_test "print 'AAA::xyzq'('x')" \
+ "\\$\[0-9\]* = 97 'a'" \
+ "print 'AAA::xyzq'('x')"
+
+gdb_test "print AAA::xyzq('x')" \
+ "\\$\[0-9\]* = 97 'a'" \
+ "print AAA::xyzq('x')"
# Break on a function in a namespace
@@ -166,23 +137,13 @@ gdb_test "break AAA::xyzq" \
# Call a function in a nested namespace
-send_gdb "print 'BBB::CCC::xyzq'('x')\n"
-gdb_expect {
- -re "\\$\[0-9\]* = 122 'z'\r\n$gdb_prompt $" {
- pass "print 'BBB::CCC::xyzq'('x')"
- }
- -re ".*$gdb_prompt $" { fail "print 'BBB::CCC::xyzq'('x')" }
- timeout { fail "(timeout) print 'BBB::CCC::xyzq'('x')" }
-}
-
-send_gdb "print BBB::CCC::xyzq('x')\n"
-gdb_expect {
- -re "\\$\[0-9\]* = 122 'z'\r\n$gdb_prompt $" {
- pass "print BBB::CCC::xyzq('x')"
- }
- -re ".*$gdb_prompt $" { fail "print BBB::CCC::xyzq('x')" }
- timeout { fail "(timeout) print BBB::CCC::xyzq('x')" }
-}
+gdb_test "print 'BBB::CCC::xyzq'('x')" \
+ "\\$\[0-9\]* = 122 'z'" \
+ "print 'BBB::CCC::xyzq'('x')"
+
+gdb_test "print BBB::CCC::xyzq('x')" \
+ "\\$\[0-9\]* = 122 'z'" \
+ "print BBB::CCC::xyzq('x')"
# Break on a function in a nested namespace
@@ -191,23 +152,13 @@ gdb_test "break BBB::CCC::xyzq" \
# Print address of a function in a class in a namespace
-send_gdb "print 'BBB::Class::xyzq'\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \{char \\((BBB::|)Class \\*( const|), (char|int)\\)\} $hex <BBB::Class::xyzq\\(char\\)>\r\n$gdb_prompt $" {
- pass "print 'BBB::Class::xyzq'"
- }
- -re ".*$gdb_prompt $" { fail "print 'BBB::Class::xyzq'" }
- timeout { fail "(timeout) print 'BBB::Class::xyzq'" }
-}
+gdb_test "print 'BBB::Class::xyzq'" \
+ "\\$\[0-9\]* = \{char \\((BBB::|)Class \\*( const|), (char|int)\\)\} $hex <BBB::Class::xyzq\\(char\\)>" \
+ "print 'BBB::Class::xyzq'"
-send_gdb "print BBB::Class::xyzq\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \{char \\((BBB::|)Class \\*( const|), (char|int)\\)\} $hex <BBB::Class::xyzq\\(char\\)>\r\n$gdb_prompt $" {
- pass "print BBB::Class::xyzq"
- }
- -re ".*$gdb_prompt $" { fail "print BBB::Class::xyzq" }
- timeout { fail "(timeout) print BBB::Class::xyzq" }
-}
+gdb_test "print BBB::Class::xyzq" \
+ "\\$\[0-9\]* = \{char \\((BBB::|)Class \\*( const|), (char|int)\\)\} $hex <BBB::Class::xyzq\\(char\\)>" \
+ "print BBB::Class::xyzq"
# Break on a function in a class in a namespace
diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp
index 0e6c8a4..13585dd 100644
--- a/gdb/testsuite/gdb.cp/ovldbreak.exp
+++ b/gdb/testsuite/gdb.cp/ovldbreak.exp
@@ -70,8 +70,7 @@ if ![runto_main] then {
proc take_gdb_out_of_choice_menu {} {
global gdb_prompt
- send_gdb " \n"
- gdb_expect {
+ gdb_test_multiple " " " " {
-re ".*$gdb_prompt $" {
}
timeout {
diff --git a/gdb/testsuite/gdb.cp/pr-1023.exp b/gdb/testsuite/gdb.cp/pr-1023.exp
index f7762a7..b6c6445 100644
--- a/gdb/testsuite/gdb.cp/pr-1023.exp
+++ b/gdb/testsuite/gdb.cp/pr-1023.exp
@@ -51,8 +51,7 @@ if ![runto_main] then {
continue
}
-send_gdb "break myClass::performBlocking\n"
-gdb_expect {
+gdb_test_multiple "break myClass::performBlocking" "break myClass::performBlocking" {
-re "Breakpoint $decimal at $hex: file .*$srcfile, line 12.*$gdb_prompt $" {
pass "break myClass::performBlocking"
}
@@ -61,12 +60,6 @@ gdb_expect {
# -- chastain 2003-02-03
kfail "gdb/1023" "break myClass::performBlocking"
}
- -re ".*$gdb_prompt $" {
- fail "break myClass::performBlocking"
- }
- timeout {
- fail "break myClass::performBlocking (timeout)"
- }
}
gdb_test \
diff --git a/gdb/testsuite/gdb.cp/ref-types.exp b/gdb/testsuite/gdb.cp/ref-types.exp
index c137a57..9f135d6 100644
--- a/gdb/testsuite/gdb.cp/ref-types.exp
+++ b/gdb/testsuite/gdb.cp/ref-types.exp
@@ -85,118 +85,38 @@ proc gdb_start_again {} {
}
+gdb_test "print s" ".\[0-9\]* = -1" "print value of s"
+gdb_test "ptype s" "type = short"
-send_gdb "print s\n"
-gdb_expect {
- -re ".\[0-9\]* = -1.*$gdb_prompt $" {
- pass "print value of s"
- }
- -re ".*$gdb_prompt $" { fail "print value of s" }
- timeout { fail "(timeout) print value of s" }
- }
-
-
-send_gdb "ptype s\n"
-gdb_expect {
- -re "type = short.*$gdb_prompt $" { pass "ptype s" }
- -re ".*$gdb_prompt $" { fail "ptype s" }
- timeout { fail "(timeout) ptype s" }
-}
-
-
-send_gdb "print *ps\n"
-gdb_expect {
- -re ".\[0-9\]* = -1.*$gdb_prompt $" {
- pass "print value of ps"
- }
- -re ".*$gdb_prompt $" { fail "print value of ps" }
- timeout { fail "(timeout) print value of ps" }
- }
-
-
-send_gdb "ptype ps\n"
-gdb_expect {
- -re "type = short \*.*$gdb_prompt $" { pass "ptype ps" }
- -re ".*$gdb_prompt $" { fail "ptype ps" }
- timeout { fail "(timeout) ptype ps" }
-}
+gdb_test "print *ps" ".\[0-9\]* = -1" "print value of ps"
+gdb_test "ptype ps" "type = short \\*"
-send_gdb "print as\[0\]\n"
-gdb_expect {
- -re ".\[0-9\]* = 0.*$gdb_prompt $" {
- pass "print value of as\[0\]"
- }
- -re ".*$gdb_prompt $" { fail "print value of as\[0\]" }
- timeout { fail "(timeout) print value of as\[0\]" }
- }
-
-
-send_gdb "ptype as\n"
-gdb_expect {
+gdb_test "print as\[0\]" ".\[0-9\]* = 0" "print value of as\[0\]"
+gdb_test_multiple "ptype as" "ptype as" {
-re "type = short \\\[4\\\].*$gdb_prompt $" { pass "ptype as" }
-re "type = short int \\\[4\\\].*$gdb_prompt $" { pass "ptype as" }
- -re ".*$gdb_prompt $" { fail "ptype as" }
- timeout { fail "(timeout) ptype as" }
}
-send_gdb "print as\[1\]\n"
-gdb_expect {
- -re ".\[0-9\]* = 1.*$gdb_prompt $" {
- pass "print value of as\[1\]"
- }
- -re ".*$gdb_prompt $" { fail "print value of as\[1\]" }
- timeout { fail "(timeout) print value of as\[1\]" }
- }
-
-send_gdb "print as\[2\]\n"
-gdb_expect {
- -re ".\[0-9\]* = 2.*$gdb_prompt $" {
- pass "print value of as\[2\]"
- }
- -re ".*$gdb_prompt $" { fail "print value of as\[2\]" }
- timeout { fail "(timeout) print value of as\[2\]" }
- }
-
-send_gdb "print as\[3\]\n"
-gdb_expect {
- -re ".\[0-9\]* = 3.*$gdb_prompt $" {
- pass "print value of as\[3\]"
- }
- -re ".*$gdb_prompt $" { fail "print value of as\[3\]" }
- timeout { fail "(timeout) print value of as\[3\]" }
- }
-
-send_gdb "print rs\n"
-gdb_expect {
+gdb_test "print as\[1\]" ".\[0-9\]* = 1" "print value of as\[1\]"
+gdb_test "print as\[2\]" ".\[0-9\]* = 2" "print value of as\[2\]"
+gdb_test "print as\[3\]" ".\[0-9\]* = 3" "print value of as\[3\]"
+
+gdb_test_multiple "print rs" "print value of rs" {
-re ".\[0-9\]* = \\(short &\\) @$hex: -1.*$gdb_prompt $" {
pass "print value of rs"
}
-re ".\[0-9\]* = \\(short int &\\) @$hex: -1.*$gdb_prompt $" {
pass "print value of rs"
}
- -re ".*$gdb_prompt $" { fail "print value of rs" }
- timeout { fail "(timeout) print value of rs" }
eof { fail "print rs ($GDB dumped core) (FIXME)" ; gdb_start_again ; }
+}
- }
-
-send_gdb "ptype rs\n"
-gdb_expect {
+gdb_test_multiple "ptype rs" "ptype rs" {
-re "type = short &.*$gdb_prompt $" { pass "ptype rs" }
-re "type = short int &.*$gdb_prompt $" { pass "ptype rs" }
- -re ".*$gdb_prompt $" { fail "ptype rs" }
- timeout { fail "(timeout) ptype rs" }
}
-
-send_gdb "print *rps\n"
-gdb_expect {
- -re ".\[0-9\]* = -1.*$gdb_prompt $" {
- pass "print value of *rps"
- }
- -re ".*$gdb_prompt $" { fail "print value of *rps" }
- timeout { fail "(timeout) print value of *rps" }
- }
+gdb_test "print *rps" ".\[0-9\]* = -1" "print value of *rps"
# GDB had a bug about dereferencing a pointer type
# that would lead to wrong results
@@ -204,60 +124,22 @@ gdb_expect {
gdb_test "x /hd rps" "$hex:\[ \t\]*-1" "examine value at rps"
-send_gdb "ptype rps\n"
-gdb_expect {
+gdb_test_multiple "ptype rps" "ptype rps" {
-re "type = short \\*&.*$gdb_prompt $" { pass "ptype rps" }
-re "type = short int \\*&.*$gdb_prompt $" { pass "ptype rps" }
- -re ".*$gdb_prompt $" { fail "ptype rps" }
- timeout { fail "(timeout) ptype rps" }
}
+gdb_test "print ras\[0\]" ".\[0-9\]* = 0" "print value of ras\[0\]"
-send_gdb "print ras\[0\]\n"
-gdb_expect {
- -re ".\[0-9\]* = 0.*$gdb_prompt $" {
- pass "print value of ras\[0\]"
- }
- -re ".*$gdb_prompt $" { fail "print value of ras\[0\]" }
- timeout { fail "(timeout) print value of ras\[0\]" }
- }
-
-
-send_gdb "ptype ras\n"
-gdb_expect {
+gdb_test_multiple "ptype ras" "ptype ras" {
-re "type = short \\\(&\\\)\\\[4\\\].*$gdb_prompt $" { pass "ptype ras" }
-re "type = short int \\\(&\\\)\\\[4\\\].*$gdb_prompt $" { pass "ptype ras" }
- -re ".*$gdb_prompt $" { fail "ptype ras" }
- timeout { fail "(timeout) ptype ras" }
}
-send_gdb "print ras\[1\]\n"
-gdb_expect {
- -re ".\[0-9\]* = 1.*$gdb_prompt $" {
- pass "print value of ras\[1\]"
- }
- -re ".*$gdb_prompt $" { fail "print value of ras\[1\]" }
- timeout { fail "(timeout) print value of ras\[1\]" }
- }
-
-send_gdb "print ras\[2\]\n"
-gdb_expect {
- -re ".\[0-9\]* = 2.*$gdb_prompt $" {
- pass "print value of ras\[2\]"
- }
- -re ".*$gdb_prompt $" { fail "print value of ras\[2\]" }
- timeout { fail "(timeout) print value of ras\[2\]" }
- }
-
-send_gdb "print ras\[3\]\n"
-gdb_expect {
- -re ".\[0-9\]* = 3.*$gdb_prompt $" {
- pass "print value of ras\[3\]"
- }
- -re ".*$gdb_prompt $" { fail "print value of ras\[3\]" }
- timeout { fail "(timeout) print value of ras\[3\]" }
- }
+gdb_test "print ras\[1\]" ".\[0-9\]* = 1" "print value of ras\[1\]"
+gdb_test "print ras\[2\]" ".\[0-9\]* = 2" "print value of ras\[2\]"
+gdb_test "print ras\[3\]" ".\[0-9\]* = 3" "print value of ras\[3\]"
if ![runto 'f'] then {
@@ -267,396 +149,138 @@ if ![runto 'f'] then {
gdb_test "up" ".main2.*" "up from f"
-send_gdb "print C\n"
-gdb_expect {
- -re ".\[0-9\]* = 65 \'A\'.*$gdb_prompt $" {
- pass "print value of C"
- }
- -re ".*$gdb_prompt $" { fail "print value of C" }
- timeout { fail "(timeout) print value of C" }
- }
-
-
-send_gdb "ptype C\n"
-gdb_expect {
- -re "type = char.*$gdb_prompt $" { pass "ptype C" }
- -re ".*$gdb_prompt $" { fail "ptype C" }
- timeout { fail "(timeout) ptype C" }
-}
-
-
-send_gdb "print UC\n"
-gdb_expect {
- -re ".\[0-9\]* = 21 '\.025'\.*$gdb_prompt $" {
- pass "print value of UC"
- }
- -re ".*$gdb_prompt $" { fail "print value of UC" }
- timeout { fail "(timeout) print value of UC" }
- }
+gdb_test "print C" ".\[0-9\]* = 65 \'A\'" "print value of C"
+gdb_test "ptype C" "type = char"
+gdb_test "print UC" ".\[0-9\]* = 21 '\.025'" "print value of UC"
+gdb_test "ptype UC" "type = unsigned char"
-send_gdb "ptype UC\n"
-gdb_expect {
- -re "type = unsigned char.*$gdb_prompt $" { pass "ptype UC" }
- -re ".*$gdb_prompt $" { fail "ptype UC" }
- timeout { fail "(timeout) ptype UC" }
-}
-
-
-send_gdb "print S\n"
-gdb_expect {
- -re ".\[0-9\]* = -14.*$gdb_prompt $" {
- pass "print value of S"
- }
- -re ".*$gdb_prompt $" { fail "print value of S" }
- timeout { fail "(timeout) print value of S" }
- }
-
-
-send_gdb "ptype S\n"
-gdb_expect {
- -re "type = short.*$gdb_prompt $" { pass "ptype S" }
- -re ".*$gdb_prompt $" { fail "ptype S" }
- timeout { fail "(timeout) ptype S" }
-}
+gdb_test "print S" ".\[0-9\]* = -14" "print value of S"
+gdb_test "ptype S" "type = short.*"
-
-send_gdb "print US\n"
-gdb_expect {
- -re ".\[0-9\]* = 7.*$gdb_prompt $" {
- pass "print value of US"
- }
- -re ".*$gdb_prompt $" { fail "print value of US" }
- timeout { fail "(timeout) print value of US" }
- }
-
-
-send_gdb "ptype US\n"
-gdb_expect {
+gdb_test "print US" ".\[0-9\]* = 7" "print value of US"
+gdb_test_multiple "ptype US" "ptype US" {
-re "type = unsigned short.*$gdb_prompt $" { pass "ptype US" }
-re "type = short unsigned.*$gdb_prompt $" { pass "ptype US" }
- -re ".*$gdb_prompt $" { fail "ptype US" }
- timeout { fail "(timeout) ptype US" }
-}
-
-
-send_gdb "print I\n"
-gdb_expect {
- -re ".\[0-9\]* = 102.*$gdb_prompt $" {
- pass "print value of I"
- }
- -re ".*$gdb_prompt $" { fail "print value of I" }
- timeout { fail "(timeout) print value of I" }
- }
-
-
-send_gdb "ptype I\n"
-gdb_expect {
- -re "type = int.*$gdb_prompt $" { pass "ptype I" }
- -re ".*$gdb_prompt $" { fail "ptype I" }
- timeout { fail "(timeout) ptype I" }
-}
-
-
-send_gdb "print UI\n"
-gdb_expect {
- -re ".\[0-9\]* = 1002.*$gdb_prompt $" {
- pass "print value of UI"
- }
- -re ".*$gdb_prompt $" { fail "print value of UI" }
- timeout { fail "(timeout) print value of UI" }
- }
-
-
-send_gdb "ptype UI\n"
-gdb_expect {
- -re "type = unsigned int.*$gdb_prompt $" { pass "ptype UI" }
- -re ".*$gdb_prompt $" { fail "ptype UI" }
- timeout { fail "(timeout) ptype UI" }
}
+gdb_test "print I" ".\[0-9\]* = 102" "print value of I"
+gdb_test "ptype I" "type = int"
-send_gdb "print L\n"
-gdb_expect {
- -re ".\[0-9\]* = -234.*$gdb_prompt $" {
- pass "print value of L"
- }
- -re ".*$gdb_prompt $" { fail "print value of L" }
- timeout { fail "(timeout) print value of L" }
- }
-
-
-send_gdb "ptype L\n"
-gdb_expect {
- -re "type = long.*$gdb_prompt $" { pass "ptype L" }
- -re ".*$gdb_prompt $" { fail "ptype L" }
- timeout { fail "(timeout) ptype L" }
-}
+gdb_test "print UI" ".\[0-9\]* = 1002" "print value of UI"
+gdb_test "ptype UI" "type = unsigned int"
+gdb_test "print L" ".\[0-9\]* = -234" "print value of L"
+gdb_test "ptype L" "type = long.*"
-send_gdb "print UL\n"
-gdb_expect {
- -re ".\[0-9\]* = 234.*$gdb_prompt $" {
- pass "print value of UL"
- }
- -re ".*$gdb_prompt $" { fail "print value of UL" }
- timeout { fail "(timeout) print value of UL" }
- }
-
-
-send_gdb "ptype UL\n"
-gdb_expect {
+gdb_test "print UL" ".\[0-9\]* = 234" "print value of UL"
+gdb_test_multiple "ptype UL" "ptype UL" {
-re "type = unsigned long.*$gdb_prompt $" { pass "ptype UL" }
-re "type = long unsigned.*$gdb_prompt $" { pass "ptype UL" }
- -re ".*$gdb_prompt $" { fail "ptype UL" }
- timeout { fail "(timeout) ptype UL" }
}
+gdb_test "print F" ".\[0-9\]* = 1.2\[0-9\]*e\\+0?10.*" \
+ "print value of F"
-send_gdb "print F\n"
-gdb_expect {
- -re ".\[0-9\]* = 1.2\[0-9\]*e\\+0?10.*$gdb_prompt $" {
- pass "print value of F"
- }
- -re ".*$gdb_prompt $" { fail "print value of F" }
- timeout { fail "(timeout) print value of F" }
- }
-
+gdb_test "ptype F" "type = float.*"
+gdb_test "print D" ".\[0-9\]* = -1.375e-123.*" \
+ "print value of D"
-send_gdb "ptype F\n"
-gdb_expect {
- -re "type = float.*$gdb_prompt $" { pass "ptype F" }
- -re ".*$gdb_prompt $" { fail "ptype F" }
- timeout { fail "(timeout) ptype F" }
-}
-
-
-send_gdb "print D\n"
-gdb_expect {
- -re ".\[0-9\]* = -1.375e-123.*$gdb_prompt $" {
- pass "print value of D"
- }
- -re ".*$gdb_prompt $" { fail "print value of D" }
- timeout { fail "(timeout) print value of D" }
- }
-
-
-send_gdb "ptype D\n"
-gdb_expect {
- -re "type = double.*$gdb_prompt $" { pass "ptype D" }
- -re ".*$gdb_prompt $" { fail "ptype D" }
- timeout { fail "(timeout) ptype D" }
-}
-
+gdb_test "ptype D" "type = double.*"
#
# test reference types
#
+gdb_test "ptype rC" "type = char &"
+gdb_test "ptype rUC" "type = unsigned char &"
-
-send_gdb "ptype rC\n"
-gdb_expect {
- -re "type = char &.*$gdb_prompt $" { pass "ptype rC" }
- -re ".*$gdb_prompt $" { fail "ptype rC" }
- timeout { fail "(timeout) ptype rC" }
-}
-
-
-
-
-send_gdb "ptype rUC\n"
-gdb_expect {
- -re "type = unsigned char &.*$gdb_prompt $" { pass "ptype rUC" }
- -re ".*$gdb_prompt $" { fail "ptype rUC" }
- timeout { fail "(timeout) ptype rUC" }
-}
-
-
-
-send_gdb "ptype rS\n"
-gdb_expect {
+gdb_test_multiple "ptype rS" "ptype rS" {
-re "type = short &.*$gdb_prompt $" { pass "ptype rS" }
-re "type = short int &.*$gdb_prompt $" { pass "ptype rS" }
- -re ".*$gdb_prompt $" { fail "ptype rS" }
- timeout { fail "(timeout) ptype rS" }
}
-
-
-send_gdb "ptype rUS\n"
-gdb_expect {
+gdb_test_multiple "ptype rUS" "ptype rUS" {
-re "type = unsigned short &.*$gdb_prompt $" { pass "ptype rUS" }
-re "type = short unsigned int &.*$gdb_prompt $" { pass "ptype rUS" }
- -re ".*$gdb_prompt $" { fail "ptype rUS" }
- timeout { fail "(timeout) ptype rUS" }
-}
-
-
-send_gdb "ptype rI\n"
-gdb_expect {
- -re "type = int &.*$gdb_prompt $" { pass "ptype rI" }
- -re ".*$gdb_prompt $" { fail "ptype rI" }
- timeout { fail "(timeout) ptype rI" }
-}
-
-
-
-send_gdb "ptype rUI\n"
-gdb_expect {
- -re "type = unsigned int &.*$gdb_prompt $" { pass "ptype rUI" }
- -re ".*$gdb_prompt $" { fail "ptype rUI" }
- timeout { fail "(timeout) ptype rUI" }
}
+gdb_test "ptype rI" "type = int &"
+gdb_test "ptype rUI" "type = unsigned int &"
-send_gdb "ptype rL\n"
-gdb_expect {
+gdb_test_multiple "ptype rL" "ptype rL" {
-re "type = long &.*$gdb_prompt $" { pass "ptype rL" }
-re "type = long int &.*$gdb_prompt $" { pass "ptype rL" }
- -re ".*$gdb_prompt $" { fail "ptype rL" }
- timeout { fail "(timeout) ptype rL" }
}
-
-send_gdb "ptype rUL\n"
-gdb_expect {
+gdb_test_multiple "ptype rUL" "ptype rUL" {
-re "type = unsigned long &.*$gdb_prompt $" { pass "ptype rUL" }
-re "type = long unsigned int &.*$gdb_prompt $" { pass "ptype rUL" }
- -re ".*$gdb_prompt $" { fail "ptype rUL" }
- timeout { fail "(timeout) ptype rUL" }
}
+gdb_test "ptype rF" "type = float &"
-send_gdb "ptype rF\n"
-gdb_expect {
- -re "type = float &.*$gdb_prompt $" { pass "ptype rF" }
- -re ".*$gdb_prompt $" { fail "ptype rF" }
- timeout { fail "(timeout) ptype rF" }
-}
-
+gdb_test "ptype rD" "type = double &"
-send_gdb "ptype rD\n"
-gdb_expect {
- -re "type = double &.*$gdb_prompt $" { pass "ptype rD" }
- -re ".*$gdb_prompt $" { fail "ptype rD" }
- timeout { fail "(timeout) ptype rD" }
-}
+gdb_test "print rC" ".\[0-9\]* = \\(char &\\) @$hex: 65 \'A\'" \
+ "print value of rC"
+gdb_test "print rUC" \
+ ".\[0-9\]* = \\(unsigned char &\\) @$hex: 21 \'.025\'" \
+ pass "print value of rUC"
-send_gdb "print rC\n"
-gdb_expect {
- -re ".\[0-9\]* = \\(char &\\) @$hex: 65 \'A\'.*$gdb_prompt $" {
- pass "print value of rC"
- }
- -re ".*$gdb_prompt $" { fail "print value of rC" }
- timeout { fail "(timeout) print value of rC" }
- }
-
-
-send_gdb "print rUC\n"
-gdb_expect {
- -re ".\[0-9\]* = \\(unsigned char &\\) @$hex: 21 \'.025\'.*$gdb_prompt $" {
- pass "print value of rUC"
- }
- -re ".*$gdb_prompt $" { fail "print value of rUC" }
- timeout { fail "(timeout) print value of rUC" }
- }
-
-
-send_gdb "print rS\n"
-gdb_expect {
+gdb_test_multiple "print rS" "print value of rS" {
-re ".\[0-9\]* = \\(short &\\) @$hex: -14.*$gdb_prompt $" {
pass "print value of rS"
}
-re ".\[0-9\]* = \\(short int &\\) @$hex: -14.*$gdb_prompt $" {
pass "print value of rS"
}
- -re ".*$gdb_prompt $" { fail "print value of rS" }
- timeout { fail "(timeout) print value of rS" }
- }
-
+}
-send_gdb "print rUS\n"
-gdb_expect {
+gdb_test_multiple "print rUS" "print value of rUS" {
-re ".\[0-9\]* = \\(unsigned short &\\) @$hex: 7.*$gdb_prompt $" {
pass "print value of rUS"
}
-re ".\[0-9\]* = \\(short unsigned int &\\) @$hex: 7.*$gdb_prompt $" {
pass "print value of rUS"
}
- -re ".*$gdb_prompt $" { fail "print value of rUS" }
- timeout { fail "(timeout) print value of rUS" }
- }
-
+}
-send_gdb "print rI\n"
-gdb_expect {
- -re ".\[0-9\]* = \\(int &\\) @$hex: 102.*$gdb_prompt $" {
+gdb_test "print rI" ".\[0-9\]* = \\(int &\\) @$hex: 102" \
pass "print value of rI"
- }
- -re ".*$gdb_prompt $" { fail "print value of rI" }
- timeout { fail "(timeout) print value of rI" }
- }
-
-send_gdb "print rUI\n"
-gdb_expect {
- -re ".\[0-9\]* = \\(unsigned int &\\) @$hex: 1002.*$gdb_prompt $" {
+gdb_test "print rUI\n" \
+ ".\[0-9\]* = \\(unsigned int &\\) @$hex: 1002" \
pass "print value of UI"
- }
- -re ".*$gdb_prompt $" { fail "print value of rUI" }
- timeout { fail "(timeout) print value of rUI" }
- }
-
-send_gdb "print rL\n"
-gdb_expect {
+gdb_test_multiple "print rL" "print value of rL" {
-re ".\[0-9\]* = \\(long &\\) @$hex: -234.*$gdb_prompt $" {
pass "print value of rL"
}
-re ".\[0-9\]* = \\(long int &\\) @$hex: -234.*$gdb_prompt $" {
pass "print value of rL"
}
- -re ".*$gdb_prompt $" { fail "print value of rL" }
- timeout { fail "(timeout) print value of rL" }
- }
-
-
+}
-send_gdb "print rUL\n"
-gdb_expect {
+gdb_test_multiple "print rUL" "print value of rUL" {
-re ".\[0-9\]* = \\(unsigned long &\\) @$hex: 234.*$gdb_prompt $" {
pass "print value of rUL"
}
-re ".\[0-9\]* = \\(long unsigned int &\\) @$hex: 234.*$gdb_prompt $" {
pass "print value of rUL"
}
- -re ".*$gdb_prompt $" { fail "print value of rUL" }
- timeout { fail "(timeout) print value of rUL" }
- }
-
-
-send_gdb "print rF\n"
-gdb_expect {
- -re ".\[0-9\]* = \\(float &\\) @$hex: 1.2\[0-9\]*e\\+0?10.*$gdb_prompt $" {
- pass "print value of rF"
- }
- -re ".*$gdb_prompt $" { fail "print value of rF" }
- timeout { fail "(timeout) print value of rF" }
- }
-
-
-send_gdb "print rD\n"
-gdb_expect {
- -re ".\[0-9\]* = \\(double &\\) @$hex: -1.375e-123.*$gdb_prompt $" {
- pass "print value of rD"
- }
- -re ".*$gdb_prompt $" { fail "print value of rD" }
- timeout { fail "(timeout) print value of rD" }
- }
+}
+
+gdb_test "print rF" \
+ ".\[0-9\]* = \\(float &\\) @$hex: 1.2\[0-9\]*e\\+0?10.*" \
+ "print value of rF"
+
+gdb_test "print rD" \
+ ".\[0-9\]* = \\(double &\\) @$hex: -1.375e-123.*" \
+ "print value of rD"
diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp
index cef2969..b8af47f 100644
--- a/gdb/testsuite/gdb.cp/templates.exp
+++ b/gdb/testsuite/gdb.cp/templates.exp
@@ -47,16 +47,19 @@ proc test_ptype_of_templates {} {
global gdb_prompt
global ws
- send_gdb "ptype T5<int>\n"
- gdb_expect {
+ gdb_test_multiple "ptype T5<int>" "ptype T5<int>" {
-re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}T5<int> & operator=\\(T5<int> const ?&\\);${ws}T5\\(int\\);${ws}T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\((void|)\\);${ws}static void \\* operator new\\(unsigned( int| long)?\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" {
pass "ptype T5<int>"
}
-re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}T5\\(int\\);${ws}T5\\((T5<int> const|const T5<int>) ?&\\);${ws}~T5\\((void|)\\);${ws}static void \\* operator new\\(unsigned( int| long)?\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}T5<int> & operator=\\(T5<int> const ?&\\);${ws}\}\r\n$gdb_prompt $" {
pass "ptype T5<int>"
}
- -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned int\\);${ws}static void delete \\(void ?\\*\\);${ws}int value \\((void|)\\);${ws}\\}${ws}$gdb_prompt $" { pass "ptype T5<int> -- new with unsigned int" }
- -re "type = class T5<int> \\{.*public:.*static int X;.*int x;.*int val;.*T5 \\(int\\);.*T5 \\(const class T5<int> &\\);.*void ~T5 \\(int\\);.*static void \\* new \\(unsigned long\\);.*static void delete \\(void ?\\*\\);.*int value \\((void|)\\);.*\\}\r\n$gdb_prompt $" { pass "ptype T5<int> -- new with unsigned long" }
+ -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned int\\);${ws}static void delete \\(void ?\\*\\);${ws}int value \\((void|)\\);${ws}\\}${ws}$gdb_prompt $" {
+ pass "ptype T5<int> -- new with unsigned int"
+ }
+ -re "type = class T5<int> \\{.*public:.*static int X;.*int x;.*int val;.*T5 \\(int\\);.*T5 \\(const class T5<int> &\\);.*void ~T5 \\(int\\);.*static void \\* new \\(unsigned long\\);.*static void delete \\(void ?\\*\\);.*int value \\((void|)\\);.*\\}\r\n$gdb_prompt $" {
+ pass "ptype T5<int> -- new with unsigned long"
+ }
-re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5<int> & operator=\\(T5<int> const ?&\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\((T5<int> const|const T5<int>) ?&\\);)|(${ws}~T5\\((void|)\\);)|(${ws}static void \\* operator new\\(unsigned( int| long)?\\);)|(${ws}static void operator delete\\(void ?\\*\\);)|(${ws}int value\\((void|)\\);))*${ws}\}\r\n$gdb_prompt $" {
pass "ptype T5<int> (obsolescent gcc or gdb)"
}
@@ -64,19 +67,18 @@ proc test_ptype_of_templates {} {
# This also triggers gdb/1113...
kfail "gdb/1111" "ptype T5<int>"
}
- -re ".*$gdb_prompt $" {
- fail "ptype T5<int>"
- }
- timeout {
- fail "ptype T5<int> (timeout)"
- }
}
- send_gdb "ptype t5i\n"
- gdb_expect {
- -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5\\(int\\);${ws}T5\\(T5<int> const ?&\\);${ws}~T5\\((void|)\\);${ws}static void \\* operator new\\(unsigned( int| long)?\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype T5<int> -- with several fixes from 4.17" }
- -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned int\\);${ws}static void delete \\(void ?\\*\\);${ws}int value \\((void|)\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype t5i<int> -- new with unsigned int" }
- -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned long\\);${ws}static void delete \\(void ?\\*\\);${ws}int value \\((void|)\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype t5i<int> -- new with unsigned long" }
+ gdb_test_multiple "ptype t5i" "ptype t5i" {
+ -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5\\(int\\);${ws}T5\\(T5<int> const ?&\\);${ws}~T5\\((void|)\\);${ws}static void \\* operator new\\(unsigned( int| long)?\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\\}\r\n$gdb_prompt $" {
+ pass "ptype T5<int> -- with several fixes from 4.17"
+ }
+ -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned int\\);${ws}static void delete \\(void ?\\*\\);${ws}int value \\((void|)\\);${ws}\\}\r\n$gdb_prompt $" {
+ pass "ptype t5i<int> -- new with unsigned int"
+ }
+ -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned long\\);${ws}static void delete \\(void ?\\*\\);${ws}int value \\((void|)\\);${ws}\\}\r\n$gdb_prompt $" {
+ pass "ptype t5i<int> -- new with unsigned long"
+ }
-re "type = class T5<int> \{.*public:.*static int X;.*int x;.*int val;.*.*T5 \\(int\\);.*.*void ~T5 \\(int\\).*.*.*int value \\((void|)\\);.*\}.*$gdb_prompt $" {
pass "ptype t5i"
}
@@ -93,12 +95,6 @@ proc test_ptype_of_templates {} {
# This also triggers gdb/1113...
kfail "gdb/1111" "ptype T5<int>"
}
- -re ".*$gdb_prompt $" {
- fail "ptype t5i"
- }
- timeout {
- fail "ptype t5i (timeout)"
- }
}
}
@@ -177,9 +173,10 @@ proc test_template_calls {} {
}
if {!$hp_aCC_compiler} {setup_xfail hppa*-*-*}
- send_gdb "print t5i.value()\n"
- gdb_expect {
- -re ".* = 2\[\r\n\]*$gdb_prompt $" { pass "print t5i.value()" }
+ gdb_test_multiple "print t5i.value()" "print t5i.value()" {
+ -re ".* = 2\[\r\n\]*$gdb_prompt $" {
+ pass "print t5i.value()"
+ }
-re "Cannot invoke functions on this machine.*$gdb_prompt $" {
fail "print t5i.value()"
}
@@ -187,8 +184,6 @@ proc test_template_calls {} {
setup_xfail hppa*-*-* CLLbs16899
xfail "print t5i.value"
}
- -re ".*$gdb_prompt $" { fail "print t5i.value()" }
- timeout { fail "print t5i.value() (timeout)" }
}
}
@@ -247,27 +242,18 @@ do_tests
# weren't breakpointing past a point where the below expressions were
# initialized in the actual source. - djb
-send_gdb "b 770\n"
-gdb_expect {
- -re ".*$gdb_prompt $"
-}
-send_gdb "c\n"
-gdb_expect {
- -re ".*$gdb_prompt $"
-}
-send_gdb "print fint\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \\{x = 0, t = 0\\}\r\n$gdb_prompt $" { pass "print fint" }
- -re "$gdb_prompt $" { fail "print fint" }
- timeout { fail "(timeout) print fint" }
-}
+gdb_test "b 770" \
+ "Breakpoint .* at .*, line 770."
-send_gdb "print fvpchar\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \\{x = 0, t = 0x0\\}\r\n$gdb_prompt $" { pass "print fvpchar" }
- -re "$gdb_prompt $" { fail "print fvpchar" }
- timeout { fail "(timeout) print fvpchar" }
-}
+gdb_test "c" \
+ "Continuing.*Breakpoint .*" \
+ "continue to line 770"
+
+gdb_test "print fint" \
+ "\\$\[0-9\]* = \\{x = 0, t = 0\\}"
+
+gdb_test "print fvpchar" \
+ "\\$\[0-9\]* = \\{x = 0, t = 0x0\\}"
# Template Foo<T>
@@ -281,52 +267,59 @@ gdb_expect {
# NOTE: carlton/2003-02-26: However, because of a bug in the way GDB
# handles nested types, we don't get this right in the DWARF-2 case.
-send_gdb "ptype Foo\n"
-gdb_expect {
- -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Foo<volatile char \\*>\r\n\[ \t\]*(class |)Foo<char>\r\n\[ \t\]*(class |)Foo<int>\r\n$gdb_prompt $" { pass "ptype Foo" }
- -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Foo" }
- -re "type = class Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $"
- { # GCC 3.1, DWARF-2 output.
- kfail "gdb/57" "ptype Foo" }
- -re "No symbol \"Foo\" in current context.\r\n$gdb_prompt $"
- { # GCC 2.95.3, stabs+ output.
- pass "ptype Foo" }
- -re "$gdb_prompt $" { fail "ptype Foo" }
- timeout { fail "(timeout) ptype Foo" }
+gdb_test_multiple "ptype Foo" "ptype Foo" {
+ -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Foo<volatile char \\*>\r\n\[ \t\]*(class |)Foo<char>\r\n\[ \t\]*(class |)Foo<int>\r\n$gdb_prompt $" {
+ pass "ptype Foo"
+ }
+ -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" {
+ xfail "ptype Foo"
+ }
+ -re "type = class Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" {
+ # GCC 3.1, DWARF-2 output.
+ kfail "gdb/57" "ptype Foo"
+ }
+ -re "No symbol \"Foo\" in current context.\r\n$gdb_prompt $" {
+ # GCC 2.95.3, stabs+ output.
+ pass "ptype Foo"
+ }
}
+
# -re "type = class Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo(int, int);\r\n\\}\r\n$gdb_prompt $"
# ptype Foo<int>
-send_gdb "ptype fint\n"
-gdb_expect {
- -re "type = (class |)Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fint" }
- -re "type = (class |)Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype fint" }
- -re "$gdb_prompt $" { fail "ptype fint" }
- timeout { fail "(timeout) ptype fint" }
+gdb_test_multiple "ptype fint" "ptype fint" {
+ -re "type = (class |)Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype fint"
+ }
+ -re "type = (class |)Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype fint"
+ }
}
# ptype Foo<char>
-send_gdb "ptype fchar\n"
-gdb_expect {
- -re "type = (class |)Foo<char> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*.*char foo\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fchar" }
- -re "type = (class |)Foo<char> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char foo\\(int, char\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype fchar" }
- -re "$gdb_prompt $" { fail "ptype fchar" }
- timeout { fail "(timeout) ptype fchar" }
+gdb_test_multiple "ptype fchar" "ptype fchar" {
+ -re "type = (class |)Foo<char> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*.*char foo\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype fchar"
+ }
+ -re "type = (class |)Foo<char> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char foo\\(int, char\\);.*\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype fchar"
+ }
}
# ptype Foo<volatile char *>
-send_gdb "ptype fvpchar\n"
-gdb_expect {
- -re "type = (class |)Foo<volatile char ?\\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*char.*\\*t;\r\n\r\n\[ \t\]*.*char \\* foo\\(int,.*char.*\\*\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fvpchar" }
- -re "type = (class |)Foo<volatile char ?\\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*char.*\\*t;\r\n\r\n\[ \t\]*.*char \\* foo\\(int,.*char.*\\*\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype fvpchar" }
- -re "type = (class |)Foo<char volatile ?\\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*char.*\\*t;\r\n\r\n\[ \t\]*.*char \\* foo\\(int,.*char.*\\*\\);\r\n\\}\r\n$gdb_prompt $" {
- kfail "gdb/1512" "ptype fvpchar"
- }
- -re "$gdb_prompt $" { fail "ptype fvpchar" }
- timeout { fail "(timeout) ptype fvpchar" }
+gdb_test_multiple "ptype fvpchar" "ptype fvpchar" {
+ -re "type = (class |)Foo<volatile char ?\\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*char.*\\*t;\r\n\r\n\[ \t\]*.*char \\* foo\\(int,.*char.*\\*\\);\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype fvpchar"
+ }
+ -re "type = (class |)Foo<volatile char ?\\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*char.*\\*t;\r\n\r\n\[ \t\]*.*char \\* foo\\(int,.*char.*\\*\\);.*\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype fvpchar"
+ }
+ -re "type = (class |)Foo<char volatile ?\\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*char.*\\*t;\r\n\r\n\[ \t\]*.*char \\* foo\\(int,.*char.*\\*\\);\r\n\\}\r\n$gdb_prompt $" {
+ kfail "gdb/1512" "ptype fvpchar"
+ }
}
# print a function from Foo<volatile char *>
@@ -334,208 +327,215 @@ gdb_expect {
# This test is sensitive to whitespace matching, so we'll do it twice,
# varying the spacing, because of PR gdb/33.
-send_gdb "print Foo<volatile char *>::foo\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<(volatile char|char volatile) ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char *>::foo" }
- -re "No symbol \"Foo<volatile char \\*>\" in current context.\r\n$gdb_prompt $"
- {
+gdb_test_multiple "print Foo<volatile char *>::foo" "print Foo<volatile char *>::foo" {
+ -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<(volatile char|char volatile) ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" {
+ pass "print Foo<volatile char *>::foo"
+ }
+ -re "No symbol \"Foo<volatile char \\*>\" in current context.\r\n$gdb_prompt $" {
# This used to be a kfail gdb/33 and then kfail gdb/931.
fail "print Foo<volatile char *>::foo"
}
- -re "$gdb_prompt $" { fail "print Foo<volatile char *>::foo" }
- timeout { fail "(timeout) print Foo<volatile char *>::foo" }
}
-send_gdb "print Foo<volatile char*>::foo\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<(volatile char|char volatile) ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char*>::foo" }
- -re "No symbol \"Foo<volatile char\\*>\" in current context.\r\n$gdb_prompt $"
- {
+gdb_test_multiple "print Foo<volatile char*>::foo" "print Foo<volatile char*>::foo" {
+ -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<(volatile char|char volatile) ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" {
+ pass "print Foo<volatile char*>::foo"
+ }
+ -re "No symbol \"Foo<volatile char\\*>\" in current context.\r\n$gdb_prompt $" {
# This used to be a kfail gdb/33 and then kfail gdb/931.
fail "print Foo<volatile char*>::foo"
}
- -re "$gdb_prompt $" { fail "print Foo<volatile char*>::foo" }
- timeout { fail "(timeout) print Foo<volatile char*>::foo" }
}
# Template Bar<T, int>
# same as Foo for g++
-send_gdb "ptype Bar\n"
-gdb_expect {
- -re "type = template <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)1>\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)33>\r\n$gdb_prompt $" { pass "ptype Bar" }
- -re "type = <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Bar" }
- -re "ptype Bar\r\ntype = class Bar<int, ?33> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n}\r\n$gdb_prompt $"
- { # GCC 3.1, DWARF-2 output.
- kfail "gdb/57" "ptype Bar" }
- -re "No symbol \"Bar\" in current context.\r\n$gdb_prompt $"
- { # GCC 2.95.3, stabs+ output.
- pass "ptype Bar" }
- -re "$gdb_prompt $" { fail "ptype Bar" }
- timeout { fail "(timeout) ptype Bar" }
+gdb_test_multiple "ptype Bar" "ptype Bar" {
+ -re "type = template <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)1>\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)33>\r\n$gdb_prompt $" {
+ pass "ptype Bar"
+ }
+ -re "type = <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" {
+ xfail "ptype Bar"
+ }
+ -re "ptype Bar\r\ntype = class Bar<int, ?33> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n}\r\n$gdb_prompt $" {
+ # GCC 3.1, DWARF-2 output.
+ kfail "gdb/57" "ptype Bar"
+ }
+ -re "No symbol \"Bar\" in current context.\r\n$gdb_prompt $" {
+ # GCC 2.95.3, stabs+ output.
+ pass "ptype Bar"
+ }
}
# ptype Bar<int,33>
-send_gdb "ptype bint\n"
-gdb_expect {
- -re "type = (class |)Bar<int, ?(\\(int\\)|)33> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint" }
- -re "type = (class |)Bar<int,(\\(int\\)|)33> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint" }
- -re "$gdb_prompt $" { fail "ptype bint" }
- timeout { fail "(timeout) ptype bint" }
+gdb_test_multiple "ptype bint" "ptype bint" {
+ -re "type = (class |)Bar<int, ?(\\(int\\)|)33> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype bint"
+ }
+ -re "type = (class |)Bar<int,(\\(int\\)|)33> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype bint"
+ }
}
# ptype Bar<int, (4>3)>
-send_gdb "ptype bint2\n"
-gdb_expect {
- -re "type = (class |)Bar<int, ?(\\(int\\)|)1> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint2" }
- -re "type = (class |)Bar<int,(\\(int\\)|)1> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint2" }
- -re "$gdb_prompt $" { fail "ptype bint2" }
- timeout { fail "(timeout) ptype bint2" }
+gdb_test_multiple "ptype bint2" "ptype bint2" {
+ -re "type = (class |)Bar<int, ?(\\(int\\)|)1> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype bint2"
+ }
+ -re "type = (class |)Bar<int,(\\(int\\)|)1> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype bint2"
+ }
}
# Template Baz<T, char>
# Same as Foo, for g++
-send_gdb "ptype Baz\n"
-gdb_expect {
- -re "type = template <(class |)T, ?(class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Baz<char,(\\(char\\)|)97>\r\n\[ \t\]*(class |)Baz<int,(\\(char\\)|)115>\r\n$gdb_prompt $" { pass "ptype Baz" }
- -re "type = <(class |)T, ?(class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Baz" }
- -re "type = class Baz<int, ?'s'> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n}\r\n$gdb_prompt $"
- { # GCC 3.1, DWARF-2 output.
- kfail "gdb/57" "ptype Baz" }
- -re "type = class Baz<int, ?(\\(char\\))?115> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n}\r\n$gdb_prompt $"
- { # GCC 3.x, DWARF-2 output, running into gdb/57 and gdb/1512.
- kfail "gdb/57" "ptype Baz" }
- -re "No symbol \"Baz\" in current context.\r\n$gdb_prompt $"
- { # GCC 2.95.3, stabs+ output.
- pass "ptype Baz" }
- -re "$gdb_prompt $" { fail "ptype Baz" }
- timeout { fail "(timeout) ptype Baz" }
+gdb_test_multiple "ptype Baz" "ptype Baz" {
+ -re "type = template <(class |)T, ?(class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Baz<char,(\\(char\\)|)97>\r\n\[ \t\]*(class |)Baz<int,(\\(char\\)|)115>\r\n$gdb_prompt $" {
+ pass "ptype Baz"
+ }
+ -re "type = <(class |)T, ?(class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" {
+ xfail "ptype Baz"
+ }
+ -re "type = class Baz<int, ?'s'> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n}\r\n$gdb_prompt $" {
+ # GCC 3.1, DWARF-2 output.
+ kfail "gdb/57" "ptype Baz"
+ }
+ -re "type = class Baz<int, ?(\\(char\\))?115> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n}\r\n$gdb_prompt $" {
+ # GCC 3.x, DWARF-2 output, running into gdb/57 and gdb/1512.
+ kfail "gdb/57" "ptype Baz"
+ }
+ -re "No symbol \"Baz\" in current context.\r\n$gdb_prompt $" {
+ # GCC 2.95.3, stabs+ output.
+ pass "ptype Baz"
+ }
}
# ptype Baz<int, 's'>
-send_gdb "ptype bazint\n"
-gdb_expect {
- -re "type = (class |)Baz<int, ?(\\(char\\)|)(115|\\'s\\')> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int baz\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint" }
- -re "type = (class |)Baz<int,(\\(char\\)|)(115|\\'s\\')> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\).*;\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint" }
- -re "$gdb_prompt $" { fail "ptype bazint" }
- timeout { fail "(timeout) ptype bazint" }
+gdb_test_multiple "ptype bazint" "ptype bazint" {
+ -re "type = (class |)Baz<int, ?(\\(char\\)|)(115|\\'s\\')> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int baz\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype bazint"
+ }
+ -re "type = (class |)Baz<int,(\\(char\\)|)(115|\\'s\\')> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\).*;\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype bazint"
+ }
}
# ptype Baz<char, 'a'>
-send_gdb "ptype bazint2\n"
-gdb_expect {
- -re "type = (class |)Baz<char, ?(\\(char\\)|)(97|\\'a\\')> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*.*char baz\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint2" }
- -re "type = (class |)Baz<char,(\\(char\\)|)(97|\\'a\\')> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char baz\\(int, char\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint2" }
- -re "$gdb_prompt $" { fail "ptype bazint2" }
- timeout { fail "(timeout) ptype bazint2" }
+gdb_test_multiple "ptype bazint2" "ptype bazint2" {
+ -re "type = (class |)Baz<char, ?(\\(char\\)|)(97|\\'a\\')> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*.*char baz\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype bazint2"
+ }
+ -re "type = (class |)Baz<char,(\\(char\\)|)(97|\\'a\\')> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char baz\\(int, char\\);.*\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype bazint2"
+ }
}
# Template Qux<T, int (*f)(int) >
# Same as Foo for g++
-send_gdb "ptype Qux\n"
-gdb_expect {
- -re "type = template <(class |)T, ?(class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Qux<int,&string>\r\n\[ \t\]*(class |)Qux<char,&string>\r\n$gdb_prompt $" { pass "ptype Qux" }
- -re ".*type = template <(class |)T.*, ?(class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}.*$gdb_prompt $" { pass "ptype Qux" }
- -re "type = class Qux<char, ?&string> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n}\r\n$gdb_prompt $"
- { # GCC 3.1, DWARF-2 output.
- kfail "gdb/57" "ptype Qux" }
- -re "type = class Qux<char, ?&\\(string\\)> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n}\r\n$gdb_prompt $"
- { # GCC 3.x, DWARF-2 output; gdb/57 + gdb/1512.
- kfail "gdb/57" "ptype Qux" }
- -re "No symbol \"Qux\" in current context.\r\n$gdb_prompt $"
- { # GCC 2.95.3, stabs+ output.
- pass "ptype Qux" }
- -re "$gdb_prompt $" { fail "ptype Qux" }
- timeout { fail "(timeout) ptype Qux" }
+gdb_test_multiple "ptype Qux" "ptype Qux" {
+ -re "type = template <(class |)T, ?(class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Qux<int,&string>\r\n\[ \t\]*(class |)Qux<char,&string>\r\n$gdb_prompt $" {
+ pass "ptype Qux"
+ }
+ -re ".*type = template <(class |)T.*, ?(class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}.*$gdb_prompt $" {
+ pass "ptype Qux"
+ }
+ -re "type = class Qux<char, ?&string> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n}\r\n$gdb_prompt $" {
+ # GCC 3.1, DWARF-2 output.
+ kfail "gdb/57" "ptype Qux"
+ }
+ -re "type = class Qux<char, ?&\\(string\\)> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n}\r\n$gdb_prompt $" {
+ # GCC 3.x, DWARF-2 output; gdb/57 + gdb/1512.
+ kfail "gdb/57" "ptype Qux"
+ }
+ -re "No symbol \"Qux\" in current context.\r\n$gdb_prompt $" {
+ # GCC 2.95.3, stabs+ output.
+ pass "ptype Qux"
+ }
}
# pt Qux<int,&string>
-send_gdb "ptype quxint\n"
-gdb_expect {
- -re "type = class Qux<int, ?& ?string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int qux\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" }
- -re "type = class Qux<int, ?& ?string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" }
- -re "type = class Qux<int, ?\\(char ?\\*\\)\\(& ?\\(?string\\)?\\)> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" }
- -re "type = class Qux<int, ?& ?\\(string\\)> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" {
- kfail "gdb/1512" "ptype quxint"
- }
- -re "$gdb_prompt $" { fail "ptype quxint" }
- timeout { fail "(timeout) ptype quxint" }
+gdb_test_multiple "ptype quxint" "ptype quxint" {
+ -re "type = class Qux<int, ?& ?string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int qux\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype quxint"
+ }
+ -re "type = class Qux<int, ?& ?string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype quxint"
+ }
+ -re "type = class Qux<int, ?\\(char ?\\*\\)\\(& ?\\(?string\\)?\\)> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype quxint"
+ }
+ -re "type = class Qux<int, ?& ?\\(string\\)> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" {
+ kfail "gdb/1512" "ptype quxint"
+ }
}
-# pt Qux<char,0>
-
-# commented out this as quxint2 declaration was commented out in
-# templates.exp -- ovidiu
-# send_gdb "ptype quxint2\n"
-# gdb_expect {
-# -re "type = class Qux<char,&string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint2" }
-# -re "$gdb_prompt $" { fail "ptype quxint2" }
-# timeout { fail "(timeout) ptype quxint2" }
-# }
# Template Spec<T1, T2>
# Same as Foo for g++
-send_gdb "ptype Spec\n"
-gdb_expect {
- -re "type = template <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Spec<int,int \\*>\r\n\[ \t\]*(class |)Spec<int,char>\r\n$gdb_prompt $" { pass "ptype Spec" }
- -re "type = <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Spec" }
- -re "type = class Spec<int, ?char> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(char\\);\r\n}\r\n$gdb_prompt $"
- { # GCC 3.1, DWARF-2 output.
- kfail "gdb/57" "ptype Spec" }
- -re "No symbol \"Spec\" in current context.\r\n$gdb_prompt $"
- { # GCC 2.95.3, stabs+ output.
- pass "ptype Spec" }
- -re "$gdb_prompt $" { fail "ptype Spec" }
- timeout { fail "(timeout) ptype Spec" }
+gdb_test_multiple "ptype Spec" "ptype Spec" {
+ -re "type = template <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Spec<int,int \\*>\r\n\[ \t\]*(class |)Spec<int,char>\r\n$gdb_prompt $" {
+ pass "ptype Spec"
+ }
+ -re "type = <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" {
+ xfail "ptype Spec"
+ }
+ -re "type = class Spec<int, ?char> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(char\\);\r\n}\r\n$gdb_prompt $" {
+ # GCC 3.1, DWARF-2 output.
+ kfail "gdb/57" "ptype Spec"
+ }
+ -re "No symbol \"Spec\" in current context.\r\n$gdb_prompt $" {
+ # GCC 2.95.3, stabs+ output.
+ pass "ptype Spec"
+ }
}
# pt Spec<char,0>
-send_gdb "ptype siip\n"
-gdb_expect {
- -re "type = class Spec<int, ?int ?\\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*.*int spec\\(int ?\\*\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype siip" }
- -re "type = class Spec<int,int ?\\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(int ?\\*\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype siip" }
- -re "$gdb_prompt $" { fail "ptype siip" }
- timeout { fail "(timeout) ptype siip" }
+gdb_test_multiple "ptype siip" "ptype siip" {
+ -re "type = class Spec<int, ?int ?\\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*.*int spec\\(int ?\\*\\);\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype siip"
+ }
+ -re "type = class Spec<int,int ?\\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(int ?\\*\\);.*\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype siip"
+ }
}
# pt Garply<int>
-send_gdb "ptype Garply<int>\n"
-gdb_expect {
- -re "type = class Garply<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int garply\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply<int>" }
- -re "type = class Garply<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int garply\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply<int>" }
- -re "$gdb_prompt $" { fail "ptype Garply<int>" }
- timeout { fail "(timeout) ptype Garply<int>" }
+gdb_test_multiple "ptype Garply<int>" "ptype Garply<int>" {
+ -re "type = class Garply<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int garply\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype Garply<int>"
+ }
+ -re "type = class Garply<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int garply\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype Garply<int>"
+ }
}
# ptype of nested template name
-send_gdb "ptype Garply<Garply<char> >\n"
-gdb_expect {
- -re "type = (class |)Garply<Garply<char> > \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*(class |)Garply<char> t;\r\n\r\n\[ \t\]*.*(class |)Garply<char> garply\\(int, (class |)Garply<char>\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply<Garply<char> >" }
- -re "type = (class |)Garply<Garply<char> > \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*(class |)Garply<char> t;\r\n\r\n\[ \t\]*(class |)Garply<char> garply\\(int, (class |)Garply<char>\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply<Garply<char> >" }
- -re "$gdb_prompt $" { fail "ptype Garply<Garply<char> >" }
- timeout { fail "(timeout) ptype Garply<Garply<char> >" }
+gdb_test_multiple "ptype Garply<Garply<char> >" "ptype Garply<Garply<char> >" {
+ -re "type = (class |)Garply<Garply<char> > \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*(class |)Garply<char> t;\r\n\r\n\[ \t\]*.*(class |)Garply<char> garply\\(int, (class |)Garply<char>\\);\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype Garply<Garply<char> >"
+ }
+ -re "type = (class |)Garply<Garply<char> > \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*(class |)Garply<char> t;\r\n\r\n\[ \t\]*(class |)Garply<char> garply\\(int, (class |)Garply<char>\\);.*\r\n\\}\r\n$gdb_prompt $" {
+ pass "ptype Garply<Garply<char> >"
+ }
}
# print out a function from a nested template name
-send_gdb "print Garply<Garply<char> >::garply\n"
-gdb_expect {
- -re "\\$\[0-9\]* = \\{(class |)Garply<char> \\((class |)Garply<Garply<char> > \\*(| const), int, (class |)Garply<char>\\)\\} $hex <Garply<Garply<char>\[ \t\]*>::garply\\(int, (class |)Garply<char>\\)>\r\n$gdb_prompt $" { pass "print Garply<Garply<char> >::garply" }
- -re ".*$gdb_prompt $" { fail "print Garply<Garply<char> >::garply" }
- timeout { fail "print Garply<Garply<char> >::garply (timeout)" }
-}
+gdb_test "print Garply<Garply<char> >::garply" \
+ "\\$\[0-9\]* = \\{(class |)Garply<char> \\((class |)Garply<Garply<char> > \\*(| const), int, (class |)Garply<char>\\)\\} $hex <Garply<Garply<char>\[ \t\]*>::garply\\(int, (class |)Garply<char>\\)>" \
+ "print Garply<Garply<char> >::garply"
# djb - 06-03-2000
# Now should work fine
diff --git a/gdb/testsuite/gdb.cp/userdef.exp b/gdb/testsuite/gdb.cp/userdef.exp
index 33bb485..1a6fd2e 100644
--- a/gdb/testsuite/gdb.cp/userdef.exp
+++ b/gdb/testsuite/gdb.cp/userdef.exp
@@ -52,20 +52,14 @@ if ![runto_main] then {
continue
}
-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 $" { pass "up from marker1" }
- timeout { fail "up from marker1" }
- }
- }
- -re "$gdb_prompt $" { fail "continue to marker1" }
- timeout { fail "(timeout) continue to marker1" }
- }
+gdb_test "break marker1" \
+ "Breakpoint .*${srcfile}.*"
+
+gdb_test "cont" \
+ "Break.* marker1(\\(\\)|) \\(\\) at .*:$decimal.*" \
+ "continue to marker1"
+gdb_test "up" " in main .*" "up from marker1"
gdb_test "print one + two" "\\\$\[0-9\]* = {x = 6, y = 8}"