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