OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-7.2/] [gdb-7.2-or32-1.0rc1/] [gdb/] [testsuite/] [gdb.cp/] [templates.exp] - Blame information for rev 341

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2007,
2
# 2008, 2009, 2010 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 3 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, see .
16
 
17
# This file was written by Fred Fish. (fnf@cygnus.com)
18
 
19
set ws "\[\r\n\t \]+"
20
 
21
if $tracelevel then {
22
        strace $tracelevel
23
}
24
 
25
if { [skip_cplus_tests] } { continue }
26
 
27
set testfile "templates"
28
set srcfile ${testfile}.cc
29
set binfile ${objdir}/${subdir}/${testfile}
30
 
31
# Create and source the file that provides information about the compiler
32
# used to compile the test case.
33
if [get_compiler_info ${binfile} "c++"] {
34
    return -1
35
}
36
 
37
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
38
     untested templates.exp
39
     return -1
40
}
41
 
42
#
43
#  Test printing of the types of templates.
44
#
45
 
46
proc test_ptype_of_templates {} {
47
    global gdb_prompt
48
    global ws
49
 
50
    gdb_test_multiple "ptype T5" "ptype T5" {
51
        -re "type = class T5 \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}T5 & operator=\\(T5 const ?&\\);${ws}T5\\(int\\);${ws}T5\\((T5 const|const T5) ?&\\);${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 $" {
52
            pass "ptype T5"
53
        }
54
        -re "type = class T5 \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}T5\\(int\\);${ws}T5\\((T5 const|const T5) ?&\\);${ws}~T5\\((void|)\\);${ws}static void \\* operator new\\(unsigned( int| long)?\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}T5 & operator=\\(T5 const ?&\\);${ws}\}\r\n$gdb_prompt $" {
55
            pass "ptype T5"
56
        }
57
        -re "type = class T5 \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}${ws}T5 \\(int\\);${ws}T5 \\(const class T5 &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned int\\);${ws}static void delete \\(void ?\\*\\);${ws}int value \\((void|)\\);${ws}\\}${ws}$gdb_prompt $" {
58
            pass "ptype T5 -- new with unsigned int"
59
        }
60
        -re "type = class T5 \\{.*public:.*static int X;.*int x;.*int val;.*T5 \\(int\\);.*T5 \\(const class T5 &\\);.*void ~T5 \\(int\\);.*static void \\* new \\(unsigned long\\);.*static void delete \\(void ?\\*\\);.*int value \\((void|)\\);.*\\}\r\n$gdb_prompt $" {
61
            pass "ptype T5 -- new with unsigned long"
62
        }
63
        -re "type = class T5 \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5 & operator=\\(T5 const ?&\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\((T5 const|const T5) ?&\\);)|(${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 $" {
64
            pass "ptype T5 (obsolescent gcc or gdb)"
65
        }
66
        -re "type = class T5 \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5 const|const T5) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned( int| long|)\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" {
67
            # This also triggers gdb/1113...
68
            kfail "gdb/1111" "ptype T5"
69
        }
70
    }
71
 
72
    gdb_test_multiple "ptype t5i" "ptype t5i" {
73
        -re "type = class T5 \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5\\(int\\);${ws}T5\\(T5 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 $" {
74
            pass "ptype T5 -- with several fixes from 4.17"
75
        }
76
        -re "type = class T5 \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5 \\(int\\);${ws}T5 \\(const class T5 &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned int\\);${ws}static void delete \\(void ?\\*\\);${ws}int value \\((void|)\\);${ws}\\}\r\n$gdb_prompt $" {
77
            pass "ptype t5i -- new with unsigned int"
78
        }
79
        -re "type = class T5 \\{${ws}public:${ws}static int X;${ws}int x;${ws}int val;\r\n${ws}T5 \\(int\\);${ws}T5 \\(const class T5 &\\);${ws}void ~T5 \\(int\\);${ws}static void \\* new \\(unsigned long\\);${ws}static void delete \\(void ?\\*\\);${ws}int value \\((void|)\\);${ws}\\}\r\n$gdb_prompt $" {
80
            pass "ptype t5i -- new with unsigned long"
81
        }
82
        -re "type = class T5 \{.*public:.*static int X;.*int x;.*int val;.*.*T5 \\(int\\);.*.*void ~T5 \\(int\\).*.*.*int value \\((void|)\\);.*\}.*$gdb_prompt $" {
83
            pass "ptype t5i"
84
        }
85
        -re "type = class T5 \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}T5 & operator=\\(T5 const ?&\\);${ws}T5\\(int\\);${ws}T5\\((T5 const|const T5) ?&\\);${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 $" {
86
            pass "ptype t5i"
87
        }
88
        -re "type = class T5 \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}T5\\(int\\);${ws}T5\\((T5 const|const T5) ?&\\);${ws}~T5\\((void|)\\);${ws}static void \\* operator new\\(unsigned( int| long)?\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}T5 & operator=\\(T5 const ?&\\);${ws}\}\r\n$gdb_prompt $" {
89
            pass "ptype t5i"
90
        }
91
        -re "type = class T5 \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;((${ws}T5 & operator=\\(T5 const ?&\\);)|(${ws}T5\\(int\\);)|(${ws}T5\\(T5 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 $" {
92
            pass "ptype t5i (obsolescent gcc or gdb)"
93
        }
94
        -re "type = class T5 \{${ws}public:${ws}static int X;${ws}int x;${ws}int val;${ws}void T5\\(int\\);${ws}void T5\\((T5 const|const T5) ?&\\);${ws}~T5\\(int\\);${ws}static void \\* operator new\\(unsigned( int| long|)\\);${ws}static void operator delete\\(void ?\\*\\);${ws}int value\\((void|)\\);${ws}\}\r\n$gdb_prompt $" {
95
            # This also triggers gdb/1113...
96
            kfail "gdb/1111" "ptype T5"
97
        }
98
    }
99
}
100
 
