Commit | Line | Data |
---|---|---|
d4f3574e | 1 | # Copyright (C) 1992, 1996, 1997, 1999 Free Software Foundation, Inc. |
c906108c SS |
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 | ||
17 | # Please email any bugs, comments, and/or additions to this file to: | |
18 | # bug-gdb@prep.ai.mit.edu | |
19 | ||
20 | # This file was written by Fred Fish. (fnf@cygnus.com) | |
21 | ||
22 | set ws "\[\r\n\t \]+" | |
23 | ||
24 | if $tracelevel then { | |
25 | strace $tracelevel | |
26 | } | |
27 | ||
d4f3574e SS |
28 | if { [skip_cplus_tests] } { continue } |
29 | ||
c906108c SS |
30 | set testfile "templates" |
31 | set srcfile ${testfile}.cc | |
32 | set binfile ${objdir}/${subdir}/${testfile} | |
33 | ||
34 | # Create and source the file that provides information about the compiler | |
35 | # used to compile the test case. | |
36 | if [get_compiler_info ${binfile} "c++"] { | |
37 | return -1 | |
38 | } | |
39 | source ${binfile}.ci | |
40 | ||
c906108c SS |
41 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { |
42 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
43 | } | |
44 | ||
c906108c SS |
45 | # |
46 | # Test printing of the types of templates. | |
47 | # | |
48 | ||
49 | proc test_ptype_of_templates {} { | |
50 | global gdb_prompt | |
51 | global ws | |
52 | ||
53 | send_gdb "ptype T5<int>\n" | |
54 | gdb_expect { | |
dfcd3bfb | 55 | -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}T5<int> & operator=\\(T5<int> const &\\);${ws}T5\\(int\\);${ws}T5\\(T5<int> const &\\);${ws}~T5\\(void\\);${ws}static void \\* operator new\\(unsigned (int|long)\\);${ws}static void operator delete\\(void \\*\\);${ws}int value\\(void\\);${ws}\}\r\n$gdb_prompt $" { |
c906108c SS |
56 | pass "ptype T5<int>" |
57 | } | |
a0b3c4fd JM |
58 | -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned int\\);${ws}static void delete \\(void \\*\\);${ws}int value \\(void\\);${ws}\\}${ws}$gdb_prompt $" { pass "ptype T5<int> -- new with unsigned int" } |
59 | -re "type = class T5<int> \\{.*public:.*static int X;.*int x;.*int val;.*T5 \\(int\\);.*T5 \\(const class T5<int> &\\);.*void ~T5 \\(int\\);.*static void \\* new \\(unsigned long\\);.*static void delete \\(void \\*\\);.*int value \\(void\\);.*\\}\r\n$gdb_prompt $" { pass "ptype T5<int> -- new with unsigned long" } | |
dfcd3bfb | 60 | -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5<int> & operator=\\(T5<int> const &\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\(T5<int> const &\\);)|(${ws}~T5\\(void\\);)|(${ws}static void \\* operator new\\(unsigned (int|long)\\);)|(${ws}static void operator delete\\(void \\*\\);)|(${ws}int value\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { |
c906108c SS |
61 | pass "ptype T5<int> (obsolescent gcc or gdb)" |
62 | } | |
63 | -re ".*$gdb_prompt $" { | |
64 | fail "ptype T5<int>" | |
65 | } | |
66 | timeout { | |
67 | fail "ptype T5<int> (timeout)" | |
68 | } | |
69 | } | |
70 | ||
71 | send_gdb "ptype t5i\n" | |
72 | gdb_expect { | |
a0b3c4fd JM |
73 | -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5\\(int\\);${ws}T5\\(T5<int> const &\\);${ws}~T5\\(void\\);${ws}static void \\* operator new\\(unsigned int\\);${ws}static void operator delete\\(void \\*\\);${ws}int value\\(void\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype T5<int> -- with several fixes from 4.17" } |
74 | -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned int\\);${ws}static void delete \\(void \\*\\);${ws}int value \\(void\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype t5i<int> -- new with unsigned int" } | |
75 | -re "type = class T5<int> \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5 \\(int\\);${ws}T5 \\(const class T5<int> &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned long\\);${ws}static void delete \\(void \\*\\);${ws}int value \\(void\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype t5i<int> -- new with unsigned long" } | |
76 | -re "type = class T5<int> \{.*public:.*static int X;.*int x;.*int val;.*.*T5 \\(int\\);.*.*void ~T5 \\(int\\).*.*.*int value \\(void\\);.*\}.*$gdb_prompt $" { | |
77 | pass "ptype t5i" | |
78 | } | |
c906108c SS |
79 | -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}T5<int> & operator=\\(T5<int> const &\\);${ws}T5\\(int\\);${ws}T5\\(T5<int> const &\\);${ws}~T5\\(void\\);${ws}static void \\* operator new\\(unsigned (int|long)\\);${ws}static void operator delete\\(void \\*\\);${ws}int value\\(void\\);${ws}\}\r\n$gdb_prompt $" { |
80 | pass "ptype t5i" | |
81 | } | |
82 | -re "type = class T5<int> \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5<int> & operator=\\(T5<int> const &\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\(T5<int> const &\\);)|(${ws}~T5\\(void\\);)|(${ws}static void \\* operator new\\(unsigned (int|long)\\);)|(${ws}static void operator delete\\(void \\*\\);)|(${ws}int value\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { | |
83 | pass "ptype t5i (obsolescent gcc or gdb)" | |
84 | } | |
85 | -re ".*$gdb_prompt $" { | |
86 | fail "ptype t5i" | |
87 | } | |
88 | timeout { | |
89 | fail "ptype t5i (timeout)" | |
90 | } | |
91 | } | |
92 | } | |
93 | ||
94 | # | |
95 | # Test breakpoint setting on template methods. | |
96 | # | |
97 | ||
98 | proc test_template_breakpoints {} { | |
99 | global gdb_prompt | |
100 | global testfile | |
101 | global srcdir | |
a0b3c4fd | 102 | global hp_aCC_compiler |
c906108c SS |
103 | |
104 | send_gdb "break T5<int>::T5\n" | |
105 | gdb_expect { | |
106 | -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. T5<int>::T5\\(int\\) at .*\[\r\n\]*.3. T5<int>::T5\\(T5<int> const &\\) at .*\[\r\n\]*> $" { | |
107 | gdb_test "0" \ | |
108 | "cancelled" \ | |
109 | "constructor breakpoint (obsolete format!)" | |
110 | } | |
111 | -re ".0. cancel\[\r\n\]*.1. all\[\r\n\]*.2. T5<int>::T5\\(T5<int> const &\\) at .*templates.cc:.*\[\r\n\]*.3. T5<int>::T5\\(int\\) at .*templates.cc:.*\[\r\n\]*> $" { | |
112 | gdb_test "0" \ | |
113 | "cancelled" \ | |
114 | "constructor breakpoint" | |
115 | } | |
116 | -re ".*$gdb_prompt $" { fail "constructor breakpoint" } | |
117 | default { fail "constructor breakpoint (timeout)" } | |
118 | } | |
119 | ||
a0b3c4fd JM |
120 | # See CLLbs14792 |
121 | if {$hp_aCC_compiler} {setup_xfail hppa*-*-* CLLbs14792} | |
122 | gdb_test "break T5<int>::~T5" \ | |
c906108c SS |
123 | "Breakpoint.*at.* file .*${testfile}.cc, line.*" \ |
124 | "destructor breakpoint" | |
125 | ||
126 | gdb_test "break T5<int>::value" \ | |
127 | "Breakpoint.*at.* file .*${testfile}.cc, line.*" \ | |
128 | "value method breakpoint" | |
129 | ||
130 | delete_breakpoints | |
131 | } | |
132 | ||
133 | # | |
134 | # Test calling of template methods. | |
135 | # | |
136 | ||
137 | proc test_template_calls {} { | |
138 | global gdb_prompt | |
a0b3c4fd | 139 | global hp_aCC_compiler |
c906108c SS |
140 | |
141 | if [target_info exists gdb,cannot_call_functions] { | |
142 | setup_xfail "*-*-*" 2416 | |
143 | fail "This target can not call functions" | |
144 | return | |
145 | } | |
146 | ||
a0b3c4fd | 147 | if {!$hp_aCC_compiler} {setup_xfail hppa*-*-*} |
c906108c SS |
148 | send_gdb "print t5i.value()\n" |
149 | gdb_expect { | |
150 | -re ".* = 2\[\r\n\]*$gdb_prompt $" { pass "print t5i.value()" } | |
151 | -re "Cannot invoke functions on this machine.*$gdb_prompt $" { | |
152 | fail "print t5i.value()" | |
153 | } | |
a0b3c4fd JM |
154 | -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" { |
155 | setup_xfail hppa*-*-* CLLbs16899 | |
156 | xfail "print t5i.value" | |
157 | } | |
c906108c | 158 | -re ".*$gdb_prompt $" { fail "print t5i.value()" } |
a0b3c4fd | 159 | timeout { fail "print t5i.value() (timeout)" } |
c906108c SS |
160 | } |
161 | } | |
162 | ||
163 | ||
164 | proc do_tests {} { | |
165 | global prms_id | |
166 | global bug_id | |
167 | global subdir | |
168 | global objdir | |
169 | global srcdir | |
170 | global binfile | |
171 | global gdb_prompt | |
172 | global supports_template_debugging | |
173 | ||
174 | set prms_id 0 | |
175 | set bug_id 0 | |
176 | ||
177 | # Start with a fresh gdb. | |
178 | ||
179 | gdb_exit | |
180 | gdb_start | |
181 | gdb_reinitialize_dir $srcdir/$subdir | |
182 | gdb_load $binfile | |
183 | ||
184 | if { !$supports_template_debugging } { | |
185 | warning "compiler lacks debugging info for templates; tests suppressed." 0 | |
186 | return | |
187 | } | |
188 | ||
189 | # Get the debug format for the compiled test case. If that | |
190 | # format is DWARF 1 then just skip all the tests since none of | |
191 | # them will pass. | |
192 | ||
193 | if [ runto_main] then { | |
194 | get_debug_format | |
195 | if [ setup_xfail_format "DWARF 1" ] then { | |
196 | fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format" | |
197 | return | |
198 | } | |
199 | clear_xfail "*-*-*" | |
200 | } | |
201 | ||
202 | test_ptype_of_templates | |
203 | test_template_breakpoints | |
204 | ||
205 | if [ runto_main] { | |
206 | test_template_calls | |
207 | } | |
208 | } | |
209 | ||
210 | do_tests | |
211 | ||
a0b3c4fd JM |
212 | if {!$hp_aCC_compiler} {continue} |
213 | ||
214 | # More tests for different kinds of template parameters, | |
215 | # templates with partial specializations, nested templates, etc. | |
216 | # These have been tested only with HP aCC. They probably won't | |
217 | # work with other compilers because of differences in mangling | |
218 | # schemes. | |
219 | # Added by Satish Pai <pai@apollo.hp.com> 1997-09-25 | |
220 | ||
221 | send_gdb "print fint\n" | |
222 | gdb_expect { | |
223 | -re "\\$\[0-9\]* = \\{x = 0, t = 0\\}\r\n$gdb_prompt $" { pass "print fint" } | |
224 | -re "$gdb_prompt $" { fail "print fint" } | |
225 | timeout { fail "(timeout) print fint" } | |
226 | } | |
227 | ||
228 | send_gdb "print fvpchar\n" | |
229 | gdb_expect { | |
230 | -re "\\$\[0-9\]* = \\{x = 0, t = 0x0\\}\r\n$gdb_prompt $" { pass "print fvpchar" } | |
231 | -re "$gdb_prompt $" { fail "print fvpchar" } | |
232 | timeout { fail "(timeout) print fvpchar" } | |
233 | } | |
234 | ||
235 | # Template Foo<T> | |
236 | ||
237 | setup_xfail hppa2.0w-*-* CLLbs16092 | |
238 | send_gdb "ptype Foo\n" | |
239 | gdb_expect { | |
240 | -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Foo<volatile char \\*>\r\n\[ \t\]*(class |)Foo<char>\r\n\[ \t\]*(class |)Foo<int>\r\n$gdb_prompt $" { pass "ptype Foo" } | |
241 | -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Foo" } | |
242 | -re "$gdb_prompt $" { fail "ptype Foo" } | |
243 | timeout { fail "(timeout) ptype Foo" } | |
244 | } | |
245 | ||
246 | # ptype Foo<int> | |
247 | ||
248 | send_gdb "ptype fint\n" | |
249 | gdb_expect { | |
250 | -re "type = (class |)Foo<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fint" } | |
251 | -re "$gdb_prompt $" { fail "ptype fint" } | |
252 | timeout { fail "(timeout) ptype fint" } | |
253 | } | |
254 | ||
255 | # ptype Foo<char> | |
256 | ||
257 | send_gdb "ptype fchar\n" | |
258 | gdb_expect { | |
259 | -re "type = (class |)Foo<char> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char foo\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fchar" } | |
260 | -re "$gdb_prompt $" { fail "ptype fchar" } | |
261 | timeout { fail "(timeout) ptype fchar" } | |
262 | } | |
263 | ||
264 | # ptype Foo<volatile char *> | |
265 | ||
266 | send_gdb "ptype fvpchar\n" | |
267 | gdb_expect { | |
268 | -re "type = (class |)Foo<volatile char \\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*volatile char \\*t;\r\n\r\n\[ \t\]*volatile char \\* foo\\(int, volatile char \\*\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fvpchar" } | |
269 | -re "$gdb_prompt $" { fail "ptype fvpchar" } | |
270 | timeout { fail "(timeout) ptype fvpchar" } | |
271 | } | |
272 | ||
273 | # print a function from Foo<volatile char *> | |
274 | ||
275 | send_gdb "print Foo<volatile char *>::foo\n" | |
276 | gdb_expect { | |
277 | -re "\\$\[0-9\]* = \\{volatile char \\*\\((class |)Foo<volatile char \\*> \\*, int, volatile char \\*\\)\\} $hex <Foo<volatile char \\*>::foo\\(int, volatile char \\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char *>::foo" } | |
278 | -re "$gdb_prompt $" { fail "print Foo<volatile char *>::foo" } | |
279 | timeout { fail "(timeout) print Foo<volatile char *>::foo" } | |
280 | } | |
281 | ||
282 | # Template Bar<T, int> | |
283 | ||
284 | setup_xfail hppa2.0w-*-* CLLbs16092 | |
285 | send_gdb "ptype Bar\n" | |
286 | gdb_expect { | |
287 | -re "type = template <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)1>\r\n\[ \t\]*(class |)Bar<int,(\\(int\\)|)33>\r\n$gdb_prompt $" { pass "ptype Bar" } | |
288 | -re "type = <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Bar" } | |
289 | -re "$gdb_prompt $" { fail "ptype Bar" } | |
290 | timeout { fail "(timeout) ptype Bar" } | |
291 | } | |
292 | ||
293 | ||
294 | # ptype Bar<int,33> | |
295 | ||
296 | send_gdb "ptype bint\n" | |
297 | gdb_expect { | |
298 | -re "type = (class |)Bar<int,(\\(int\\)|)33> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint" } | |
299 | -re "$gdb_prompt $" { fail "ptype bint" } | |
300 | timeout { fail "(timeout) ptype bint" } | |
301 | } | |
302 | ||
303 | # ptype Bar<int, (4>3)> | |
304 | ||
305 | send_gdb "ptype bint2\n" | |
306 | gdb_expect { | |
307 | -re "type = (class |)Bar<int,(\\(int\\)|)1> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint2" } | |
308 | -re "$gdb_prompt $" { fail "ptype bint2" } | |
309 | timeout { fail "(timeout) ptype bint2" } | |
310 | } | |
311 | ||
312 | # Template Baz<T, char> | |
313 | ||
314 | setup_xfail hppa2.0w-*-* CLLbs16092 | |
315 | send_gdb "ptype Baz\n" | |
316 | gdb_expect { | |
317 | -re "type = template <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Baz<char,(\\(char\\)|)97>\r\n\[ \t\]*(class |)Baz<int,(\\(char\\)|)115>\r\n$gdb_prompt $" { pass "ptype Baz" } | |
318 | -re "type = <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Baz" } | |
319 | -re "$gdb_prompt $" { fail "ptype Baz" } | |
320 | timeout { fail "(timeout) ptype Baz" } | |
321 | } | |
322 | ||
323 | ||
324 | # ptype Baz<int, 's'> | |
325 | ||
326 | send_gdb "ptype bazint\n" | |
327 | gdb_expect { | |
328 | -re "type = (class |)Baz<int,(\\(char\\)|)115> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint" } | |
329 | -re "$gdb_prompt $" { fail "ptype bazint" } | |
330 | timeout { fail "(timeout) ptype bazint" } | |
331 | } | |
332 | ||
333 | # ptype Baz<char, 'a'> | |
334 | ||
335 | send_gdb "ptype bazint2\n" | |
336 | gdb_expect { | |
337 | -re "type = (class |)Baz<char,(\\(char\\)|)97> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char baz\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint2" } | |
338 | -re "$gdb_prompt $" { fail "ptype bazint2" } | |
339 | timeout { fail "(timeout) ptype bazint2" } | |
340 | } | |
341 | ||
342 | # Template Qux<T, int (*f)(int) > | |
343 | ||
344 | send_gdb "ptype Qux\n" | |
345 | gdb_expect { | |
346 | -re "type = template <(class |)T, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Qux<int,&string>\r\n\[ \t\]*(class |)Qux<char,&string>\r\n$gdb_prompt $" { pass "ptype Qux" } | |
347 | -re ".*type = template <(class |)T.*, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}.*$gdb_prompt $" { pass "ptype Qux" } | |
348 | -re "$gdb_prompt $" { fail "ptype Qux" } | |
349 | timeout { fail "(timeout) ptype Qux" } | |
350 | } | |
351 | ||
352 | # pt Qux<int,&string> | |
353 | ||
354 | send_gdb "ptype quxint\n" | |
355 | gdb_expect { | |
356 | -re "type = class Qux<int,&string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" } | |
357 | -re "$gdb_prompt $" { fail "ptype quxint" } | |
358 | timeout { fail "(timeout) ptype quxint" } | |
359 | } | |
360 | ||
361 | # pt Qux<char,0> | |
362 | ||
363 | # commented out this as quxint2 declaration was commented out in | |
364 | # templates.exp -- ovidiu | |
365 | # send_gdb "ptype quxint2\n" | |
366 | # gdb_expect { | |
367 | # -re "type = class Qux<char,&string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char qux\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint2" } | |
368 | # -re "$gdb_prompt $" { fail "ptype quxint2" } | |
369 | # timeout { fail "(timeout) ptype quxint2" } | |
370 | # } | |
371 | ||
372 | # Template Spec<T1, T2> | |
373 | ||
374 | setup_xfail hppa2.0w-*-* CLLbs16092 | |
375 | send_gdb "ptype Spec\n" | |
376 | gdb_expect { | |
377 | -re "type = template <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Spec<int,int \\*>\r\n\[ \t\]*(class |)Spec<int,char>\r\n$gdb_prompt $" { pass "ptype Spec" } | |
378 | -re "type = <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { xfail "ptype Spec" } | |
379 | -re "$gdb_prompt $" { fail "ptype Spec" } | |
380 | timeout { fail "(timeout) ptype Spec" } | |
381 | } | |
382 | ||
383 | # pt Spec<char,0> | |
384 | ||
385 | send_gdb "ptype siip\n" | |
386 | gdb_expect { | |
387 | -re "type = class Spec<int,int \\*> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(int \\*\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype siip" } | |
388 | -re "$gdb_prompt $" { fail "ptype siip" } | |
389 | timeout { fail "(timeout) ptype siip" } | |
390 | } | |
391 | ||
392 | # pt Garply<int> | |
393 | ||
394 | send_gdb "ptype Garply<int>\n" | |
395 | gdb_expect { | |
396 | -re "type = class Garply<int> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int garply\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply<int>" } | |
397 | -re "$gdb_prompt $" { fail "ptype Garply<int>" } | |
398 | timeout { fail "(timeout) ptype Garply<int>" } | |
399 | } | |
400 | ||
401 | # ptype of nested template name | |
402 | ||
403 | send_gdb "ptype Garply<Garply<char> >\n" | |
404 | gdb_expect { | |
405 | -re "type = (class |)Garply<Garply<char> > \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*(class |)Garply<char> t;\r\n\r\n\[ \t\]*(class |)Garply<char> garply\\(int, (class |)Garply<char>\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply<Garply<char> >" } | |
406 | -re "$gdb_prompt $" { fail "ptype Garply<Garply<char> >" } | |
407 | timeout { fail "(timeout) ptype Garply<Garply<char> >" } | |
408 | } | |
409 | ||
410 | # print out a function from a nested template name | |
411 | ||
412 | send_gdb "print Garply<Garply<char> >::garply\n" | |
413 | gdb_expect { | |
414 | -re "\\$\[0-9\]* = \\{(class |)Garply<char> \\((class |)Garply<Garply<char> > \\*, int, (class |)Garply<char>\\)\\} $hex <Garply<Garply<char>>::garply\\(int, (class |)Garply<char>\\)>\r\n$gdb_prompt $" { pass "print Garply<Garply<char> >::garply" } | |
415 | -re ".*$gdb_prompt $" { fail "print Garply<Garply<char> >::garply" } | |
416 | timeout { fail "print Garply<Garply<char> >::garply (timeout)" } | |
417 | } | |
418 | ||
419 | # UNFORTUNATELY, "break Garply<Garply<char> >::garply" doesn't yet work. | |
420 | ||
421 | #send_gdb "break Garply<Garply<char> >::garply | |
422 | #gdb_expect { | |
423 | # -re "Breakpoint \[0-9\]* at $hex: file .*templates.cc, line.*\r\n$gdb_prompt $" { pass "break Garply<Garply<char> >::garply" } | |
424 | # -re ".*$gdb_prompt $" { fail "break Garply<Garply<char> >::garply" } | |
425 | # timeout { fail "break Garply<Garply<char> >::garply (timeout)" } | |
426 | #} |