*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / virtfunc.exp
CommitLineData
116f09e7 1# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004
b6ba6518 2# Free Software Foundation, Inc.
c906108c
SS
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18# Please email any bugs, comments, and/or additions to this file to:
19# bug-gdb@prep.ai.mit.edu
20
21# This file was written by Fred Fish. (fnf@cygnus.com)
51615d72 22# And rewritten by Michael Chastain <mec.gnu@mindspring.com>.
c906108c
SS
23
24set ws "\[\r\n\t \]+"
25set nl "\[\r\n\]+"
26
27if $tracelevel then {
51615d72 28 strace $tracelevel
c906108c
SS
29}
30
d4f3574e
SS
31if { [skip_cplus_tests] } { continue }
32
c906108c
SS
33set testfile "virtfunc"
34set srcfile ${testfile}.cc
35set binfile ${objdir}/${subdir}/${testfile}
36
f2dd3617 37if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {c++ debug}] != "" } {
c906108c
SS
38 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
39}
40
51615d72
MC
41# Test ptype of class objects.
42#
43# Different C++ compilers produce different output. I build up regular
44# expressions piece by piece to accommodate all the compilers that I
45# have seen: gcc 2.95.3, gcc 3.3.2 (ABI 1), gcc 3.4 prerelease (ABI 2);
46# and all the debug formats I have seen: dwarf-2 and stabs+.
47#
48# A complicated class declaration looks like this:
49#
50# class A : public virtual V { // re_class
51# private:
52# V * _vb$V; // re_vbptr
53# int a; // re_fields
54#
55# public:
56# A & operator=(A const &); // re_synth_gcc_2
57# A(int, A const &); // ...
58# A(int); // ...
59# virtual int f(void); // re_methods
60# }
61#
62# RE_CLASS matches the class declaration. C++ allows multiple ways of
63# expressing this.
64#
65# struct ... { private: ... };
66# class ... { private: ... };
67# class ... { ... };
68#
69# RE_VBPTR matches the virtual base declarations. gcc 2.95.3 emits
70# these, but gcc 3.X.Y does not. The name depends on the debug format.
c906108c 71#
51615d72
MC
72# RE_FIELDS matches the data fields of the class.
73# RE_METHODS matches the methods explicitly declared for the class.
c906108c 74#
51615d72
MC
75# RE_SYNTH_GCC_2 and RE_SYNTH_GCC_3 match the optional synthetic methods
76# of the class. gcc -gstabs+ emits these methods, and gcc -gdwarf-2
77# does not.
78#
79# RE_ALL_METHODS combines RE_METHODS and the optional synthetic methods.
80# Up to gcc 3.3.X, gcc defaults to gcc ABI 1, with synthetic methods at
81# the beginning. Starting with gcc 3.4.X, gcc defaults to gcc ABI 2,
82# with synthetic methods at the end.
83#
84# So the possible choices for RE_ALL_METHODS are:
85#
86# RE_METHODS // any gcc with dwarf-2
87# RE_SYNTH_GCC_2|RE_METHODS // gcc 2.95.3, stabs+
88# RE_SYNTH_GCC_3|RE_METHODS // gcc 3.3.2, stabs+
89# RE_METHODS|RE_SYNTH_GCC_3 // gcc 3.4.0, stabs+
90#
91# When I get HP-UX aCC, I hope that I can just add RE_SYNTH_ACC_FOO
92# and enlarge RE_ALL_METHODS.
93#
94# Yet another twist: with gcc v2, ctor and dtor methods have a hidden
95# argument in front, the "in-charge" flag. With gcc v3, there is no
96# hidden argument; instead, there are multiple object functions for
97# each ctor and dtor.
98#
99# I use gdb_test_multiple with only one arm. I could use gdb_test,
100# but gdb_test_multiple makes it easier to add KFAIL arms as needed.
101#
102# -- chastain 2003-12-31
c906108c
SS
103
104proc test_ptype_of_classes {} {
105 global gdb_prompt
106 global ws
107 global nl
108
51615d72
MC
109 # class VA
110
111 set re_class "((struct|class) VA \{${ws}public:|struct VA \{)"
112 set re_fields "int va;"
113 set re_synth_gcc_23 "VA & operator=\\(VA const ?&\\);${ws}VA\\(VA const ?&\\);${ws}VA\\((void|)\\);"
114 set re_all_methods "(|$re_synth_gcc_23)"
115
116 gdb_test_multiple "ptype VA" "ptype VA" {
117 -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\}$nl$gdb_prompt $" {
c906108c
SS
118 pass "ptype VA"
119 }
c906108c
SS
120 }
121
51615d72
MC
122 # class VB
123
124 set re_class "((struct|class) VB \{${ws}public:|struct VB \{)"
125 set re_fields "int vb;"
126 set re_methods "int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);"
127 set re_synth_gcc_23 "VB & operator=\\(VB const ?&\\);${ws}VB\\(VB const ?&\\);${ws}VB\\((void|)\\);"
128 set re_all_methods "($re_methods|$re_methods${ws}$re_synth_gcc_23|$re_synth_gcc_23${ws}$re_methods)"
129
130 gdb_test_multiple "ptype VB" "ptype VB" {
131 -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\}$nl$gdb_prompt $" {
c906108c
SS
132 pass "ptype VB"
133 }
c906108c
SS
134 }
135
51615d72
MC
136 # An instance of VB
137
138 gdb_test_multiple "ptype vb" "ptype vb" {
139 -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\}$nl$gdb_prompt $" {
140 pass "ptype vb"
c906108c
SS
141 }
142 }
143
51615d72 144 # An instance of VB *
c2d11a7d 145
51615d72
MC
146 gdb_test_multiple "ptype pVB" "ptype pVB" {
147 -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\} \\*$nl$gdb_prompt $" {
148 pass "ptype pVB"
c906108c
SS
149 }
150 }
151
51615d72 152 # class V
c906108c 153
51615d72
MC
154 set re_class "class V : public VA, public VB \{${ws}public:"
155 set re_fields "int w;"
156 set re_methods "int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);"
157 set re_synth_gcc_23 "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);"
158 set re_all_methods "($re_methods|$re_methods${ws}$re_synth_gcc_23|$re_synth_gcc_23${ws}$re_methods)"
c906108c 159
51615d72
MC
160 gdb_test_multiple "ptype V" "ptype V" {
161 -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\}$nl$gdb_prompt $" {
162 pass "ptype V"
c906108c
SS
163 }
164 }
165
51615d72 166 # An instance of V
c906108c 167
51615d72
MC
168 gdb_test_multiple "ptype v" "ptype v" {
169 -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\}$nl$gdb_prompt $" {
170 pass "ptype v"
c906108c
SS
171 }
172 }
173
51615d72 174 # An instance of V *
c906108c 175
51615d72
MC
176 gdb_test_multiple "ptype pVa" "ptype pVa" {
177 -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\} \\*$nl$gdb_prompt $" {
178 pass "ptype pVa"
c906108c
SS
179 }
180 }
181
51615d72 182 # An instance of V *
c906108c 183
51615d72
MC
184 gdb_test_multiple "ptype pVv" "ptype pVv" {
185 -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\} \\*$nl$gdb_prompt $" {
186 pass "ptype pVv"
c906108c
SS
187 }
188 }
189
51615d72 190 # An instance of V *
c906108c 191
51615d72
MC
192 gdb_test_multiple "ptype pVe" "ptype pVe" {
193 -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\} \\*$nl$gdb_prompt $" {
194 pass "ptype pVe"
c906108c
SS
195 }
196 }
197
51615d72 198 # An instance of V *
c906108c 199
51615d72
MC
200 gdb_test_multiple "ptype pVd" "ptype pVd" {
201 -re "type = $re_class${ws}$re_fields${ws}(public:${ws}|)$re_all_methods$nl\} \\*$nl$gdb_prompt $" {
202 pass "ptype pVd"
c906108c
SS
203 }
204 }
205
51615d72
MC
206 # class A
207
208 set re_class "class A : public virtual V \{(${ws}private:|)"
209 set re_vbptr "V \\*(_vb.1V|_vb.V);"
210 set re_fields "int a;"
211 set re_methods "virtual int f\\((void|)\\);"
212 # gcc 2 adds an "in-charge" arg to the ctor.
213 set re_synth_gcc_2 "A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);"
214 set re_synth_gcc_3 "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\(\\);"
215 set re_all_methods "($re_methods|$re_synth_gcc_2${ws}$re_methods|$re_synth_gcc_3${ws}$re_methods|$re_methods${ws}$re_synth_gcc_3)"
216
217 gdb_test_multiple "ptype A" "ptype A" {
218 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)${re_fields}${ws}public:${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" {
219 pass "ptype A"
c906108c
SS
220 }
221 }
222
51615d72
MC
223 # An instance of A
224
225 gdb_test_multiple "ptype a" "ptype a" {
226 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)${re_fields}${ws}public:${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" {
227 pass "ptype a"
c906108c
SS
228 }
229 }
230
51615d72
MC
231 # An instance of A *
232
233 gdb_test_multiple "ptype pAa" "ptype pAa" {
234 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)${re_fields}${ws}public:${ws}${re_all_methods}$nl\} \\*$nl$gdb_prompt $" {
5178b9d6
DJ
235 pass "ptype pAa"
236 }
c906108c
SS
237 }
238
51615d72
MC
239 # An instance of A *
240
241 gdb_test_multiple "ptype pAe" "ptype pAe" {
242 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)${re_fields}${ws}public:${ws}${re_all_methods}$nl\} \\*$nl$gdb_prompt $" {
5178b9d6
DJ
243 pass "ptype pAe"
244 }
c906108c
SS
245 }
246
51615d72 247 # class B
c906108c 248
51615d72
MC
249 set re_class "class B : public A \{(${ws}private:|)"
250 set re_vbptr "V \\*(_vb.1V|_vb.V);"
251 set re_fields "int b;"
252 set re_methods "virtual int f\\((void|)\\);"
253 set re_synth_gcc_2 "B & operator=\\(B const ?&\\);${ws}B\\(int, B const ?&\\);${ws}B\\(int\\);"
254 set re_synth_gcc_3 "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\(\\);"
255 set re_all_methods "($re_methods|$re_synth_gcc_2${ws}$re_methods|$re_synth_gcc_3${ws}$re_methods|$re_methods${ws}$re_synth_gcc_3)"
c906108c 256
51615d72
MC
257 gdb_test_multiple "ptype B" "ptype B" {
258 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)${re_fields}${ws}public:${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" {
259 pass "ptype B"
c906108c
SS
260 }
261 }
262
51615d72
MC
263 # An instance of B
264
265 gdb_test_multiple "ptype b" "ptype b" {
266 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)${re_fields}${ws}public:${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" {
267 pass "ptype b"
c906108c
SS
268 }
269 }
270
51615d72
MC
271 # An instance of B *
272
273 gdb_test_multiple "ptype pBe" "ptype pBe" {
274 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)${re_fields}${ws}public:${ws}${re_all_methods}$nl\} \\*$nl$gdb_prompt $" {
275 pass "ptype pBe"
c906108c
SS
276 }
277 }
278
51615d72
MC
279 # class C
280
281 set re_class "class C : public virtual V \{(${ws}private:|)"
282 set re_vbptr "V \\*(_vb.1V|_vb.V);"
283 set re_fields "int c;"
284 set re_synth_gcc_2 "C & operator=\\(C const ?&\\);${ws}C\\(int, C const ?&\\);${ws}C\\(int\\);"
285 set re_synth_gcc_3 "C & operator=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\(\\);"
286 set re_all_methods "(|$re_synth_gcc_2|$re_synth_gcc_3)"
287
288 gdb_test_multiple "ptype C" "ptype C" {
289 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}(public:${ws}|)${re_all_methods}$nl\}$nl$gdb_prompt $" {
290 pass "ptype C"
c906108c
SS
291 }
292 }
293
51615d72
MC
294 # An instance of C
295
296 gdb_test_multiple "ptype c" "ptype c" {
297 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}(public:${ws}|)${re_all_methods}$nl\}$nl$gdb_prompt $" {
298 pass "ptype c"
c906108c
SS
299 }
300 }
301
51615d72
MC
302 # class AD
303
304 set re_class "((struct|class) AD \{${ws}public:|struct AD \{)"
305 set re_methods "virtual int vg\\((void|)\\);"
306 set re_synth_gcc_23 "AD & operator=\\(AD const ?&\\);${ws}AD\\(AD const ?&\\);${ws}AD\\((void|)\\);"
307 set re_all_methods "($re_methods|$re_methods${ws}$re_synth_gcc_23|$re_synth_gcc_23${ws}$re_methods)"
308
309 gdb_test_multiple "ptype AD" "ptype AD" {
310 -re "type = $re_class${ws}$re_all_methods$nl\}$nl$gdb_prompt $" {
311 pass "ptype AD"
c906108c
SS
312 }
313 }
314
51615d72
MC
315 # An instance of AD *
316 # TODO: this should be named pADd, not pAd.
317
318 gdb_test_multiple "ptype pAd" "ptype pAd" {
319 -re "type = $re_class${ws}$re_all_methods$nl\} \\*$nl$gdb_prompt $" {
320 pass "ptype pAd"
c906108c
SS
321 }
322 }
323
51615d72
MC
324 # An instance of a AD *
325
326 gdb_test_multiple "ptype pADe" "ptype pADe" {
327 -re "type = $re_class${ws}$re_all_methods$nl\} \\*$nl$gdb_prompt $" {
328 pass "ptype pADe"
c906108c
SS
329 }
330 }
c906108c 331
51615d72 332 # class D
116f09e7
MC
333 #
334 # I wrote this differently from the others to avoid a problem with
335 # the sourceware version of expect, which dates from 1998.
336 # The bug manifests as ERROR/UNRESOLVED results after an "eof"
337 # in gdb_test_multiple.
338 #
339 # -- chastain 2004-01-01
c906108c 340
51615d72
MC
341 set re_class "class D : public AD, public virtual V \{(${ws}private:|)"
342 set re_vbptr "V \\*(_vb.1V|_vb.V);"
343 set re_fields "int d;"
116f09e7
MC
344 set re_methods_2 "static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);"
345 set re_methods_3 "static void s\\(\\);${ws}virtual int vg\\(\\);${ws}virtual int vd\\(\\);${ws}int fd\\(\\);"
51615d72
MC
346 set re_synth_gcc_2 "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);"
347 set re_synth_gcc_3 "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);"
116f09e7 348 set re_all_methods "($re_methods_2|$re_methods_3|$re_synth_gcc_2${ws}$re_methods_2|$re_synth_gcc_3${ws}$re_methods_3|$re_methods${ws}$re_synth_gcc_3)"
c906108c 349
51615d72
MC
350 gdb_test_multiple "ptype D" "ptype D" {
351 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" {
352 pass "ptype D"
a0b3c4fd 353 }
c906108c
SS
354 }
355
51615d72 356 # An instance of D
c906108c 357
51615d72
MC
358 gdb_test_multiple "ptype d" "ptype d" {
359 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" {
360 pass "ptype d"
a0b3c4fd 361 }
c906108c
SS
362 }
363
51615d72
MC
364 # An instance of D
365
366 gdb_test_multiple "ptype dd" "ptype dd" {
367 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" {
368 pass "ptype dd"
a0b3c4fd 369 }
c906108c
SS
370 }
371
51615d72
MC
372 # An instance of D *
373
374 gdb_test_multiple "ptype ppd" "ptype ppd" {
375 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}${re_all_methods}$nl\} \\*$nl$gdb_prompt $" {
376 pass "ptype ppd"
a0b3c4fd 377 }
c906108c
SS
378 }
379
51615d72
MC
380 # An instance of D *
381
382 gdb_test_multiple "ptype pDd" "ptype pDd" {
383 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}${re_all_methods}$nl\} \\*$nl$gdb_prompt $" {
384 pass "ptype pDd"
a0b3c4fd 385 }
c906108c
SS
386 }
387
51615d72
MC
388 # An instance of D *
389
390 gdb_test_multiple "ptype pDe" "ptype pDe" {
391 -re "type = ${re_class}${ws}(${re_vbptr}${ws}|)public:${ws}${re_fields}${ws}${re_all_methods}$nl\} \\*$nl$gdb_prompt $" {
392 pass "ptype pDe"
a0b3c4fd 393 }
c906108c
SS
394 }
395
51615d72
MC
396 # class E
397 # TODO: E does not show a vbptr for V. That seems strange.
398
399 set re_class "class E : public B, public virtual V, public D, public C \{(${ws}private:|)"
400 set re_fields "int e;"
401 set re_methods "virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);"
402 set re_synth_gcc_2 "E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);"
403 set re_synth_gcc_3 "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\(\\);"
404 set re_all_methods "($re_methods|$re_synth_gcc_2${ws}$re_methods|$re_synth_gcc_3${ws}$re_methods|$re_methods${ws}$re_synth_gcc_3)"
405
406 gdb_test_multiple "ptype E" "ptype E" {
407 -re "type = ${re_class}${ws}public:${ws}${re_fields}${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" {
408 pass "ptype E"
a0b3c4fd 409 }
c906108c
SS
410 }
411
51615d72
MC
412 # An instance of E
413
414 gdb_test_multiple "ptype e" "ptype e" {
415 -re "type = ${re_class}${ws}public:${ws}${re_fields}${ws}${re_all_methods}$nl\}$nl$gdb_prompt $" {
416 pass "ptype e"
a0b3c4fd 417 }
c906108c
SS
418 }
419
51615d72
MC
420 # An instance of E *
421
422 gdb_test_multiple "ptype pEe" "ptype pEe" {
423 -re "type = ${re_class}${ws}public:${ws}${re_fields}${ws}${re_all_methods}$nl\} \\*$nl$gdb_prompt $" {
424 pass "ptype pEe"
a0b3c4fd 425 }
c906108c 426 }
51615d72 427}
c906108c 428
51615d72
MC
429# Call virtual functions.
430
431proc test_virtual_calls {} {
432 global gdb_prompt
433 global nl
434
435 if [target_info exists gdb,cannot_call_functions] {
436 setup_xfail "*-*-*" 2416
437 fail "This target can not call functions"
438 return 0
c906108c
SS
439 }
440
51615d72
MC
441 gdb_test "print pAe->f()" "\\$\[0-9\]+ = 20"
442 gdb_test "print pAa->f()" "\\$\[0-9\]+ = 1"
443 gdb_test "print pDe->vg()" "\\$\[0-9\]+ = 202"
444 gdb_test "print pADe->vg()" "\\$\[0-9\]+ = 202"
445 gdb_test "print pDd->vg()" "\\$\[0-9\]+ = 101"
446 gdb_test "print pEe->vvb()" "\\$\[0-9\]+ = 411"
447 gdb_test "print pVB->vvb()" "\\$\[0-9\]+ = 407"
448 gdb_test "print pBe->vvb()" "\\$\[0-9\]+ = 411"
449 gdb_test "print pDe->vvb()" "\\$\[0-9\]+ = 411"
450 gdb_test "print pEe->vd()" "\\$\[0-9\]+ = 282"
451 gdb_test "print pEe->fvb()" "\\$\[0-9\]+ = 311"
452
ac57ea44
MC
453 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
454 # gdb=HEAD%2002-02-16, gcc=2.95.3, goption=-gdwarf-2.
455 #
456 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
457 # gdb=HEAD%2002-02-16, gcc=2.95.3, goption=-gstabs+.
458 #
459 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
460 # gdb=HEAD%2002-02-16, gcc=3.0.3, goption=-gdwarf-2.
461 #
462 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
463 # gdb=HEAD%2002-02-16, gcc=3.0.3, goption=-gstabs+.
464 #
465 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
466 # gdb=HEAD%2002-02-16, gcc=3.0.4-20020215, goption=-gdwarf-2.
467 #
468 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
469 # gdb=HEAD%2002-02-16, gcc=3.0.4-20020215, goption=-gstabs+.
470 #
471 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
472 # gdb=HEAD%2002-02-16, gcc=gcc-3_0-branch%2002-02-16, goption=-gdwarf-2.
473 #
474 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
475 # gdb=HEAD%2002-02-16, gcc=gcc-3_0-branch%2002-02-16, goption=-gstabs+.
476 #
477 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
478 # gdb=HEAD%2002-02-16, gcc=HEAD%2002-02-16, goption=-gdwarf-2.
479 #
480 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
481 # gdb=HEAD%2002-02-16, gcc=HEAD%2002-02-16, goption=-gstabs+.
482 #
483 # -- chastain 2002-02-20
484
51615d72
MC
485 # more recent results:
486 # wrong value "202"
487 # gcc 2.95.3 -gdwarf-2
488 # gcc 2.95.3 -gstabs+
489 # attempt to take addres of value not located in memory
490 # gcc 3.3.2 -gdwarf-2
491 # gcc 3.3.2 -gstabs+
492 #
493 # -- chastain 2003-12-31
494
495 gdb_test_multiple "print pEe->D::vg()" "print pEe->D::vg()" {
496 -re "\\$\[0-9]+ = 102$nl$gdb_prompt $" {
497 pass "print pEe->D::vg()"
498 }
499 -re "Attempt to take address of value not located in memory.$nl$gdb_prompt $" {
500 kfail "gdb/1064" "print pEe->D::vg()"
501 }
c906108c
SS
502 }
503}
504
505proc do_tests {} {
506 global prms_id
507 global bug_id
51615d72
MC
508 global srcdir subdir binfile
509 global gdb_prompt
c906108c
SS
510
511 set prms_id 0
512 set bug_id 0
513
51615d72
MC
514 gdb_exit
515 gdb_start
516 gdb_reinitialize_dir $srcdir/$subdir
517 gdb_load $binfile
c906108c 518
51615d72
MC
519 gdb_test "set language c++" "" ""
520 gdb_test "set width 0" "" ""
c906108c 521
51615d72 522 runto_main
c906108c
SS
523 test_ptype_of_classes
524
51615d72
MC
525 gdb_breakpoint test_calls
526 gdb_test "continue" ".*Breakpoint .* test_calls.*" ""
527 test_virtual_calls
c906108c
SS
528}
529
530do_tests
This page took 0.500057 seconds and 4 git commands to generate.