101
#
102
#  Test breakpoint setting on template methods.
103
#
104
 
105
proc test_template_breakpoints {} {
106
    global gdb_prompt
107
    global testfile
108
    global srcdir
109
    global hp_aCC_compiler
110
 
111
    gdb_test_multiple "break T5::T5" "constructor breakpoint" {
112
        -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. T5::T5\\(int\\) at .*\[\r\n\]*.3. T5::T5\\((T5 const|const T5) ?&\\) at .*\[\r\n\]*> $" {
113
            gdb_test "0" \
114
                "canceled" \
115
                "constructor breakpoint (obsolete format!)"
116
        }
117
        -re ".0. cancel\[\r\n\]*.1. all\[\r\n\]*.2. T5::T5\\((T5 const|const T5) ?&\\) at .*templates.cc:.*\[\r\n\]*.3. T5::T5\\(int\\) at .*templates.cc:.*\[\r\n\]*> $" {
118
            gdb_test "0" \
119
                "canceled" \
120
                "constructor breakpoint"
121
        }
122
        -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. T5 at .*\[\r\n\]*.3. T5 at .*\[\r\n\]*> $" {
123
            setup_kfail "gdb/1062" "*-*-*"
124
            gdb_test "0" \
125
                "nonsense intended to insure that this test fails" \
126
                "constructor breakpoint"
127
        }
128
        -re ".*\n> $" {
129
            gdb_test "0" \
130
                    "nonsense intended to insure that this test fails" \
131
                    "constructor breakpoint (bad menu choices)"
132
        }
133
    }
134
 
135
# See CLLbs14792
136
    if {$hp_aCC_compiler} {setup_xfail hppa*-*-* CLLbs14792}
137
 
138
    gdb_test_multiple "break T5::~T5" "destructor_breakpoint" {
139
        -re "Breakpoint.*at.* file .*${testfile}.cc, line.*$gdb_prompt $"
140
        {
141
            pass "destructor breakpoint"
142
        }
143
        -re "the class `T5' does not have destructor defined\r\nHint: try 'T5::~T5 or 'T5::~T5\r\n\\(Note leading single quote.\\)\r\n$gdb_prompt $"
144
        {
145
            kfail "gdb/1112" "destructor breakpoint"
146
        }
147
    }
148
 
149
    gdb_test "break T5::value" \
150
        "Breakpoint.*at.* file .*${testfile}.cc, line.*" \
151
        "value method breakpoint"
152
 
153
    set bp_location [gdb_get_line_number \
154
                         "set breakpoint on a line with no real code"]
155
    gdb_test "break ${testfile}.cc:${bp_location}" \
156
        "Breakpoint.*at.* file .*${testfile}.cc, line.*(2 locations).*" \
157
        "breakpoint on a line with no real code"
158
    delete_breakpoints
159
}
160
 
161
#
162
#  Test calling of template methods.
163
#
164
 
