1 # Copyright 1998-1999, 2001, 2003-2004, 2007-2012 Free Software
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # This file is part of the gdb testsuite
18 # file written by Elena Zannoni (ezannoni@cygnus.com)
19 # rewritten by Michael Chastain (mec.gnu@mindspring.com)
21 # source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc
23 # Call to template instantiations.
25 if { [skip_cplus_tests] } { continue }
27 standard_testfile cttiadd.cc cttiadd1.cc cttiadd2.cc cttiadd3.cc
29 if [get_compiler_info "c++"] {
33 if {[prepare_for_testing $testfile.exp $testfile \
34 [list $srcfile $srcfile2 $srcfile3 $srcfile4] {debug c++}]} {
38 if ![runto_main] then {
39 perror "couldn't run to breakpoint"
43 gdb_breakpoint [gdb_get_line_number "marker add1"]
44 gdb_continue_to_breakpoint "marker add1"
46 gdb_test "print c" "\\$\[0-9\]+ = 194 .*"
47 gdb_test "print f" "\\$\[0-9\]+ = 9"
48 gdb_test "print i" "\\$\[0-9\]+ = 4"
50 # TODO: this needs more work before actually deploying it.
53 if { [ test_compiler_info gcc-*] } then { continue }
55 gdb_test_multiple "print add<int>(2,2)" "print add<int>(2,2)" {
56 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
57 pass "print add<int>(2,2)"
59 -re "No symbol \"add<int>\" in current context.\r\n$gdb_prompt $" {
60 # TODO: kfail or xfail this
61 fail "print add<int>(2,2)"
65 # Note: 2.25 and 4.5 are exactly representable in IEEE-ish formats
66 gdb_test_multiple "print add<float>(2.25,2.25)" "print add<float>(2.25,2.25)" {
67 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
68 pass "print add<float>(2.25,2.25)"
70 -re "No symbol \"add<float>\" in current context.\r\n$gdb_prompt $" {
71 # TODO: kfail or xfail this
72 fail "print add<float>(2.25,2.25)"
76 gdb_test_multiple "print add<unsigned char>('A','A')" "print add<unsigned char>('A','A')" {
77 -re "\\$\[0-9\]+ = 130 .*\r\n$gdb_prompt $" {
78 pass "print add<unsigned char>('A','A')"
80 -re "No symbol \"add<unsigned char>\" in current context.\r\n$gdb_prompt $" {
81 # TODO: kfail or xfail this
82 fail "print add<unsigned char>('A','A')"
86 gdb_test_multiple "print add2<int>(2,2)" "print add2<int>(2,2)" {
87 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
88 pass "print add2<int>(2,2)"
90 -re "No symbol \"add2<int>\" in current context.\r\n$gdb_prompt $" {
91 # TODO: kfail or xfail this
92 fail "print add2<int>(2,2)"
96 gdb_test_multiple "print add2<float>(2.25,2.25)" "print add2<float>(2.25,2.25)" {
97 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
98 pass "print add2<float>(2.25,2.25)"
100 -re "No symbol \"add2<float>\" in current context.\r\n$gdb_prompt $" {
101 # TODO: kfail or xfail this
102 fail "print add2<float>(2.25,2.25)"
106 gdb_test_multiple "print add2<unsigned char>('A','A')" "print add2<unsigned char>('A','A')" {
107 -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
108 pass "print add2<unsigned char>('A','A')"
110 -re "No symbol \"add2<unsigned char>\" in current context.\r\n$gdb_prompt $" {
111 # TODO: kfail or xfail this
112 fail "print add2<unsigned char>('A','A')"
116 gdb_test_multiple "print add3<int>(2,2)" "print add3<int>(2,2)" {
117 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
118 pass "print add3<int>(2,2)"
120 -re "No symbol \"add3<int>\" in current context.\r\n$gdb_prompt $" {
121 # TODO: kfail or xfail this
122 fail "print add3<int>(2,2)"
126 gdb_test_multiple "print add3<float>(2.25,2.25)" "print add3<float>(2.25,2.25)" {
127 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
128 pass "print add3<float>(2.25,2.25)"
130 -re "No symbol \"add3<float>\" in current context.\r\n$gdb_prompt $" {
131 # TODO: kfail or xfail this
132 fail "print add3<float>(2.25,2.25)"
136 gdb_test_multiple "print add3<unsigned char>('A','A')" "print add3<unsigned char>('A','A')" {
137 -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
138 pass "print add3<unsigned char>('A','A')"
140 -re "No symbol \"add3<unsigned char>\" in current context.\r\n$gdb_prompt $" {
141 # TODO: kfail or xfail this
142 fail "print add3<unsigned char>('A','A')"
146 gdb_test_multiple "print add4<int>(2,2)" "print add4<int>(2,2)" {
147 -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
148 pass "print add4<int>(2,2)"
150 -re "No symbol \"add4<int>\" in current context.\r\n$gdb_prompt $" {
151 # TODO: kfail or xfail this
152 fail "print add4<int>(2,2)"
156 gdb_test_multiple "print add4<float>(2.25,2.25)" "print add4<float>(2.25,2.25)" {
157 -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
158 pass "print add4<float>(2.25,2.25)"
160 -re "No symbol \"add4<float>\" in current context.\r\n$gdb_prompt $" {
161 # TODO: kfail or xfail this
162 fail "print add4<float>(2.25,2.25)"
166 gdb_test_multiple "print add4<unsigned char>('A','A')" "print add4<unsigned char>('A','A')" {
167 -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
168 pass "print add4<unsigned char>('A','A')"
170 -re "No symbol \"add4<unsigned char>\" in current context.\r\n$gdb_prompt $" {
171 # TODO: kfail or xfail this
172 fail "print add4<unsigned char>('A','A')"