2004-01-12 Michael Chastain <mec.gnu@mindspring.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / member-ptr.exp
CommitLineData
a0644324
MC
1# Copyright 1998, 1999, 2003, 2004 Free Software Foundation, Inc.
2
3# This file is part of the gdb testsuite
c906108c
SS
4
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19# Please email any bugs, comments, and/or additions to this file to:
20# bug-gdb@prep.ai.mit.edu
a0644324 21
c906108c
SS
22# Tests for pointer-to-member support
23# Written by Satish Pai <pai@apollo.hp.com> 1997-08-19
a0644324 24# Rewritten by Michael Chastain <mec.gnu@mindspring.com> 2004-01-11
c906108c 25
a0644324 26# TODO: copyright notice for member-ptr.cc
c906108c 27
a0644324 28set vhn "\\$\[0-9\]+"
c906108c
SS
29
30if $tracelevel then {
a0644324
MC
31 strace $tracelevel
32}
c906108c 33
d4f3574e
SS
34if { [skip_cplus_tests] } { continue }
35
c906108c
SS
36set prms_id 0
37set bug_id 0
38
39set testfile "member-ptr"
40set srcfile ${testfile}.cc
41set binfile ${objdir}/${subdir}/${testfile}
42
085dd6e6
JM
43if [get_compiler_info ${binfile} "c++"] {
44 return -1
45}
46
c906108c
SS
47if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
48 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
49}
50
c906108c
SS
51gdb_exit
52gdb_start
53gdb_reinitialize_dir $srcdir/$subdir
54gdb_load ${binfile}
55
c906108c
SS
56if ![runto_main] then {
57 perror "couldn't run to breakpoint"
58 continue
59}
60
a0644324
MC
61gdb_breakpoint [gdb_get_line_number "pmi = NULL"]
62gdb_continue_to_breakpoint "continue to pmi = NULL"
c906108c 63
a0644324
MC
64# gcc is not ready for production
65# -- chastain 2004-01-12
66
67if { [test_compiler_info "gcc-*"] } {
68 continue
c906108c
SS
69}
70
a0644324
MC
71# ======================
72# pointer to member data
73# ======================
74
c906108c
SS
75# ptype on pointer to data member
76
a0644324
MC
77set name "ptype pmi (A::j)"
78gdb_test_multiple "ptype pmi" $name {
79 -re "type = int *\\( ?A::\\*\\)\r\n$gdb_prompt $" {
80 pass $name
81 }
82 -re "type = int *A::\r\n$gdb_prompt $" {
83 # gcc HEAD 2004-01-10 -gdwarf-2
84 # gcc HEAD 2004-01-10 -gstabs+
85 kfail "gdb/NNNN" $name
c906108c 86 }
c906108c
SS
87}
88
89# print pointer to data member
90
a0644324
MC
91set name "print pmi (A::j) "
92gdb_test_multiple "print pmi" $name {
93 -re "$vhn = &A::j\r\n$gdb_prompt $" {
94 pass $name
95 }
96 -re "$vhn = \\(int ?\\( ?A::\\*\\)\\) &A::j\r\n$gdb_prompt $" {
97 pass $name
98 }
99 -re "$vhn = \\(int ?\\( ?A::\\*\\)\\) ?&A::j ?\\+ ?1 bytes\r\n$gdb_prompt $" {
100 # gcc 2.95.3 -gdwarf-2
101 kfail "gdb/NNNN" $name
102 }
103 -re "$vhn = &A::j ?\\+ ?1 bytes\r\n$gdb_prompt $" {
104 # gcc 2.95.3 -gstabs+
105 kfail "gdb/NNNN" $name
106 }
107 -re "$vhn = not implemented: member type in c_val_print\r\n$gdb_prompt $" {
108 # gcc HEAD 2004-01-11 05:33:21 -gdwarf-2
109 # gcc HEAD 2004-01-11 05:33:21 -gstabs+
110 kfail "gdb/NNNN" $name
111 }
112 -re "$vhn = \\(int ?\\( A::\\*\\)\\) 536870920\r\n$gdb_prompt $" {
113 # the value is 0x20000008 hex. 0x20000000 is an internal flag.
114 # Use '|' to add in more values as needed.
115 # hpacc A.03.45
116 kfail "gdb/NNNN" $name
c906108c 117 }
c906108c
SS
118}
119
c906108c
SS
120# print dereferenced pointer to data member
121
a0644324
MC
122set name "print a.*pmi (A::j)"
123gdb_test_multiple "print a.*pmi" $name {
124 -re "$vhn = 121\r\n$gdb_prompt $" {
125 pass $name
126 }
127 -re "$vhn = 855638016\r\n$gdb_prompt $" {
128 # gcc 2.95.3 -gdwarf-2
129 # gcc 2.95.3 -gstabs+
130 kfail "gdb/NNNN" $name
131 }
132 -re "not implemented: member types in unpack_long\r\n$gdb_prompt $" {
133 # gcc HEAD 2004-01-10 -gdwarf-2
134 # gcc HEAD 2004-01-10 -gstabs+
135 kfail "gdb/NNNN" $name
c906108c 136 }
c906108c
SS
137}
138
139# print dereferenced pointer to data member
140# this time, dereferenced through a pointer
141
a0644324
MC
142set name "print a_p->*pmi (A::j)"
143gdb_test_multiple "print a_p->*pmi" $name {
144 -re "$vhn = 121\r\n$gdb_prompt $" {
145 pass $name
146 }
147 -re "$vhn = 855638016\r\n$gdb_prompt $" {
148 # gcc 2.95.3 -gdwarf-2
149 # gcc 2.95.3 -gstabs+
150 kfail "gdb/NNNN" $name
151 }
152 -re "not implemented: member types in unpack_long\r\n$gdb_prompt $" {
153 # gcc HEAD 2004-01-10 -gdwarf-2
154 # gcc HEAD 2004-01-10 -gstabs+
155 kfail "gdb/NNNN" $name
c906108c 156 }
c906108c
SS
157}
158
a0644324 159# set the pointer to a different data member
c906108c 160
a0644324
MC
161set name "set var pmi = &A::jj"
162gdb_test_multiple "set var pmi = &A::jj" $name {
163 -re "Invalid cast.\r\n$gdb_prompt $" {
164 # gcc HEAD 2004-01-10 -gdwarf-2
165 # gcc HEAD 2004-01-10 -gstabs+
166 kfail "gdb/NNNN" $name
167 }
168 -re "set var pmi = &A::jj\r\n$gdb_prompt $" {
169 # I have to match the echo'ed input explicitly here.
170 # If I leave it out, the pattern becomes too general
171 # and matches anything that ends in "$gdb_prompt $".
172 pass $name
c906108c 173 }
c906108c
SS
174}
175
a0644324 176# print the pointer again
c906108c 177
a0644324
MC
178set name "print pmi (A::jj)"
179gdb_test_multiple "print pmi" $name {
180 -re "$vhn = &A::jj\r\n$gdb_prompt $" {
181 pass $name
182 }
183 -re "$vhn = \\(int ?\\( ?A::\\*\\)\\) &A::jj\r\n$gdb_prompt $" {
184 pass $name
185 }
186 -re "$vhn = not implemented: member type in c_val_print\r\n$gdb_prompt $" {
187 # gcc HEAD 2004-01-11 05:33:21 -gdwarf-2
188 # gcc HEAD 2004-01-11 05:33:21 -gstabs+
189 kfail "gdb/NNNN" $name
190 }
191 -re "$vhn = \\(int ?\\( A::\\*\\)\\) 536870924\r\n$gdb_prompt $" {
192 # the value is 0x20000008 hex. 0x20000000 is an internal flag.
193 # Use '|' to add in more values as needed.
194 # hpacc A.03.45
195 kfail "gdb/NNNN" $name
c906108c 196 }
c906108c
SS
197}
198
199# print dereferenced pointer to data member again
200
a0644324
MC
201set name "print a.*pmi (A::jj)"
202gdb_test_multiple "print a.*pmi" $name {
203 -re "$vhn = 1331\r\n$gdb_prompt $" {
204 pass $name
205 }
206 -re "not implemented: member types in unpack_long\r\n$gdb_prompt $" {
207 # gcc HEAD 2004-01-10 -gdwarf-2
208 # gcc HEAD 2004-01-10 -gstabs+
209 kfail "gdb/NNNN" $name
c906108c 210 }
c906108c
SS
211}
212
213# set the pointer to data member back to A::j
214
a0644324
MC
215set name "set var pmi = &A::j"
216gdb_test_multiple "set var pmi = &A::j" $name {
217 -re "Invalid cast.\r\n$gdb_prompt $" {
218 # gcc HEAD 2004-01-10 -gdwarf-2
219 # gcc HEAD 2004-01-10 -gstabs+
220 kfail "gdb/NNNN" $name
221 }
222 -re "set var pmi = &A::j\r\n$gdb_prompt $" {
223 # I have to match the echo'ed input explicitly here.
224 # If I leave it out, the pattern becomes too general
225 # and matches anything that ends in "$gdb_prompt $".
226 pass $name
c906108c 227 }
c906108c
SS
228}
229
230# print dereferenced pointer to data member yet again (extra check, why not)
231
a0644324
MC
232set name "print a.*pmi (A::j) (again)"
233gdb_test_multiple "print a.*pmi" $name {
234 -re "$vhn = 121\r\n$gdb_prompt $" {
235 pass $name
236 }
237 -re "not implemented: member types in unpack_long\r\n$gdb_prompt $" {
238 # gcc HEAD 2004-01-10 -gdwarf-2
239 # gcc HEAD 2004-01-10 -gstabs+
240 kfail "gdb/NNNN" $name
c906108c 241 }
c906108c
SS
242}
243
244# Set the data member pointed to.
245
a0644324
MC
246set name "print a.*pmi = 33"
247gdb_test_multiple "print a.*pmi = 33" $name {
248 -re "$vhn = 33\r\n$gdb_prompt $" {
249 pass $name
250 }
251 -re "not implemented: member types in unpack_long\r\n$gdb_prompt $" {
252 # gcc HEAD 2004-01-10 -gdwarf-2
253 # gcc HEAD 2004-01-10 -gstabs+
254 kfail "gdb/NNNN" $name
c906108c 255 }
c906108c
SS
256}
257
258# Now check that the data really was changed
c906108c 259
a0644324
MC
260set name "print a.*pmi (A::j) (33)"
261gdb_test_multiple "print a.*pmi" $name {
262 -re "$vhn = 33\r\n$gdb_prompt $" {
263 pass $name
264 }
265 -re "not implemented: member types in unpack_long\r\n$gdb_prompt $" {
266 # gcc HEAD 2004-01-10 -gdwarf-2
267 # gcc HEAD 2004-01-10 -gstabs+
268 kfail "gdb/NNNN" $name
c906108c 269 }
c906108c
SS
270}
271
a0644324 272# Double-check by printing a.
c906108c 273
a0644324
MC
274set name "print a (j = 33)"
275gdb_test_multiple "print a" $name {
276 -re "$vhn = \{c = 120 'x', j = 33, jj = 1331, (static|static int) s = 10, (_vptr.A|_vptr\\$) = ($hex|$hex <A virtual table>)\}\r\n$gdb_prompt $" {
277 pass $name
c906108c 278 }
a0644324
MC
279 -re "$vhn = \{c = 120 'x', j = 33, jj = 1331, (static|static int) s = 10, Virtual table at $hex\}\r\n$gdb_prompt $" {
280 pass $name
c906108c 281 }
a0644324
MC
282 -re "$vhn = \{(_vptr.A|_vptr\\$) = $hex, c = 120 'x', j = 33, jj = 1331, (static|static int) s = 10\}\r\n$gdb_prompt $" {
283 pass $name
284 }
285 -re "$vhn = \{(_vptr.A|_vptr\\$) = $hex, c = 120 'x', j = 121, jj = 1331, (static|static int) s = 10\}\r\n$gdb_prompt $" {
286 # gcc HEAD 2004-01-10 -gdwarf-2
287 # gcc HEAD 2004-01-10 -gstabs+
288 kfail "gdb/NNNN" $name
c906108c 289 }
c906108c
SS
290}
291
a0644324 292# Set the data member pointed to, using ->*
c906108c 293
a0644324
MC
294set name "print a_p->*pmi = 44"
295gdb_test_multiple "print a_p->*pmi = 44" $name {
296 -re "$vhn = 44\r\n$gdb_prompt $" {
297 pass $name
298 }
299 -re "not implemented: member types in unpack_long\r\n$gdb_prompt $" {
300 # gcc HEAD 2004-01-10 -gdwarf-2
301 # gcc HEAD 2004-01-10 -gstabs+
302 kfail "gdb/NNNN" $name
c906108c 303 }
c906108c
SS
304}
305
a0644324 306# Check that the data really was changed
c906108c 307
a0644324
MC
308set name "print a_p->*pmi (44)"
309gdb_test_multiple "print a_p->*pmi" $name {
310 -re "$vhn = 44\r\n$gdb_prompt $" {
311 pass $name
312 }
313 -re "not implemented: member types in unpack_long\r\n$gdb_prompt $" {
314 # gcc HEAD 2004-01-10 -gdwarf-2
315 # gcc HEAD 2004-01-10 -gstabs+
316 kfail "gdb/NNNN" $name
c906108c 317 }
c906108c
SS
318}
319
a0644324 320# Double-check by printing a.
c906108c 321
a0644324
MC
322set name "print a (j = 44)"
323gdb_test_multiple "print a" $name {
324 -re "$vhn = \{c = 120 'x', j = 44, jj = 1331, (static|static int) s = 10, (_vptr.A|_vptr\\$) = ($hex|$hex <A virtual table>)\}\r\n$gdb_prompt $" {
325 pass $name
326 }
327 -re "$vhn = \{c = 120 'x', j = 44, jj = 1331, (static|static int) s = 10, Virtual table at $hex\}\r\n$gdb_prompt $" {
328 pass $name
329 }
330 -re "$vhn = \{(_vptr.A|_vptr\\$) = $hex, c = 120 'x', j = 44, jj = 1331, (static|static int) s = 10\}\r\n$gdb_prompt $" {
331 pass $name
332 }
333 -re "$vhn = \{(_vptr.A|_vptr\\$) = $hex, c = 120 'x', j = 121, jj = 1331, (static|static int) s = 10\}\r\n$gdb_prompt $" {
334 # gcc HEAD 2004-01-10 -gdwarf-2
335 # gcc HEAD 2004-01-10 -gstabs+
336 kfail "gdb/NNNN" $name
c906108c 337 }
c906108c
SS
338}
339
a0644324 340# ptype the dereferenced pointer to member.
c906108c 341
a0644324
MC
342set name "ptype a.*pmi"
343gdb_test_multiple "ptype a.*pmi" $name {
344 -re "type = int\r\n$gdb_prompt" {
345 pass $name
346 }
347 -re "not implemented: member types in unpack_long\r\n$gdb_prompt $" {
348 # gcc HEAD 2004-01-10 -gdwarf-2
349 # gcc HEAD 2004-01-10 -gstabs+
350 kfail "gdb/NNNN" $name
c906108c 351 }
c906108c
SS
352}
353
a0644324
MC
354# dereference the pointer to data member without any object
355# this is not allowed: a pmi must be bound to an object to dereference
c906108c 356
a0644324
MC
357set name "print *pmi"
358gdb_test_multiple "print *pmi" $name {
359 -re "Attempt to dereference pointer to member without an object\r\n$gdb_prompt $" {
360 pass $name
361 }
362 -re "Cannot access memory at address 0x4\r\n$gdb_prompt $" {
363 # gcc 2.95.3 -gstabs+
364 kfail "gdb/NNNN" $name
365 }
366 -re "Cannot access memory at address 0x8\r\n$gdb_prompt $" {
367 # gcc 3.3.2 -gdwarf-2
368 # gcc 3.3.2 -gstabs+
369 kfail "gdb/NNNN" $name
c906108c 370 }
c906108c
SS
371}
372
a0644324
MC
373# dereference the pointer to data member without any object
374# this is not allowed: a pmi must be bound to an object to dereference
c906108c 375
a0644324
MC
376set name "ptype *pmi"
377gdb_test_multiple "ptype *pmi" $name {
378 -re "Attempt to dereference pointer to member without an object\r\n$gdb_prompt $" {
379 pass $name
380 }
381 -re "type = int A::\r\n$gdb_prompt $" {
382 # gcc 2.95.3 -gstabs+
383 # gcc HEAD 2004-01-10 -gdwarf-2
384 # gcc HEAD 2004-01-10 -gstabs+
385 kfail "gdb/NNNN" $name
c906108c 386 }
c906108c
SS
387}
388
a0644324
MC
389# Check cast of pointer to member to integer.
390# This is similar to "offset-of".
391# such as "A a; print (size_t) &A.j - (size_t) &A".
c906108c 392
a0644324
MC
393set name "print (int) pmi"
394gdb_test_multiple "print (int) pmi" $name {
395 -re "$vhn = (4|8)\r\n$gdb_prompt" {
396 pass $name
c906108c 397 }
c906108c
SS
398}
399
a0644324 400# Check "(int) pmi" explicitly for equality.
c906108c 401
a0644324
MC
402set name "print ((int) pmi) == ((char *) &a.j - (char *) &a)"
403gdb_test_multiple "print ((int) pmi) == ((char *) &a.j - (char *) & a)" $name {
404 -re "$vhn = true\r\n$gdb_prompt" {
405 pass $name
c906108c 406 }
c906108c
SS
407}
408
a0644324
MC
409# ==========================
410# pointer to member function
411# ==========================
412
413# ptype a pointer to a method
c906108c 414
a0644324
MC
415set name "ptype pmf"
416gdb_test_multiple "ptype pmf" $name {
417 -re "type = int \\( ?A::\\*\\)\\(int\\)\r\n$gdb_prompt $" {
418 pass $name
419 }
420 -re "type = int \\( ?A::\\*\\)\\(void\\)\r\n$gdb_prompt $" {
421 # hpacc A.03.45
422 kfail "gdb/NNNN" $name
423 }
424 -re "type = struct \{.*\}\r\n$gdb_prompt $" {
425 # gcc 2.95.3 -gdwarf-2
426 # gcc 2.95.3 -gstabs+
427 # gcc 3.2.2 -gdwarf-2
428 # gcc 3.2.2 -gstabs+
429 # gcc HEAD 2004-01-10 -gdwarf-2
430 # gcc HEAD 2004-01-10 -gstabs+
431 kfail "gdb/NNNN" $name
c906108c 432 }
c906108c
SS
433}
434
a0644324 435# print a pointer to a method
c906108c 436
a0644324
MC
437set name "print pmf"
438gdb_test_multiple "print pmf" $name {
439 -re "$vhn = &A::bar\r\n$gdb_prompt $" {
440 pass $name
441 }
442 -re "$vhn = .*not supported with HP aCC.*\r\n$gdb_prompt $" {
443 # hpacc A.03.45
444 kfail "gdb/NNNN" $name
445 }
446 -re "$vhn = \{.*\}\r\n$gdb_prompt $" {
447 # gcc 2.95.3 -gdwarf-2
448 # gcc 2.95.3 -gstabs+
449 # gcc 3.2.2 -gdwarf-2
450 # gcc 3.2.2 -gstabs+
451 # gcc HEAD 2004-01-10 -gdwarf-2
452 # gcc HEAD 2004-01-10 -gstabs+
453 kfail "gdb/NNNN" $name
c906108c 454 }
c906108c
SS
455}
456
a0644324 457# ptype a pointer to a pointer to a method
c906108c 458
a0644324
MC
459set name "ptype pmf_p"
460gdb_test_multiple "ptype pmf_p" $name {
461 -re "type = int \\( ?A::\\*\\*\\)\\(int\\)\r\n$gdb_prompt $" {
462 pass $name
c906108c 463 }
a0644324
MC
464 -re "type = int \\( ?A::\\*\\*\\)\\(void\\)\r\n$gdb_prompt $" {
465 # hpacc A.03.45
466 kfail "gdb/NNNN" $name
c906108c 467 }
a0644324
MC
468 -re "type = struct \{.*\} \\*\r\n$gdb_prompt $" {
469 # gcc 2.95.3 -gdwarf-2
470 # gcc 2.95.3 -gstabs+
471 # gcc 3.2.2 -gdwarf-2
472 # gcc 3.2.2 -gstabs+
473 # gcc HEAD 2004-01-10 -gdwarf-2
474 # gcc HEAD 2004-01-10 -gstabs+
475 kfail "gdb/NNNN" $name
c906108c 476 }
c906108c
SS
477}
478
a0644324 479# print a pointer to a pointer to a method
c906108c 480
a0644324
MC
481set name "print pmf_p"
482gdb_test_multiple "print pmf_p" $name {
483 -re "$vhn = \\(int \\( ?A::\\*\\*\\)\\)\\(int\\)\\) $hex\r\n$gdb_prompt $" {
484 pass $name
485 }
486 -re "$vhn = \\(PMF \\*\\) $hex\r\n$gdb_prompt $" {
487 pass "gdb/NNNN"
488 }
489 -re "$vhn = \\(int \\( ?A::\\*\\*\\)\\(void\\)\\) $hex\r\n$gdb_prompt $" {
490 # hpacc A.03.45
491 kfail "gdb/NNNN" $name
492 }
493 -re "$vhn = \\(struct \{.*\} \\*\\) $hex\r\n$gdb_prompt $" {
494 # gcc 2.95.3 -gdwarf-2
495 kfail "gdb/NNNN" $name
c906108c 496 }
c906108c
SS
497}
498
a0644324 499# print dereferenced pointer to method
c906108c 500
a0644324
MC
501set name "print a.*pmf"
502gdb_test_multiple "print a.*pmf" $name {
503 -re "$vhn = \\(int \\(\\*\\)\\(int\\)\\) $hex <A::bar\\(int\\)>\r\n$gdb_prompt$ " {
504 pass $name
505 }
506 -re "Pointers to methods not supported with HP aCC\r\n$gdb_prompt $" {
507 # hpacc A.03.45
508 kfail "gdb/NNNN" $name
509 }
510 -re "Value can't be converted to integer.\r\n$gdb_prompt $" {
511 # gcc 2.95.3 -gdwarf-2
512 # gcc 2.95.3 -gstabs+
513 # gcc 3.2.2 -gdwarf-2
514 # gcc 3.2.2 -gstabs+
515 # gcc HEAD 2004-01-10 -gdwarf-2
516 # gcc HEAD 2004-01-10 -gstabs+
517 kfail "gdb/NNNN" $name
c906108c 518 }
c906108c
SS
519}
520
a0644324 521# print dereferenced pointer to method, using ->*
c906108c 522
a0644324
MC
523set name "print a_p->*pmf"
524gdb_test_multiple "print a_p->*pmf" $name {
525 -re "$vhn = \\(int \\(\\*\\)\\(int\\)\\) $hex <A::bar\\(int\\)>\r\n$gdb_prompt$ " {
526 pass $name
527 }
528 -re "Pointers to methods not supported with HP aCC\r\n$gdb_prompt $" {
529 # hpacc A.03.45
530 kfail "gdb/NNNN" $name
531 }
532 -re "Value can't be converted to integer.\r\n$gdb_prompt $" {
533 # gcc 2.95.3 -gdwarf-2
534 # gcc 2.95.3 -gstabs+
535 # gcc 3.2.2 -gdwarf-2
536 # gcc 3.2.2 -gstabs+
537 # gcc HEAD 2004-01-10 -gdwarf-2
538 # gcc HEAD 2004-01-10 -gstabs+
539 kfail "gdb/NNNN" $name
c906108c 540 }
c906108c
SS
541}
542
a0644324 543# set the pointer to data member
c906108c 544
a0644324
MC
545set name "set var pmf = &A::foo"
546gdb_test_multiple "set var pmf = &A::foo" $name {
547 -re "set var pmf = &A::foo\r\n$gdb_prompt $" {
548 # I have to match the echo'ed input explicitly here.
549 # If I leave it out, the pattern becomes too general
550 # and matches anything that ends in "$gdb_prompt $".
551 pass $name
c906108c 552 }
a0644324
MC
553 -re "Invalid cast.\r\n$gdb_prompt $" {
554 # gcc 2.95.3 -gdwarf-2
555 # gcc 2.95.3 -gstabs+
556 # gcc 3.2.2 -gdwarf-2
557 # gcc 3.2.2 -gstabs+
558 # gcc HEAD 2004-01-10 -gdwarf-2
559 # gcc HEAD 2004-01-10 -gstabs+
560 kfail "gdb/NNNN" $name
561 }
562 -re "Assignment to pointers to methods not implemented with HP aCC\r\n$gdb_prompt $" {
563 kfail "gdb/NNNN" $name
c906108c 564 }
c906108c
SS
565}
566
a0644324
MC
567# dereference the pointer to data member without any object
568# this is not allowed: a pmf must be bound to an object to dereference
c906108c 569
a0644324
MC
570set name "print *pmf"
571gdb_test_multiple "print *pmf" $name {
572 -re "Attempt to dereference pointer to member without an object\r\n$gdb_prompt $" {
573 pass $name
574 }
575 -re "Structure has no component named operator\\*.\r\n$gdb_prompt $" {
576 # gcc 2.95.3 -gdwarf-2
577 # gcc 2.95.3 -gstabs+
578 # gcc 3.3.2 -gdwarf-2
579 # gcc 3.3.2 -gstabs+
580 # gcc HEAD 2004-01-10 -gdwarf-2
581 # gcc HEAD 2004-01-10 -gstabs+
582 kfail "gdb/NNNN" $name
c906108c 583 }
c906108c
SS
584}
585
a0644324
MC
586# dereference the pointer to data member without any object
587# this is not allowed: a pmf must be bound to an object to dereference
c906108c 588
a0644324
MC
589set name "ptype *pmf"
590gdb_test_multiple "ptype *pmf" $name {
591 -re "Attempt to dereference pointer to member without an object\r\n$gdb_prompt $" {
592 pass $name
593 }
594 -re "Structure has no component named operator\\*.\r\n$gdb_prompt $" {
595 # gcc 2.95.3 -gdwarf-2
596 # gcc 2.95.3 -gstabs+
597 # gcc 3.3.2 -gdwarf-2
598 # gcc 3.3.2 -gstabs+
599 # gcc HEAD 2004-01-10 -gdwarf-2
600 # gcc HEAD 2004-01-10 -gstabs+
601 kfail "gdb/NNNN" $name
c906108c 602 }
c906108c
SS
603}
604
a0644324 605# Call a function through a pmf.
c906108c 606
a0644324
MC
607set name "print (a.*pmf)(3)"
608gdb_test_multiple "print (a.*pmf)(3)" $name {
609 -re "$vhn = 50\r\n$gdb_prompt $" {
610 pass $name
611 }
612 -re "Not implemented: function invocation through pointer to method with HP aCC\r\n$gdb_prompt $" {
613 # hpacc A.03.45
614 kfail "gdb/NNNN" $name
615 }
616 -re "Value can't be converted to integer.\r\n$gdb_prompt $" {
617 # gcc 2.95.3 -gdwarf-2
618 # gcc 2.95.3 -gstabs+
619 # gcc 3.3.2 -gdwarf-2
620 # gcc 3.3.2 -gstabs+
621 # gcc HEAD 2004-01-10 -gdwarf-2
622 # gcc HEAD 2004-01-10 -gstabs+
623 kfail "gdb/NNNN" $name
c906108c 624 }
c906108c 625}
This page took 0.448809 seconds and 4 git commands to generate.