165
proc test_template_calls {} {
166
    global gdb_prompt
167
    global hp_aCC_compiler
168
 
169
    if [target_info exists gdb,cannot_call_functions] {
170
        setup_xfail "*-*-*" 2416
171
        fail "This target can not call functions"
172
        return
173
    }
174
 
175
    if {!$hp_aCC_compiler} {setup_xfail hppa*-*-*}
176
    gdb_test_multiple "print t5i.value()" "print t5i.value()" {
177
        -re ".* = 2\[\r\n\]*$gdb_prompt $" {
178
            pass "print t5i.value()"
179
        }
180
        -re "Cannot invoke functions on this machine.*$gdb_prompt $" {
181
            fail "print t5i.value()"
182
        }
183
        -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
184
            setup_xfail hppa*-*-* CLLbs16899
185
            xfail "print t5i.value"
186
        }
187
    }
188
}
189
 
190
proc test_template_typedef {} {
191
 
192
    gdb_test "print intBazOne::baz" ".*baz\\(int, int\\)>" \
193
        "print method of template typedef"
194
 
195
    gdb_test "print intBazOne::~Baz" ".*~Baz(\\(\\))?>" \
196
        "print destructor of template typedef"
197
}
198
 
199
proc do_tests {} {
200
    global subdir
201
    global objdir
202
    global srcdir
203
    global binfile
204
    global gdb_prompt
205
 
206
 
207
    # Start with a fresh gdb.
208
 
209
    gdb_exit
210
    gdb_start
211
    gdb_reinitialize_dir $srcdir/$subdir
212
    gdb_load $binfile
213
 
214
    # Change multiple-symbols to "ask" in order to get the multiple-choice
215
    # menu when breaking on overloaded methods.
216
    gdb_test_no_output "set multiple-symbols ask"
217
 
218
    runto_main
219
 
220
    test_ptype_of_templates
221
    test_template_breakpoints
222
    test_template_typedef
223
 
224
    if [ runto_main] {
225
        test_template_calls
226
    }
227
}
228
 
229
do_tests
230
 
231
 
232
# More tests for different kinds of template parameters,
233
# templates with partial specializations, nested templates, etc.
234
# These have been tested only with HP aCC.  They probably won't
235
# work with other compilers because of differences in mangling
236
# schemes.
237
# Added by Satish Pai  1997-09-25
238
# As of 2000-06-03, C++ support has been improved to the point that g++ can
239
# pass all of theses, excluding what appears to be one that exposes a stabs bug. - djb
240
 
241
# I don't know how HP could be passing these tests without this. They
242
# weren't breakpointing past a point where the below expressions were
243
# initialized in the actual source. - djb
244
 
245
gdb_test "b 770" \
246
    "Breakpoint .* at .*, line 770."
247
 
248
gdb_test "c" \
249
    "Continuing.*Breakpoint .*" \
250
    "continue to line 770"
251
 
252
gdb_test "print fint" \
253
   "\\$\[0-9\]* = \\{x = 0, t = 0\\}"
254
 
255
gdb_test "print fvpchar" \
256
    "\\$\[0-9\]* = \\{x = 0, t = 0x0\\}"
257
 
258
# Template Foo
259
 
260
# Neither stabs nor DWARF-2 contains type information about templates
261
# (as opposed to instantiations of templates), so in those
262
# circumstances we expect GDB to not find a symbol.  HP has a debug
263
# format that contains more info, though, so it's also correct to
264
# print out template info.  (This affects several subsequent tests as
265
# well.)
266
 
267
# NOTE: carlton/2003-02-26: However, because of a bug in the way GDB
268
# handles nested types, we don't get this right in the DWARF-2 case.
269
 
270
gdb_test_multiple "ptype Foo" "ptype Foo" {
271
    -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\r\n\[ \t\]*(class |)Foo\r\n\[ \t\]*(class |)Foo\r\n$gdb_prompt $" {
272
        pass "ptype Foo"
273
    }
274
    -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 $" {
275
        xfail "ptype Foo"
276
    }
277
    -re "type = class Foo \\{\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 $" {
278
        # GCC 3.1, DWARF-2 output.
279
        kfail "gdb/57" "ptype Foo"
280
    }
281
    -re "No symbol \"Foo\" in current context.\r\n$gdb_prompt $" {
282
        # GCC 2.95.3, stabs+ output.
283
        pass "ptype Foo"
284
    }
285
}
286
 
287
#    -re "type = class Foo \\{\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 $"
288
 
289
# ptype Foo
290
 
291
gdb_test_multiple "ptype fint" "ptype fint" {
292
    -re "type = (class |)Foo \\{\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 $" {
293
        pass "ptype fint"
294
    }
295
    -re "type = (class |)Foo \\{\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 $" {
296
        pass "ptype fint"
297
    }
298
}
299
 
300
# ptype Foo
301
 
302
gdb_test_multiple "ptype fchar" "ptype fchar" {
303
    -re "type = (class |)Foo \\{\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 $" {
304
        pass "ptype fchar"
305
    }
306
   -re "type = (class |)Foo \\{\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 $" {
307
       pass "ptype fchar"
308
   }
309
}
310
 
