OLD | NEW |
1 # cpexprs.exp - C++ expressions tests | 1 # cpexprs.exp - C++ expressions tests |
2 # | 2 # |
3 # Copyright 2008-2012 Free Software Foundation, Inc. | 3 # Copyright 2008-2012 Free Software Foundation, Inc. |
4 # | 4 # |
5 # Contributed by Red Hat, originally written by Keith Seitz. | 5 # Contributed by Red Hat, originally written by Keith Seitz. |
6 # | 6 # |
7 # This program is free software; you can redistribute it and/or modify | 7 # This program is free software; you can redistribute it and/or modify |
8 # it under the terms of the GNU General Public License as published by | 8 # it under the terms of the GNU General Public License as published by |
9 # the Free Software Foundation; either version 3 of the License, or | 9 # the Free Software Foundation; either version 3 of the License, or |
10 # (at your option) any later version. | 10 # (at your option) any later version. |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 add {policyd<tclass<int>, operation_1<tclass<int> > >::function} \ | 656 add {policyd<tclass<int>, operation_1<tclass<int> > >::function} \ |
657 {void (void)} \ | 657 {void (void)} \ |
658 {operation_1<tclass<int> >::function} \ | 658 {operation_1<tclass<int> >::function} \ |
659 {operation_1<T>::function} | 659 {operation_1<T>::function} |
660 add {policyd5::function} \ | 660 add {policyd5::function} \ |
661 {void (void)} \ | 661 {void (void)} \ |
662 {operation_1<tclass<int> >::function} \ | 662 {operation_1<tclass<int> >::function} \ |
663 {operation_1<T>::function} | 663 {operation_1<T>::function} |
664 | 664 |
665 # Start the test | 665 # Start the test |
666 if {$tracelevel} { | |
667 strace $tracelevel | |
668 } | |
669 | |
670 if {[skip_cplus_tests]} { continue } | 666 if {[skip_cplus_tests]} { continue } |
671 | 667 |
672 # On SPU this test fails because the executable exceeds local storage size. | 668 # On SPU this test fails because the executable exceeds local storage size. |
673 if { [istarget "spu*-*-*"] } { | 669 if { [istarget "spu*-*-*"] } { |
674 return 0 | 670 return 0 |
675 } | 671 } |
676 | 672 |
677 # | 673 # |
678 # test running programs | 674 # test running programs |
679 # | 675 # |
680 | 676 |
681 set testfile "cpexprs" | 677 standard_testfile .cc |
682 set srcfile "${testfile}.cc" | |
683 set binfile [file join $objdir $subdir $testfile] | |
684 | 678 |
685 if {[gdb_compile [file join $srcdir $subdir $srcfile] $binfile \ | 679 if {[get_compiler_info "c++"]} { |
686 » executable {debug c++}] != "" } { | |
687 untested "$testfile.exp" | |
688 return -1 | 680 return -1 |
689 } | 681 } |
690 | 682 |
691 if {[get_compiler_info $binfile "c++"]} { | 683 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { |
692 return -1 | 684 return -1 |
693 } | 685 } |
694 | 686 |
695 gdb_exit | |
696 gdb_start | |
697 gdb_reinitialize_dir [file join $srcdir $subdir] | |
698 gdb_load $binfile | |
699 | |
700 if {![runto_main]} { | 687 if {![runto_main]} { |
701 perror "couldn't run to breakpoint" | 688 perror "couldn't run to breakpoint" |
702 continue | 689 continue |
703 } | 690 } |
704 | 691 |
705 # Set the listsize to one. This will help with testing "list". | 692 # Set the listsize to one. This will help with testing "list". |
706 gdb_test "set listsize 1" | 693 gdb_test "set listsize 1" |
707 | 694 |
708 # "print METHOD" | 695 # "print METHOD" |
709 foreach name [get_functions print] { | 696 foreach name [get_functions print] { |
710 gdb_test "print $name" [get $name print] "print $name" | 697 gdb_test "print $name" [get $name print] "print $name" |
711 } | 698 } |
712 | 699 |
713 # "list METHOD" | 700 # "list METHOD" |
714 foreach name [get_functions list] { | 701 foreach name [get_functions list] { |
715 gdb_test "list $name" [get $name list] "list $name" | 702 gdb_test "list $name" [get $name list] "list $name" |
716 } | 703 } |
717 | 704 |
718 # Running to breakpoint -- use any function we can "list" | 705 # Running to breakpoint -- use any function we can "list" |
719 foreach name [get_functions list] { | 706 foreach name [get_functions list] { |
720 # Skip "test_function", since test_breakpoint uses it | 707 # Skip "test_function", since test_breakpoint uses it |
721 if {[string compare $name "test_function"] != 0} { | 708 if {[string compare $name "test_function"] != 0} { |
722 test_breakpoint $name | 709 test_breakpoint $name |
723 } | 710 } |
724 } | 711 } |
725 | 712 |
| 713 # Test c/v gets recognized even without quoting. |
| 714 foreach cv {{} { const} { volatile} { const volatile}} { |
| 715 set test "p 'CV::m(int)$cv'" |
| 716 gdb_test_multiple $test $test { |
| 717 -re "( = {.*} 0x\[0-9a-f\]+ <CV::m.*>)\r\n$gdb_prompt $" { |
| 718 # = {void (CV * const, CV::t)} 0x400944 <CV::m(int)> |
| 719 set correct $expect_out(1,string) |
| 720 pass $test |
| 721 } |
| 722 } |
| 723 if {"$cv" != ""} { |
| 724 setup_kfail c++/14186 *-*-* |
| 725 } |
| 726 gdb_test "p CV::m(int)$cv" [string_to_regexp $correct] |
| 727 } |
| 728 |
| 729 # Test TYPENAME:: gets recognized even in parentheses. |
| 730 gdb_test "p CV_f(int)" { = {int \(int\)} 0x[0-9a-f]+ <CV_f\(int\)>} |
| 731 gdb_test "p CV_f(CV::t)" { = {int \(int\)} 0x[0-9a-f]+ <CV_f\(int\)>} |
| 732 gdb_test "p CV_f(CV::i)" " = 43" |
| 733 |
726 gdb_exit | 734 gdb_exit |
727 return 0 | 735 return 0 |
OLD | NEW |