This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.c++ / templates.exp
1 # Copyright (C) 1992, 1996, 1997, 1999 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
22 set ws "\[\r\n\t \]+"
23
24 if $tracelevel then {
25 strace $tracelevel
26 }
27
28 if { [skip_cplus_tests] } { continue }
29
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
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
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 {
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 $" {
56 pass "ptype T5<int>"
57 }
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" }
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 $" {
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 {
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 }
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
102 global hp_aCC_compiler
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
120 # See CLLbs14792
121 if {$hp_aCC_compiler} {setup_xfail hppa*-*-* CLLbs14792}
122 gdb_test "break T5<int>::~T5" \
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
139 global hp_aCC_compiler
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
147 if {!$hp_aCC_compiler} {setup_xfail hppa*-*-*}
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 }
154 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
155 setup_xfail hppa*-*-* CLLbs16899
156 xfail "print t5i.value"
157 }
158 -re ".*$gdb_prompt $" { fail "print t5i.value()" }
159 timeout { fail "print t5i.value() (timeout)" }
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
212
213 # More tests for different kinds of template parameters,
214 # templates with partial specializations, nested templates, etc.
215 # These have been tested only with HP aCC. They probably won't
216 # work with other compilers because of differences in mangling
217 # schemes.
218 # Added by Satish Pai <pai@apollo.hp.com> 1997-09-25
219 # As of 2000-06-03, C++ support has been improved to the point that g++ can
220 # pass all of theses, excluding what appears to be one that exposes a stabs bug. - djb
221
222 # I don't know how HP could be passing these tests without this. They
223 # weren't breakpointing past a point where the below expressions were
224 # initialized in the actual source. - djb
225
226 send_gdb "b 770\n"
227 gdb_expect {
228 -re ".*$gdb_prompt $"
229 }
230 send_gdb "c\n"
231 gdb_expect {
232 -re ".*$gdb_prompt $"
233 }
234 send_gdb "print fint\n"
235 gdb_expect {
236 -re "\\$\[0-9\]* = \\{x = 0, t = 0\\}\r\n$gdb_prompt $" { pass "print fint" }
237 -re "$gdb_prompt $" { fail "print fint" }
238 timeout { fail "(timeout) print fint" }
239 }
240
241 send_gdb "print fvpchar\n"
242 gdb_expect {
243 -re "\\$\[0-9\]* = \\{x = 0, t = 0x0\\}\r\n$gdb_prompt $" { pass "print fvpchar" }
244 -re "$gdb_prompt $" { fail "print fvpchar" }
245 timeout { fail "(timeout) print fvpchar" }
246 }
247
248 # Template Foo<T>
249
250 setup_xfail hppa2.0w-*-* CLLbs16092
251 # g++ can't do the template instantiation in debug info trick, so we
252 # fail this because it's not a real type.
253 if {!$hp_aCC_compiler} { setup_xfail *-*-* }
254 send_gdb "ptype Foo\n"
255 gdb_expect {
256 -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" }
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\n$gdb_prompt $" { xfail "ptype Foo" }
258 -re "$gdb_prompt $" { fail "ptype Foo" }
259 timeout { fail "(timeout) ptype Foo" }
260 }
261
262 # ptype Foo<int>
263
264 send_gdb "ptype fint\n"
265 gdb_expect {
266 -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" }
267 -re "$gdb_prompt $" { fail "ptype fint" }
268 timeout { fail "(timeout) ptype fint" }
269 }
270
271 # ptype Foo<char>
272
273 send_gdb "ptype fchar\n"
274 gdb_expect {
275 -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" }
276 -re "$gdb_prompt $" { fail "ptype fchar" }
277 timeout { fail "(timeout) ptype fchar" }
278 }
279
280 # ptype Foo<volatile char *>
281
282 send_gdb "ptype fvpchar\n"
283 gdb_expect {
284 -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" }
285 -re "$gdb_prompt $" { fail "ptype fvpchar" }
286 timeout { fail "(timeout) ptype fvpchar" }
287 }
288
289 # print a function from Foo<volatile char *>
290
291 send_gdb "print Foo<volatile char *>::foo\n"
292 gdb_expect {
293 -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" }
294 -re "$gdb_prompt $" { fail "print Foo<volatile char *>::foo" }
295 timeout { fail "(timeout) print Foo<volatile char *>::foo" }
296 }
297
298 # Template Bar<T, int>
299
300 setup_xfail hppa2.0w-*-* CLLbs16092
301 # same as Foo for g++
302 if {!$hp_aCC_compiler} { setup_xfail *-*-* }
303 send_gdb "ptype Bar\n"
304 gdb_expect {
305 -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" }
306 -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" }
307 -re "$gdb_prompt $" { fail "ptype Bar" }
308 timeout { fail "(timeout) ptype Bar" }
309 }
310
311
312 # ptype Bar<int,33>
313 # stabs screws this test royally.
314 # It thinks it has a badly mangled name.
315 # I blame stabs, the other formats get it right. -djb
316 get_debug_format
317 setup_xfail_format "stabs"
318 send_gdb "ptype bint\n"
319 gdb_expect {
320 -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" }
321 -re "$gdb_prompt $" { fail "ptype bint" }
322 timeout { fail "(timeout) ptype bint" }
323 }
324
325 # ptype Bar<int, (4>3)>
326
327 send_gdb "ptype bint2\n"
328 gdb_expect {
329 -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" }
330 -re "$gdb_prompt $" { fail "ptype bint2" }
331 timeout { fail "(timeout) ptype bint2" }
332 }
333
334 # Template Baz<T, char>
335
336 setup_xfail hppa2.0w-*-* CLLbs16092
337 # Same as Foo, for g++
338 if {!$hp_aCC_compiler} { setup_xfail *-*-* }
339 send_gdb "ptype Baz\n"
340 gdb_expect {
341 -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" }
342 -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" }
343 -re "$gdb_prompt $" { fail "ptype Baz" }
344 timeout { fail "(timeout) ptype Baz" }
345 }
346
347
348 # ptype Baz<int, 's'>
349
350 send_gdb "ptype bazint\n"
351 gdb_expect {
352 -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" }
353 -re "$gdb_prompt $" { fail "ptype bazint" }
354 timeout { fail "(timeout) ptype bazint" }
355 }
356
357 # ptype Baz<char, 'a'>
358
359 send_gdb "ptype bazint2\n"
360 gdb_expect {
361 -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" }
362 -re "$gdb_prompt $" { fail "ptype bazint2" }
363 timeout { fail "(timeout) ptype bazint2" }
364 }
365
366 # Template Qux<T, int (*f)(int) >
367 # Same as Foo for g++
368 if {!$hp_aCC_compiler} {setup_xfail *-*-*}
369 send_gdb "ptype Qux\n"
370 gdb_expect {
371 -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" }
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\\}.*$gdb_prompt $" { pass "ptype Qux" }
373 -re "$gdb_prompt $" { fail "ptype Qux" }
374 timeout { fail "(timeout) ptype Qux" }
375 }
376
377 # pt Qux<int,&string>
378
379 send_gdb "ptype quxint\n"
380 gdb_expect {
381 -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" }
382 -re "$gdb_prompt $" { fail "ptype quxint" }
383 timeout { fail "(timeout) ptype quxint" }
384 }
385
386 # pt Qux<char,0>
387
388 # commented out this as quxint2 declaration was commented out in
389 # templates.exp -- ovidiu
390 # send_gdb "ptype quxint2\n"
391 # gdb_expect {
392 # -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" }
393 # -re "$gdb_prompt $" { fail "ptype quxint2" }
394 # timeout { fail "(timeout) ptype quxint2" }
395 # }
396
397 # Template Spec<T1, T2>
398
399 setup_xfail hppa2.0w-*-* CLLbs16092
400 # Same as Foo for g++
401 if {!$hp_aCC_compiler} { setup_xfail *-*-* }
402 send_gdb "ptype Spec\n"
403 gdb_expect {
404 -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" }
405 -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" }
406 -re "$gdb_prompt $" { fail "ptype Spec" }
407 timeout { fail "(timeout) ptype Spec" }
408 }
409
410 # pt Spec<char,0>
411
412 send_gdb "ptype siip\n"
413 gdb_expect {
414 -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" }
415 -re "$gdb_prompt $" { fail "ptype siip" }
416 timeout { fail "(timeout) ptype siip" }
417 }
418
419 # pt Garply<int>
420
421 send_gdb "ptype Garply<int>\n"
422 gdb_expect {
423 -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>" }
424 -re "$gdb_prompt $" { fail "ptype Garply<int>" }
425 timeout { fail "(timeout) ptype Garply<int>" }
426 }
427
428 # ptype of nested template name
429
430 send_gdb "ptype Garply<Garply<char> >\n"
431 gdb_expect {
432 -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> >" }
433 -re "$gdb_prompt $" { fail "ptype Garply<Garply<char> >" }
434 timeout { fail "(timeout) ptype Garply<Garply<char> >" }
435 }
436
437 # print out a function from a nested template name
438
439 send_gdb "print Garply<Garply<char> >::garply\n"
440 gdb_expect {
441 -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" }
442 -re ".*$gdb_prompt $" { fail "print Garply<Garply<char> >::garply" }
443 timeout { fail "print Garply<Garply<char> >::garply (timeout)" }
444 }
445
446 # djb - 06-03-2000
447 # Now should work fine
448 send_gdb "break Garply<Garply<char> >::garply\n"
449 gdb_expect {
450 -re "Breakpoint \[0-9\]* at $hex: file .*templates.cc, line.*\r\n$gdb_prompt $" { pass "break Garply<Garply<char> >::garply" }
451 -re ".*$gdb_prompt $" { fail "break Garply<Garply<char> >::garply" }
452 timeout { fail "break Garply<Garply<char> >::garply (timeout)" }
453 }
This page took 0.042518 seconds and 5 git commands to generate.