311
# ptype Foo
312
 
313
gdb_test_multiple "ptype fvpchar" "ptype fvpchar" {
314
    -re "type = (class |)Foo \\{\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 $" {
315
        pass "ptype fvpchar"
316
    }
317
    -re "type = (class |)Foo \\{\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 $" {
318
        pass "ptype fvpchar"
319
    }
320
    -re "type = (class |)Foo \\{\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 $" {
321
        kfail "gdb/1512" "ptype fvpchar"
322
    }
323
}
324
 
325
# print a function from Foo
326
 
327
# This test is sensitive to whitespace matching, so we'll do it twice,
328
# varying the spacing, because of PR gdb/33.
329
 
330
gdb_test_multiple "print Foo::foo" "print Foo::foo" {
331
    -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<(volatile char|char volatile) ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex ::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" {
332
        pass "print Foo::foo"
333
    }
334
    -re "No symbol \"Foo\" in current context.\r\n$gdb_prompt $" {
335
        # This used to be a kfail gdb/33 and then kfail gdb/931.
336
        fail "print Foo::foo"
337
    }
338
}
339
 
340
gdb_test_multiple "print Foo::foo" "print Foo::foo" {
341
    -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<(volatile char|char volatile) ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex ::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" {
342
        pass "print Foo::foo"
343
    }
344
    -re "No symbol \"Foo\" in current context.\r\n$gdb_prompt $" {
345
        # This used to be a kfail gdb/33 and then kfail gdb/931.
346
        fail "print Foo::foo"
347
    }
348
}
349
 
350
# Template Bar
351
 
352
# same as Foo for g++
353
gdb_test_multiple "ptype Bar" "ptype Bar" {
354
    -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\r\n\[ \t\]*(class |)Bar\r\n$gdb_prompt $" {
355
        pass "ptype Bar"
356
    }
357
    -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 $" {
358
        xfail "ptype Bar"
359
    }
360
    -re "ptype Bar\r\ntype = class Bar {\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 $" {
361
        # GCC 3.1, DWARF-2 output.
362
        kfail "gdb/57" "ptype Bar"
363
    }
364
    -re "No symbol \"Bar\" in current context.\r\n$gdb_prompt $" {
365
        # GCC 2.95.3, stabs+ output.
366
        pass "ptype Bar"
367
    }
368
}
369
 
370
 
371
# ptype Bar
372
 
373
gdb_test_multiple "ptype bint" "ptype bint" {
374
    -re "type = (class |)Bar \\{\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 $" {
375
        pass "ptype bint"
376
    }
377
    -re "type = (class |)Bar \\{\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 $" {
378
        pass "ptype bint"
379
    }
380
}
381
 
382
# ptype Bar3)>
383
 
384
gdb_test_multiple "ptype bint2" "ptype bint2" {
385
    -re "type = (class |)Bar \\{\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 $" {
386
        pass "ptype bint2"
387
    }
388
    -re "type = (class |)Bar \\{\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 $" {
389
        pass "ptype bint2"
390
    }
391
}
392
 
393
# Template Baz
394
 
395
# Same as Foo, for g++
396
gdb_test_multiple "ptype Baz" "ptype Baz" {
397
    -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\r\n\[ \t\]*(class |)Baz\r\n$gdb_prompt $" {
398
        pass "ptype Baz"
399
    }
400
    -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 $" {
401
        xfail "ptype Baz"
402
    }
403
    -re "type = class Baz {\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 $" {
404
        # GCC 3.1, DWARF-2 output.
405
        kfail "gdb/57" "ptype Baz"
406
    }
407
    -re "type = class Baz {\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 $" {
408
        # GCC 3.x, DWARF-2 output, running into gdb/57 and gdb/1512.
409
        kfail "gdb/57" "ptype Baz"
410
    }
411
    -re "No symbol \"Baz\" in current context.\r\n$gdb_prompt $" {
412
        # GCC 2.95.3, stabs+ output.
413
        pass "ptype Baz"
414
    }
415
}
416
 
417
 
418
# ptype Baz
419
 
420
gdb_test_multiple "ptype bazint" "ptype bazint" {
421
    -re "type = (class |)Baz \\{\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 $" {
422
        pass "ptype bazint"
423
    }
424
   -re "type = (class |)Baz \\{\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 $" {
425
       pass "ptype bazint"
426
   }
427
}
428
 
429
# ptype Baz
430
 
