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