Update/correct copyright notices.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.c++ / templates.exp
1 # Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000
2 # Free Software Foundation, Inc.
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
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
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.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 # Please email any bugs, comments, and/or additions to this file to:
19 # bug-gdb@prep.ai.mit.edu
20
21 # This file was written by Fred Fish. (fnf@cygnus.com)
22
23 set ws "\[\r\n\t \]+"
24
25 if $tracelevel then {
26 strace $tracelevel
27 }
28
29 if { [skip_cplus_tests] } { continue }
30
31 set testfile "templates"
32 set srcfile ${testfile}.cc
33 set binfile ${objdir}/${subdir}/${testfile}
34
35 # Create and source the file that provides information about the compiler
36 # used to compile the test case.
37 if [get_compiler_info ${binfile} "c++"] {
38 return -1
39 }
40 source ${binfile}.ci
41
42 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
43 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
44 }
45
46 #
47 # Test printing of the types of templates.
48 #
49
50 proc test_ptype_of_templates {} {
51 global gdb_prompt
52 global ws
53
54 send_gdb "ptype T5<int>\n"
55 gdb_expect {
56 -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 $" {
57 pass "ptype T5<int>"
58 }
59 -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" }
60 -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" }
61 -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 $" {
62 pass "ptype T5<int> (obsolescent gcc or gdb)"
63 }
64 -re ".*$gdb_prompt $" {
65 fail "ptype T5<int>"
66 }
67 timeout {
68 fail "ptype T5<int> (timeout)"
69 }
70 }
71
72 send_gdb "ptype t5i\n"
73 gdb_expect {
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\\(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" }
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 int\\);${ws}static void delete \\(void \\*\\);${ws}int value \\(void\\);${ws}\\}\r\n$gdb_prompt $" { pass "ptype t5i<int> -- new with unsigned int" }
76 -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" }
77 -re "type = class T5<int> \{.*public:.*static int X;.*int x;.*int val;.*.*T5 \\(int\\);.*.*void ~T5 \\(int\\).*.*.*int value \\(void\\);.*\}.*$gdb_prompt $" {
78 pass "ptype t5i"
79 }
80 -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 $" {
81 pass "ptype t5i"
82 }
83 -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 $" {
84 pass "ptype t5i (obsolescent gcc or gdb)"
85 }
86 -re ".*$gdb_prompt $" {
87 fail "ptype t5i"
88 }
89 timeout {
90 fail "ptype t5i (timeout)"
91 }
92 }
93 }
94
95 #
96 # Test breakpoint setting on template methods.
97 #
98
99 proc test_template_breakpoints {} {
100 global gdb_prompt
101 global testfile
102 global srcdir
103 global hp_aCC_compiler
104
105 send_gdb "break T5<int>::T5\n"
106 gdb_expect {
107 -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\]*> $" {
108 gdb_test "0" \
109 "canceled" \
110 "constructor breakpoint (obsolete format!)"
111 }
112 -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\]*> $" {
113 gdb_test "0" \
114 "canceled" \
115 "constructor breakpoint"
116 }
117 -re ".*$gdb_prompt $" { fail "constructor breakpoint" }
118 default { fail "constructor breakpoint (timeout)" }
119 }
120
121 # See CLLbs14792
122 if {$hp_aCC_compiler} {setup_xfail hppa*-*-* CLLbs14792}
123 gdb_test "break T5<int>::~T5" \
124 "Breakpoint.*at.* file .*${testfile}.cc, line.*" \
125 "destructor breakpoint"
126
127 gdb_test "break T5<int>::value" \
128 "Breakpoint.*at.* file .*${testfile}.cc, line.*" \
129 "value method breakpoint"
130
131 delete_breakpoints
132 }
133
134 #
135 # Test calling of template methods.
136 #
137
138 proc test_template_calls {} {
139 global gdb_prompt
140 global hp_aCC_compiler
141
142 if [target_info exists gdb,cannot_call_functions] {
143 setup_xfail "*-*-*" 2416
144 fail "This target can not call functions"
145 return
146 }
147
148 if {!$hp_aCC_compiler} {setup_xfail hppa*-*-*}
149 send_gdb "print t5i.value()\n"
150 gdb_expect {
151 -re ".* = 2\[\r\n\]*$gdb_prompt $" { pass "print t5i.value()" }
152 -re "Cannot invoke functions on this machine.*$gdb_prompt $" {
153 fail "print t5i.value()"
154 }
155 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
156 setup_xfail hppa*-*-* CLLbs16899
157 xfail "print t5i.value"
158 }
159 -re ".*$gdb_prompt $" { fail "print t5i.value()" }
160 timeout { fail "print t5i.value() (timeout)" }
161 }
162 }
163
164
165 proc do_tests {} {
166 global prms_id
167 global bug_id
168 global subdir
169 global objdir
170 global srcdir
171 global binfile
172 global gdb_prompt
173 global supports_template_debugging
174
175 set prms_id 0
176 set bug_id 0
177
178 # Start with a fresh gdb.
179
180 gdb_exit
181 gdb_start
182 gdb_reinitialize_dir $srcdir/$subdir
183 gdb_load $binfile
184
185 if { !$supports_template_debugging } {
186 warning "compiler lacks debugging info for templates; tests suppressed." 0
187 return
188 }
189
190 # Get the debug format for the compiled test case. If that
191 # format is DWARF 1 then just skip all the tests since none of
192 # them will pass.
193
194 if [ runto_main] then {
195 get_debug_format
196 if [ setup_xfail_format "DWARF 1" ] then {
197 fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
198 return
199 }
200 clear_xfail "*-*-*"
201 }
202
203 test_ptype_of_templates
204 test_template_breakpoints
205
206 if [ runto_main] {
207 test_template_calls
208 }
209 }
210
211 do_tests
212
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 # As of 2000-06-03, C++ support has been improved to the point that g++ can
221 # pass all of theses, excluding what appears to be one that exposes a stabs bug. - djb
222
223 # I don't know how HP could be passing these tests without this. They
224 # weren't breakpointing past a point where the below expressions were
225 # initialized in the actual source. - djb
226
227 send_gdb "b 770\n"
228 gdb_expect {
229 -re ".*$gdb_prompt $"
230 }
231 send_gdb "c\n"
232 gdb_expect {
233 -re ".*$gdb_prompt $"
234 }
235 send_gdb "print fint\n"
236 gdb_expect {
237 -re "\\$\[0-9\]* = \\{x = 0, t = 0\\}\r\n$gdb_prompt $" { pass "print fint" }
238 -re "$gdb_prompt $" { fail "print fint" }
239 timeout { fail "(timeout) print fint" }
240 }
241
242 send_gdb "print fvpchar\n"
243 gdb_expect {
244 -re "\\$\[0-9\]* = \\{x = 0, t = 0x0\\}\r\n$gdb_prompt $" { pass "print fvpchar" }
245 -re "$gdb_prompt $" { fail "print fvpchar" }
246 timeout { fail "(timeout) print fvpchar" }
247 }
248
249 # Template Foo<T>
250
251 setup_xfail hppa2.0w-*-* CLLbs16092
252 # g++ can't do the template instantiation in debug info trick, so we
253 # fail this because it's not a real type.
254 if {!$hp_aCC_compiler} { setup_xfail *-*-* }
255 send_gdb "ptype Foo\n"
256 gdb_expect {
257 -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" }
258 -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" }
259 -re "$gdb_prompt $" { fail "ptype Foo" }
260 timeout { fail "(timeout) ptype Foo" }
261 }
262
263 # ptype Foo<int>
264
265 send_gdb "ptype fint\n"
266 gdb_expect {
267 -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" }
268 -re "$gdb_prompt $" { fail "ptype fint" }
269 timeout { fail "(timeout) ptype fint" }
270 }
271
272 # ptype Foo<char>
273
274 send_gdb "ptype fchar\n"
275 gdb_expect {
276 -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" }
277 -re "$gdb_prompt $" { fail "ptype fchar" }
278 timeout { fail "(timeout) ptype fchar" }
279 }
280
281 # ptype Foo<volatile char *>
282
283 send_gdb "ptype fvpchar\n"
284 gdb_expect {
285 -re "type = (class |)Foo<volatile 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 fvpchar" }
286 -re "$gdb_prompt $" { fail "ptype fvpchar" }
287 timeout { fail "(timeout) ptype fvpchar" }
288 }
289
290 # print a function from Foo<volatile char *>
291
292 send_gdb "print Foo<volatile char *>::foo\n"
293 gdb_expect {
294 -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<volatile char \\*> \\*, int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char *>::foo" }
295 -re "$gdb_prompt $" { fail "print Foo<volatile char *>::foo" }
296 timeout { fail "(timeout) print Foo<volatile char *>::foo" }
297 }
298
299 # Template Bar<T, int>
300
301 setup_xfail hppa2.0w-*-* CLLbs16092
302 # same as Foo for g++
303 if {!$hp_aCC_compiler} { setup_xfail *-*-* }
304 send_gdb "ptype Bar\n"
305 gdb_expect {
306 -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" }
307 -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" }
308 -re "$gdb_prompt $" { fail "ptype Bar" }
309 timeout { fail "(timeout) ptype Bar" }
310 }
311
312
313 # ptype Bar<int,33>
314 # stabs screws this test royally.
315 # It thinks it has a badly mangled name.
316 # I blame stabs, the other formats get it right. -djb
317 get_debug_format
318 setup_xfail_format "stabs"
319 send_gdb "ptype bint\n"
320 gdb_expect {
321 -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" }
322 -re "$gdb_prompt $" { fail "ptype bint" }
323 timeout { fail "(timeout) ptype bint" }
324 }
325
326 # ptype Bar<int, (4>3)>
327
328 send_gdb "ptype bint2\n"
329 gdb_expect {
330 -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" }
331 -re "$gdb_prompt $" { fail "ptype bint2" }
332 timeout { fail "(timeout) ptype bint2" }
333 }
334
335 # Template Baz<T, char>
336
337 setup_xfail hppa2.0w-*-* CLLbs16092
338 # Same as Foo, for g++
339 if {!$hp_aCC_compiler} { setup_xfail *-*-* }
340 send_gdb "ptype Baz\n"
341 gdb_expect {
342 -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" }
343 -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" }
344 -re "$gdb_prompt $" { fail "ptype Baz" }
345 timeout { fail "(timeout) ptype Baz" }
346 }
347
348
349 # ptype Baz<int, 's'>
350
351 send_gdb "ptype bazint\n"
352 gdb_expect {
353 -re "type = (class |)Baz<int,(\\(char\\)|)(115|\\'s\\')> \\{\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" }
354 -re "$gdb_prompt $" { fail "ptype bazint" }
355 timeout { fail "(timeout) ptype bazint" }
356 }
357
358 # ptype Baz<char, 'a'>
359
360 send_gdb "ptype bazint2\n"
361 gdb_expect {
362 -re "type = (class |)Baz<char,(\\(char\\)|)(97|\\'a\\')> \\{\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" }
363 -re "$gdb_prompt $" { fail "ptype bazint2" }
364 timeout { fail "(timeout) ptype bazint2" }
365 }
366
367 # Template Qux<T, int (*f)(int) >
368 # Same as Foo for g++
369 if {!$hp_aCC_compiler} {setup_xfail *-*-*}
370 send_gdb "ptype Qux\n"
371 gdb_expect {
372 -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" }
373 -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" }
374 -re "$gdb_prompt $" { fail "ptype Qux" }
375 timeout { fail "(timeout) ptype Qux" }
376 }
377
378 # pt Qux<int,&string>
379
380 send_gdb "ptype quxint\n"
381 gdb_expect {
382 -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" }
383 -re "$gdb_prompt $" { fail "ptype quxint" }
384 timeout { fail "(timeout) ptype quxint" }
385 }
386
387 # pt Qux<char,0>
388
389 # commented out this as quxint2 declaration was commented out in
390 # templates.exp -- ovidiu
391 # send_gdb "ptype quxint2\n"
392 # gdb_expect {
393 # -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" }
394 # -re "$gdb_prompt $" { fail "ptype quxint2" }
395 # timeout { fail "(timeout) ptype quxint2" }
396 # }
397
398 # Template Spec<T1, T2>
399
400 setup_xfail hppa2.0w-*-* CLLbs16092
401 # Same as Foo for g++
402 if {!$hp_aCC_compiler} { setup_xfail *-*-* }
403 send_gdb "ptype Spec\n"
404 gdb_expect {
405 -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" }
406 -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" }
407 -re "$gdb_prompt $" { fail "ptype Spec" }
408 timeout { fail "(timeout) ptype Spec" }
409 }
410
411 # pt Spec<char,0>
412
413 send_gdb "ptype siip\n"
414 gdb_expect {
415 -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" }
416 -re "$gdb_prompt $" { fail "ptype siip" }
417 timeout { fail "(timeout) ptype siip" }
418 }
419
420 # pt Garply<int>
421
422 send_gdb "ptype Garply<int>\n"
423 gdb_expect {
424 -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>" }
425 -re "$gdb_prompt $" { fail "ptype Garply<int>" }
426 timeout { fail "(timeout) ptype Garply<int>" }
427 }
428
429 # ptype of nested template name
430
431 send_gdb "ptype Garply<Garply<char> >\n"
432 gdb_expect {
433 -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> >" }
434 -re "$gdb_prompt $" { fail "ptype Garply<Garply<char> >" }
435 timeout { fail "(timeout) ptype Garply<Garply<char> >" }
436 }
437
438 # print out a function from a nested template name
439
440 send_gdb "print Garply<Garply<char> >::garply\n"
441 gdb_expect {
442 -re "\\$\[0-9\]* = \\{(class |)Garply<char> \\((class |)Garply<Garply<char> > \\*, int, (class |)Garply<char>\\)\\} $hex <Garply<Garply<char>\[ \t\]*>::garply\\(int, (class |)Garply<char>\\)>\r\n$gdb_prompt $" { pass "print Garply<Garply<char> >::garply" }
443 -re ".*$gdb_prompt $" { fail "print Garply<Garply<char> >::garply" }
444 timeout { fail "print Garply<Garply<char> >::garply (timeout)" }
445 }
446
447 # djb - 06-03-2000
448 # Now should work fine
449 send_gdb "break Garply<Garply<char> >::garply\n"
450 gdb_expect {
451 -re "Breakpoint \[0-9\]* at $hex: file .*templates.cc, line.*\r\n$gdb_prompt $" { pass "break Garply<Garply<char> >::garply" }
452 -re ".*$gdb_prompt $" { fail "break Garply<Garply<char> >::garply" }
453 timeout { fail "break Garply<Garply<char> >::garply (timeout)" }
454 }
This page took 0.04044 seconds and 4 git commands to generate.