431
gdb_test_multiple "ptype bazint2" "ptype bazint2" {
432
    -re "type = (class |)Baz \\{\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 $" {
433
        pass "ptype bazint2"
434
    }
435
    -re "type = (class |)Baz \\{\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 $" {
436
        pass "ptype bazint2"
437
    }
438
}
439
 
440
# Template Qux
441
# Same as Foo for g++
442
gdb_test_multiple "ptype Qux" "ptype Qux" {
443
    -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\r\n\[ \t\]*(class |)Qux\r\n$gdb_prompt $" {
444
        pass "ptype Qux"
445
    }
446
    -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 $" {
447
        pass "ptype Qux"
448
    }
449
    -re "type = class Qux {\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 $" {
450
        # GCC 3.1, DWARF-2 output.
451
        kfail "gdb/57" "ptype Qux"
452
    }
453
    -re "type = class Qux {\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 $" {
454
        # GCC 3.x, DWARF-2 output; gdb/57 + gdb/1512.
455
        kfail "gdb/57" "ptype Qux"
456
    }
457
    -re "No symbol \"Qux\" in current context.\r\n$gdb_prompt $" {
458
        # GCC 2.95.3, stabs+ output.
459
        pass "ptype Qux"
460
    }
461
}
462
 
463
# pt Qux
464
 
465
gdb_test_multiple "ptype quxint" "ptype quxint" {
466
    -re "type = class Qux \\{\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 $" {
467
        pass "ptype quxint"
468
    }
469
    -re "type = class Qux \\{\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 $" {
470
        pass "ptype quxint"
471
    }
472
    -re "type = class Qux \\{\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 $" {
473
        pass "ptype quxint"
474
    }
475
    -re "type = class Qux \\{\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 $" {
476
        kfail "gdb/1512" "ptype quxint"
477
    }
478
}
479
 
480
 
481
# Template Spec
482
 
483
# Same as Foo for g++
484
gdb_test_multiple "ptype Spec" "ptype Spec" {
485
    -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\r\n\[ \t\]*(class |)Spec\r\n$gdb_prompt $" {
486
        pass "ptype Spec"
487
    }
488
    -re "type = <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" {
489
        xfail "ptype Spec"
490
    }
491
    -re "type = class Spec {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(char\\);\r\n}\r\n$gdb_prompt $" {
492
        # GCC 3.1, DWARF-2 output.
493
        kfail "gdb/57" "ptype Spec"
494
    }
495
    -re "No symbol \"Spec\" in current context.\r\n$gdb_prompt $" {
496
        # GCC 2.95.3, stabs+ output.
497
        pass "ptype Spec"
498
    }
499
}
500
 
501
# pt Spec
502
 
503
gdb_test_multiple "ptype siip" "ptype siip" {
504
    -re "type = class Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*.*int spec\\(int ?\\*\\);\r\n\\}\r\n$gdb_prompt $" {
505
        pass "ptype siip"
506
    }
507
    -re "type = class Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(int ?\\*\\);.*\r\n\\}\r\n$gdb_prompt $" {
508
        pass "ptype siip"
509
    }
510
}
511
 
512
# pt Garply
513
 
514
gdb_test_multiple "ptype Garply" "ptype Garply" {
515
    -re "type = class Garply \\{\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 $" {
516
        pass "ptype Garply"
517
    }
518
    -re "type = class Garply \\{\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 $" {
519
        pass "ptype Garply"
520
    }
521
}
522
 
523
# ptype of nested template name
524
 
525
gdb_test_multiple "ptype Garply >" "ptype Garply >" {
526
    -re "type = (class |)Garply > \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*(class |)Garply t;\r\n\r\n\[ \t\]*.*(class |)Garply garply\\(int, (class |)Garply\\);\r\n\\}\r\n$gdb_prompt $" {
527
        pass "ptype Garply >"
528
    }
529
    -re "type = (class |)Garply > \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*(class |)Garply t;\r\n\r\n\[ \t\]*(class |)Garply garply\\(int, (class |)Garply\\);.*\r\n\\}\r\n$gdb_prompt $" {
530
        pass "ptype Garply >"
531
    }
532
}
533
 
534
# print out a function from a nested template name
535
 
536
gdb_test "print Garply >::garply" \
537
    "\\$\[0-9\]* = \\{(class |)Garply \\((class |)Garply > \\*(| const), int, (class |)Garply\\)\\} $hex \[ \t\]*>::garply\\(int, (class |)Garply\\)>" \
538
    "print Garply >::garply"
539
 
540
# djb - 06-03-2000
541
# Now should work fine
542
gdb_test "break Garply >::garply" \
543
    "Breakpoint \[0-9\]* at $hex: file .*templates.cc, line.*"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.