Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: gdb/testsuite/gdb.cp/inherit.exp

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/testsuite/gdb.cp/infcall-dlopen.exp ('k') | gdb/testsuite/gdb.cp/koenig.exp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 1992-1999, 2001-2004, 2006-2012 Free Software Foundation, 1 # Copyright 1992-1999, 2001-2004, 2006-2012 Free Software Foundation,
2 # Inc. 2 # Inc.
3 3
4 # This program is free software; you can redistribute it and/or modify 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 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 6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version. 7 # (at your option) any later version.
8 # 8 #
9 # This program is distributed in the hope that it will be useful, 9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details. 12 # GNU General Public License for more details.
13 # 13 #
14 # You should have received a copy of the GNU General Public License 14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. 15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 16
17 # This file was written by Fred Fish. (fnf@cygnus.com) 17 # This file was written by Fred Fish. (fnf@cygnus.com)
18 # And rewritten by Michael Chastain. (mec.gnu@mindspring.com) 18 # And rewritten by Michael Chastain. (mec.gnu@mindspring.com)
19 19
20 set ws "\[\r\n\t \]+" 20 set ws "\[\r\n\t \]+"
21 set nl "\[\r\n\]+" 21 set nl "\[\r\n\]+"
22 set vhn "\\$\[0-9\]+" 22 set vhn "\\$\[0-9\]+"
23 23
24 if $tracelevel then {
25 strace $tracelevel
26 }
27
28 if { [skip_cplus_tests] } { continue } 24 if { [skip_cplus_tests] } { continue }
29 25
30 load_lib "cp-support.exp" 26 load_lib "cp-support.exp"
31 27
32 set testfile "inherit" 28 standard_testfile misc.cc
33 set srcfile misc.cc
34 set binfile ${objdir}/${subdir}/${testfile}
35 29
36 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb ug c++}] != "" } { 30 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
37 untested inherit.exp 31 return -1
38 return -1
39 } 32 }
40 33
41 # Single inheritance, print type definitions. 34 # Single inheritance, print type definitions.
42 35
43 proc test_ptype_si { } { 36 proc test_ptype_si { } {
44 global gdb_prompt 37 global gdb_prompt
45 global ws 38 global ws
46 global nl 39 global nl
47 40
48 # A simple class. 41 # A simple class.
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 gdb_test "print g_B.B::x" "$vhn = 6" 311 gdb_test "print g_B.B::x" "$vhn = 6"
319 312
320 # Print all members of g_C. 313 # Print all members of g_C.
321 gdb_test "print g_C.A::a" "$vhn = 7" 314 gdb_test "print g_C.A::a" "$vhn = 7"
322 gdb_test "print g_C.A::x" "$vhn = 8" 315 gdb_test "print g_C.A::x" "$vhn = 8"
323 gdb_test "print g_C.C::c" "$vhn = 9" 316 gdb_test "print g_C.C::c" "$vhn = 9"
324 gdb_test "print g_C.C::x" "$vhn = 10" 317 gdb_test "print g_C.C::x" "$vhn = 10"
325 318
326 # Print all members of g_D. 319 # Print all members of g_D.
327 # 320 #
328 # g_D.A::a and g_D.A::x are ambiguous member accesses, and gdb 321 # g_D.A::a and g_D.A::x are ambiguous member accesses.
329 # should detect these. There are no ways to PASS these tests 322 gdb_test "print g_D.A::a" "base class 'A' is ambiguous in type 'D'"
330 # because I don't know what the gdb message will be. -- chastain 323 gdb_test "print g_D.C::a" "$vhn = 15"
331 # 2004-01-27. 324 gdb_test "print g_D.B::a" "$vhn = 11"
332 325 gdb_test "print g_D.A::x" "base class 'A' is ambiguous in type 'D'"
333 set name "print g_D.A::a"
334 gdb_test_multiple "print g_D.A::a" $name {
335 » -re "$vhn = (15|11)$nl$gdb_prompt $" {
336 » kfail "gdb/68" "print g_D.A::a"
337 » }
338 }
339
340 set name "print g_D.A::x"
341 gdb_test_multiple "print g_D.A::x" $name {
342 » -re "$vhn = (16|12)$nl$gdb_prompt $" {
343 » kfail "gdb/68" "print g_D.A::x"
344 » }
345 }
346
347 gdb_test "print g_D.B::b" "$vhn = 13" 326 gdb_test "print g_D.B::b" "$vhn = 13"
348 gdb_test "print g_D.B::x" "$vhn = 14" 327 gdb_test "print g_D.B::x" "$vhn = 14"
349 gdb_test "print g_D.C::c" "$vhn = 17" 328 gdb_test "print g_D.C::c" "$vhn = 17"
350 gdb_test "print g_D.C::x" "$vhn = 18" 329 gdb_test "print g_D.C::x" "$vhn = 18"
351 gdb_test "print g_D.D::d" "$vhn = 19" 330 gdb_test "print g_D.D::d" "$vhn = 19"
352 gdb_test "print g_D.D::x" "$vhn = 20" 331 gdb_test "print g_D.D::x" "$vhn = 20"
353 332
354 # Print all members of g_E. 333 # Print all members of g_E.
355 # g_E.A::a and g_E.A::x are ambiguous. 334 # g_E.A::a and g_E.A::x are ambiguous.
356 335
357 set name "print g_E.A::a" 336 gdb_test "print g_E.A::a" "base class 'A' is ambiguous in type 'E'"
358 gdb_test_multiple "print g_E.A::a" $name { 337 gdb_test "print g_E.A::x" "base class 'A' is ambiguous in type 'E'"
359 » -re "$vhn = (21|25)$nl$gdb_prompt $" {
360 » kfail "gdb/68" "print g_E.A::a"
361 » }
362 }
363
364 set name "print g_E.A::x"
365 gdb_test_multiple "print g_E.A::x" $name {
366 » -re "$vhn = (26|22)$nl$gdb_prompt $" {
367 » kfail "gdb/68" "print g_E.A::x"
368 » }
369 }
370
371 gdb_test "print g_E.B::b" "$vhn = 23" 338 gdb_test "print g_E.B::b" "$vhn = 23"
372 gdb_test "print g_E.B::x" "$vhn = 24" 339 gdb_test "print g_E.B::x" "$vhn = 24"
373 gdb_test "print g_E.C::c" "$vhn = 27" 340 gdb_test "print g_E.C::c" "$vhn = 27"
374 gdb_test "print g_E.C::x" "$vhn = 28" 341 gdb_test "print g_E.C::x" "$vhn = 28"
375 gdb_test "print g_E.D::d" "$vhn = 29" 342 gdb_test "print g_E.D::d" "$vhn = 29"
376 gdb_test "print g_E.D::x" "$vhn = 30" 343 gdb_test "print g_E.D::x" "$vhn = 30"
377 gdb_test "print g_E.E::e" "$vhn = 31" 344 gdb_test "print g_E.E::e" "$vhn = 31"
378 gdb_test "print g_E.E::x" "$vhn = 32" 345 gdb_test "print g_E.E::x" "$vhn = 32"
379 } 346 }
380 347
(...skipping 22 matching lines...) Expand all
403 gdb_test "ptype g_B.B::x" "type = int" 370 gdb_test "ptype g_B.B::x" "type = int"
404 371
405 # Print all members of g_C. 372 # Print all members of g_C.
406 gdb_test "ptype g_C.A::a" "type = int" 373 gdb_test "ptype g_C.A::a" "type = int"
407 gdb_test "ptype g_C.A::x" "type = int" 374 gdb_test "ptype g_C.A::x" "type = int"
408 gdb_test "ptype g_C.C::c" "type = int" 375 gdb_test "ptype g_C.C::c" "type = int"
409 gdb_test "ptype g_C.C::x" "type = int" 376 gdb_test "ptype g_C.C::x" "type = int"
410 377
411 # Print all members of g_D. 378 # Print all members of g_D.
412 # 379 #
413 # g_D.A::a and g_D.A::x are ambiguous member accesses, and gdb 380 # g_D.A::a and g_D.A::x are ambiguous member accesses.
414 # should detect these. There are no ways to PASS these tests
415 # because I don't know what the gdb message will be. -- chastain
416 # 2004-01-27.
417 381
418 set name "ptype g_D.A::a" 382 gdb_test "ptype g_D.A::a" "base class 'A' is ambiguous in type 'D'"
419 gdb_test_multiple "ptype g_D.A::a" $name { 383 gdb_test "ptype g_D.A::x" "base class 'A' is ambiguous in type 'D'"
420 » -re "type = int$nl$gdb_prompt $" {
421 » kfail "gdb/68" "ptype g_D.A::a"
422 » }
423 }
424
425 set name "ptype g_D.A::x"
426 gdb_test_multiple "ptype g_D.A::x" $name {
427 » -re "type = int$nl$gdb_prompt $" {
428 » kfail "gdb/68" "ptype g_D.A::x"
429 » }
430 }
431
432 gdb_test "ptype g_D.B::b" "type = int" 384 gdb_test "ptype g_D.B::b" "type = int"
433 gdb_test "ptype g_D.B::x" "type = int" 385 gdb_test "ptype g_D.B::x" "type = int"
434 gdb_test "ptype g_D.C::c" "type = int" 386 gdb_test "ptype g_D.C::c" "type = int"
435 gdb_test "ptype g_D.C::x" "type = int" 387 gdb_test "ptype g_D.C::x" "type = int"
436 gdb_test "ptype g_D.D::d" "type = int" 388 gdb_test "ptype g_D.D::d" "type = int"
437 gdb_test "ptype g_D.D::x" "type = int" 389 gdb_test "ptype g_D.D::x" "type = int"
438 390
439 # Print all members of g_E. 391 # Print all members of g_E.
440 # g_E.A::a and g_E.A::x are ambiguous. 392 # g_E.A::a and g_E.A::x are ambiguous.
441 393
442 set name "ptype g_E.A::a" 394 gdb_test "ptype g_E.A::a" "base class 'A' is ambiguous in type 'E'"
443 gdb_test_multiple "ptype g_E.A::a" $name { 395 gdb_test "ptype g_E.A::x" "base class 'A' is ambiguous in type 'E'"
444 » -re "type = int$nl$gdb_prompt $" {
445 » kfail "gdb/68" "ptype g_E.A::a"
446 » }
447 }
448
449 set name "ptype g_E.A::x"
450 gdb_test_multiple "ptype g_E.A::x" $name {
451 » -re "type = int$nl$gdb_prompt $" {
452 » kfail "gdb/68" "ptype g_E.A::x"
453 » }
454 }
455
456 gdb_test "ptype g_E.B::b" "type = int" 396 gdb_test "ptype g_E.B::b" "type = int"
457 gdb_test "ptype g_E.B::x" "type = int" 397 gdb_test "ptype g_E.B::x" "type = int"
458 gdb_test "ptype g_E.C::c" "type = int" 398 gdb_test "ptype g_E.C::c" "type = int"
459 gdb_test "ptype g_E.C::x" "type = int" 399 gdb_test "ptype g_E.C::x" "type = int"
460 gdb_test "ptype g_E.D::d" "type = int" 400 gdb_test "ptype g_E.D::d" "type = int"
461 gdb_test "ptype g_E.D::x" "type = int" 401 gdb_test "ptype g_E.D::x" "type = int"
462 gdb_test "ptype g_E.E::e" "type = int" 402 gdb_test "ptype g_E.E::e" "type = int"
463 gdb_test "ptype g_E.E::x" "type = int" 403 gdb_test "ptype g_E.E::x" "type = int"
464 } 404 }
465 405
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 607
668 # Print all members of g_vD. 608 # Print all members of g_vD.
669 609
670 set name "print g_vD" 610 set name "print g_vD"
671 gdb_test_multiple "print g_vD" $name { 611 gdb_test_multiple "print g_vD" $name {
672 -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_2_vA = $he x, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_2_vA = $hex, vc = 23, vx = 24\}, $re_v bptr_2_vC = $hex, $re_vbptr_2_vB = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { 612 -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_2_vA = $he x, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_2_vA = $hex, vc = 23, vx = 24\}, $re_v bptr_2_vC = $hex, $re_vbptr_2_vB = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" {
673 # gcc 2.95.3 -gdwarf-2 613 # gcc 2.95.3 -gdwarf-2
674 # gcc 2.95.3 -gstabs+ 614 # gcc 2.95.3 -gstabs+
675 pass $name 615 pass $name
676 } 616 }
677 » -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_3_vB = $he x, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_3_vC = $hex, vc = 23, vx = 24\}, $re_v bptr_3_vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { 617 » -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_3_vB = ${h ex}( <vtable for vD.*>)?, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_3_vC = ${hex}( <vtable for vC.*>)?, vc = 23, vx = 24\}, $re_vbptr_3_vD = ${hex}( <vtable for vD .*>)?, vd = 25, vx = 26\}$nl$gdb_prompt $" {
678 # gcc 3.3.2 -gdwarf-2 618 # gcc 3.3.2 -gdwarf-2
679 # gcc HEAD 2004-01-21 -gdwarf-2 619 # gcc HEAD 2004-01-21 -gdwarf-2
680 # gcc HEAD 2004-01-21 -gstabs+ 620 # gcc HEAD 2004-01-21 -gstabs+
681 pass "$name (FIXME v3 vtbl ptr)" 621 pass "$name (FIXME v3 vtbl ptr)"
682 } 622 }
683 -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_3_vB = $he x, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_3_vC = $hex <VTT for vD>, vc = 23, vx = 24\}, $re_vbptr_3_vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { 623 -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_3_vB = $he x, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_3_vC = $hex <VTT for vD>, vc = 23, vx = 24\}, $re_vbptr_3_vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" {
684 # gcc 3.3.2 -gstabs+ 624 # gcc 3.3.2 -gstabs+
685 pass "$name" 625 pass "$name"
686 } 626 }
687 } 627 }
688 628
689 # Print all members of g_vE. 629 # Print all members of g_vE.
690 630
691 set name "print g_vE" 631 set name "print g_vE"
692 gdb_test_multiple "print g_vE" $name { 632 gdb_test_multiple "print g_vE" $name {
693 -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_2_v A = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_2_vA = $hex, vc = 0, vx = 0\}, $r e_vbptr_2_vC = $hex, $re_vbptr_2_vB = $hex, vd = 0, vx = 0\}, $re_vbptr_2_vD = $ hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { 633 -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_2_v A = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_2_vA = $hex, vc = 0, vx = 0\}, $r e_vbptr_2_vC = $hex, $re_vbptr_2_vB = $hex, vd = 0, vx = 0\}, $re_vbptr_2_vD = $ hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
694 # gcc 2.95.3 -gdwarf-2 634 # gcc 2.95.3 -gdwarf-2
695 # gcc 2.95.3 -gstabs+ 635 # gcc 2.95.3 -gstabs+
696 pass $name 636 pass $name
697 } 637 }
698 » -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_v B = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = $hex, vc = 0, vx = 0\}, $r e_vbptr_3_vD = $hex, vd = 0, vx = 0\}, $re_vbptr_3_vE = $hex, ve = 27, vx = 28\} $nl$gdb_prompt $" { 638 » -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_v B = ${hex}( <vtable for vE.*>)?, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = ${h ex}( <vtable for vE.*>)?, vc = 0, vx = 0\}, $re_vbptr_3_vD = ${hex}( <vtable for vE.*>)?, vd = 0, vx = 0\}, $re_vbptr_3_vE = ${hex}( <vtable for vE.*>)?, ve = 2 7, vx = 28\}$nl$gdb_prompt $" {
699 # gcc 3.3.4 -gdwarf-2 639 # gcc 3.3.4 -gdwarf-2
700 # gcc 3.3.4 -gstabs+ 640 # gcc 3.3.4 -gstabs+
701 # gcc 3.4.1 -gdwarf-2 641 # gcc 3.4.1 -gdwarf-2
702 # gcc 3.4.1 -gstabs+ 642 # gcc 3.4.1 -gstabs+
703 # gcc HEAD 2004-07-31 -gdwarf-2 643 # gcc HEAD 2004-07-31 -gdwarf-2
704 pass "$name (FIXME v3 vtbl ptr)" 644 pass "$name (FIXME v3 vtbl ptr)"
705 } 645 }
706 -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_v B = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = $hex <VTT for vD>, vc = 0, vx = 0\}, $re_vbptr_3_vD = $hex, vd = 0, vx = 0\}, $re_vbptr_3_vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { 646 -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_v B = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = $hex <VTT for vD>, vc = 0, vx = 0\}, $re_vbptr_3_vD = $hex, vd = 0, vx = 0\}, $re_vbptr_3_vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
707 # gcc 3.2.7-rh -gstabs+ 647 # gcc 3.2.7-rh -gstabs+
708 pass $name 648 pass $name
709 } 649 }
710 -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_v B = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = $hex <typeinfo for vE>, vc = 0, vx = 0\}, $re_vbptr_3_vD = $hex, vd = 0, vx = 0\}, $re_vbptr_3_vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { 650 -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_v B = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = $hex <typeinfo for vE>, vc = 0, vx = 0\}, $re_vbptr_3_vD = $hex, vd = 0, vx = 0\}, $re_vbptr_3_vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
711 # gcc HEAD 2004-07-31 -gstabs+ 651 # gcc HEAD 2004-07-31 -gstabs+
712 pass $name 652 pass $name
713 } 653 }
714 } 654 }
715 } 655 }
716 656
717 proc do_tests { } { 657 proc do_tests { } {
718 global subdir
719 global objdir
720 global srcdir
721 global binfile
722
723
724 # Start with a fresh gdb.
725
726 gdb_exit
727 gdb_start
728 gdb_reinitialize_dir $srcdir/$subdir
729 gdb_load $binfile
730
731 gdb_test_no_output "set width 0" 658 gdb_test_no_output "set width 0"
732 659
733 if { ![runto_main] } then { 660 if { ![runto_main] } then {
734 perror "couldn't run to main" 661 perror "couldn't run to main"
735 return 662 return
736 } 663 }
737 664
738 gdb_test_no_output "set language c++" 665 gdb_test_no_output "set language c++"
739 test_ptype_si 666 test_ptype_si
740 test_ptype_mi 667 test_ptype_mi
(...skipping 17 matching lines...) Expand all
758 return 685 return
759 } 686 }
760 687
761 test_print_svi_members 688 test_print_svi_members
762 test_print_svi_classes 689 test_print_svi_classes
763 test_print_mvi_members 690 test_print_mvi_members
764 test_print_mvi_classes 691 test_print_mvi_classes
765 } 692 }
766 693
767 do_tests 694 do_tests
OLDNEW
« no previous file with comments | « gdb/testsuite/gdb.cp/infcall-dlopen.exp ('k') | gdb/testsuite/gdb.cp/koenig.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698