Commit | Line | Data |
---|---|---|
96da2469 | 1 | # Copyright 1998, 1999, 2001, 2003, 2004 Free Software Foundation, Inc. |
a0b3c4fd JM |
2 | |
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
5 | # the Free Software Foundation; either version 2 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
8 | # This program is distributed in the hope that it will be useful, | |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
14 | # along with this program; if not, write to the Free Software | |
15 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
16 | ||
a0b3c4fd JM |
17 | # This file is part of the gdb testsuite |
18 | # file written by Elena Zannoni (ezannoni@cygnus.com) | |
96da2469 | 19 | # rewritten by Michael Chastain (mec.gnu@mindspring.com) |
a0b3c4fd JM |
20 | # |
21 | # source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc | |
a0b3c4fd | 22 | |
96da2469 | 23 | # Call to template instantiations. |
a0b3c4fd JM |
24 | |
25 | if $tracelevel then { | |
96da2469 | 26 | strace $tracelevel |
a0b3c4fd JM |
27 | } |
28 | ||
fc33412a | 29 | if { [skip_cplus_tests] } { continue } |
55b13a65 | 30 | |
a0b3c4fd | 31 | set testfile "cttiadd" |
96da2469 MC |
32 | set srcfile "${srcdir}/${subdir}/${testfile}.cc" |
33 | set srcfile1 "${srcdir}/${subdir}/${testfile}1.cc" | |
34 | set srcfile2 "${srcdir}/${subdir}/${testfile}2.cc" | |
35 | set srcfile3 "${srcdir}/${subdir}/${testfile}3.cc" | |
36 | set objfile "${objdir}/${subdir}/${testfile}.o" | |
37 | set objfile1 "${objdir}/${subdir}/${testfile}1.o" | |
38 | set objfile2 "${objdir}/${subdir}/${testfile}2.o" | |
39 | set objfile3 "${objdir}/${subdir}/${testfile}3.o" | |
40 | set binfile "${objdir}/${subdir}/${testfile}" | |
41 | ||
42 | if { [gdb_compile "${srcfile}" "${objfile}" object {debug c++}] != "" } { | |
43 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
44 | } | |
a0b3c4fd | 45 | |
96da2469 MC |
46 | if { [gdb_compile "${srcfile1}" "${objfile1}" object {debug c++}] != "" } { |
47 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
a0b3c4fd JM |
48 | } |
49 | ||
96da2469 MC |
50 | if { [gdb_compile "${srcfile2}" "${objfile2}" object {debug c++}] != "" } { |
51 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
52 | } | |
a0b3c4fd | 53 | |
96da2469 MC |
54 | if { [gdb_compile "${srcfile3}" "${objfile3}" object {debug c++}] != "" } { |
55 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
56 | } | |
a0b3c4fd | 57 | |
96da2469 MC |
58 | if { [gdb_compile "${objfile} ${objfile1} ${objfile2} ${objfile3}" "${binfile}" executable {debug c++}] != "" } { |
59 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
60 | } | |
a0b3c4fd | 61 | |
96da2469 MC |
62 | if [get_compiler_info ${binfile} "c++"] { |
63 | return -1; | |
64 | } | |
a0b3c4fd JM |
65 | |
66 | gdb_exit | |
67 | gdb_start | |
68 | gdb_reinitialize_dir $srcdir/$subdir | |
69 | gdb_load ${binfile} | |
70 | ||
a0b3c4fd JM |
71 | if ![runto_main] then { |
72 | perror "couldn't run to breakpoint" | |
73 | continue | |
74 | } | |
75 | ||
2789202a MC |
76 | gdb_breakpoint [gdb_get_line_number "marker add1"] |
77 | gdb_continue_to_breakpoint "marker add1" | |
96da2469 MC |
78 | |
79 | gdb_test "print c" "\\$\[0-9\]+ = -62 .*" | |
80 | gdb_test "print f" "\\$\[0-9\]+ = 9" | |
81 | gdb_test "print i" "\\$\[0-9\]+ = 4" | |
82 | ||
2789202a MC |
83 | # TODO: this needs more work before actually deploying it. |
84 | # So bail out here. | |
85 | ||
86 | if { [ test_compiler_info gcc-*] } then { continue } | |
87 | ||
96da2469 MC |
88 | gdb_test_multiple "print add<int>(2,2)" "print add<int>(2,2)" { |
89 | -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" { | |
90 | pass "print add<int>(2,2)" | |
91 | } | |
92 | -re "No symbol \"add<int>\" in current context.\r\n$gdb_prompt $" { | |
93 | # TODO: kfail or xfail this | |
94 | fail "print add<int>(2,2)" | |
95 | } | |
96 | } | |
a0b3c4fd | 97 | |
96da2469 MC |
98 | # Note: 2.25 and 4.5 are exactly representable in IEEE-ish formats |
99 | gdb_test_multiple "print add<float>(2.25,2.25)" "print add<float>(2.25,2.25)" { | |
100 | -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" { | |
101 | pass "print add<float>(2.25,2.25)" | |
102 | } | |
103 | -re "No symbol \"add<float>\" in current context.\r\n$gdb_prompt $" { | |
104 | # TODO: kfail or xfail this | |
105 | fail "print add<float>(2.25,2.25)" | |
106 | } | |
107 | } | |
a0b3c4fd | 108 | |
96da2469 MC |
109 | gdb_test_multiple "print add<char>('A','A')" "print add<char>('A','A')" { |
110 | -re "\\$\[0-9\]+ = -126 .*\r\n$gdb_prompt $" { | |
111 | pass "print add<char>('A','A')" | |
112 | } | |
113 | -re "No symbol \"add<char>\" in current context.\r\n$gdb_prompt $" { | |
114 | # TODO: kfail or xfail this | |
115 | fail "print add<char>('A','A')" | |
116 | } | |
117 | } | |
a0b3c4fd | 118 | |
96da2469 MC |
119 | gdb_test_multiple "print add2<int>(2,2)" "print add2<int>(2,2)" { |
120 | -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" { | |
121 | pass "print add2<int>(2,2)" | |
122 | } | |
123 | -re "No symbol \"add2<int>\" in current context.\r\n$gdb_prompt $" { | |
124 | # TODO: kfail or xfail this | |
125 | fail "print add2<int>(2,2)" | |
126 | } | |
127 | } | |
a0b3c4fd | 128 | |
96da2469 MC |
129 | gdb_test_multiple "print add2<float>(2.25,2.25)" "print add2<float>(2.25,2.25)" { |
130 | -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" { | |
131 | pass "print add2<float>(2.25,2.25)" | |
132 | } | |
133 | -re "No symbol \"add2<float>\" in current context.\r\n$gdb_prompt $" { | |
134 | # TODO: kfail or xfail this | |
135 | fail "print add2<float>(2.25,2.25)" | |
136 | } | |
137 | } | |
a0b3c4fd | 138 | |
96da2469 MC |
139 | gdb_test_multiple "print add2<char>('A','A')" "print add2<char>('A','A')" { |
140 | -re "\\$\[0-9]+ = -126 .*$gdb_prompt $" { | |
141 | pass "print add2<char>('A','A')" | |
142 | } | |
143 | -re "No symbol \"add2<char>\" in current context.\r\n$gdb_prompt $" { | |
144 | # TODO: kfail or xfail this | |
145 | fail "print add2<char>('A','A')" | |
146 | } | |
147 | } | |
a0b3c4fd | 148 | |
96da2469 MC |
149 | gdb_test_multiple "print add3<int>(2,2)" "print add3<int>(2,2)" { |
150 | -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" { | |
151 | pass "print add3<int>(2,2)" | |
152 | } | |
153 | -re "No symbol \"add3<int>\" in current context.\r\n$gdb_prompt $" { | |
154 | # TODO: kfail or xfail this | |
155 | fail "print add3<int>(2,2)" | |
156 | } | |
157 | } | |
a0b3c4fd | 158 | |
96da2469 MC |
159 | gdb_test_multiple "print add3<float>(2.25,2.25)" "print add3<float>(2.25,2.25)" { |
160 | -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" { | |
161 | pass "print add3<float>(2.25,2.25)" | |
162 | } | |
163 | -re "No symbol \"add3<float>\" in current context.\r\n$gdb_prompt $" { | |
164 | # TODO: kfail or xfail this | |
165 | fail "print add3<float>(2.25,2.25)" | |
166 | } | |
167 | } | |
a0b3c4fd | 168 | |
96da2469 MC |
169 | gdb_test_multiple "print add3<char>('A','A')" "print add3<char>('A','A')" { |
170 | -re "\\$\[0-9]+ = -126 .*$gdb_prompt $" { | |
171 | pass "print add3<char>('A','A')" | |
172 | } | |
173 | -re "No symbol \"add3<char>\" in current context.\r\n$gdb_prompt $" { | |
174 | # TODO: kfail or xfail this | |
175 | fail "print add3<char>('A','A')" | |
176 | } | |
177 | } | |
a0b3c4fd | 178 | |
96da2469 MC |
179 | gdb_test_multiple "print add4<int>(2,2)" "print add4<int>(2,2)" { |
180 | -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" { | |
181 | pass "print add4<int>(2,2)" | |
182 | } | |
183 | -re "No symbol \"add4<int>\" in current context.\r\n$gdb_prompt $" { | |
184 | # TODO: kfail or xfail this | |
185 | fail "print add4<int>(2,2)" | |
186 | } | |
187 | } | |
a0b3c4fd | 188 | |
96da2469 MC |
189 | gdb_test_multiple "print add4<float>(2.25,2.25)" "print add4<float>(2.25,2.25)" { |
190 | -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" { | |
191 | pass "print add4<float>(2.25,2.25)" | |
192 | } | |
193 | -re "No symbol \"add4<float>\" in current context.\r\n$gdb_prompt $" { | |
194 | # TODO: kfail or xfail this | |
195 | fail "print add4<float>(2.25,2.25)" | |
196 | } | |
197 | } | |
a0b3c4fd | 198 | |
96da2469 MC |
199 | gdb_test_multiple "print add4<char>('A','A')" "print add4<char>('A','A')" { |
200 | -re "\\$\[0-9]+ = -126 .*$gdb_prompt $" { | |
201 | pass "print add4<char>('A','A')" | |
202 | } | |
203 | -re "No symbol \"add4<char>\" in current context.\r\n$gdb_prompt $" { | |
204 | # TODO: kfail or xfail this | |
205 | fail "print add4<char>('A','A')" | |
206 | } | |
207 | } |