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