OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.cp/] [templates.exp] - Blame information for rev 157

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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