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