OLD | NEW |
1 # Copyright 2011-2012 Free Software Foundation, Inc. | 1 # Copyright 2011-2012 Free Software Foundation, Inc. |
2 # | 2 # |
3 # Contributed by Red Hat, originally written by Keith Seitz. | 3 # Contributed by Red Hat, originally written by Keith Seitz. |
4 # | 4 # |
5 # This program is free software; you can redistribute it and/or modify | 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 | 6 # it under the terms of the GNU General Public License as published by |
7 # the Free Software Foundation; either version 3 of the License, or | 7 # the Free Software Foundation; either version 3 of the License, or |
8 # (at your option) any later version. | 8 # (at your option) any later version. |
9 # | 9 # |
10 # This program is distributed in the hope that it will be useful, | 10 # This program is distributed in the hope that it will be useful, |
(...skipping 23 matching lines...) Expand all Loading... |
34 gdb_breakpoint "$func" | 34 gdb_breakpoint "$func" |
35 gdb_test "continue" \ | 35 gdb_test "continue" \ |
36 "Continuing.\r\n\r\nBreakpoint $DEC+,.*$result.*" \ | 36 "Continuing.\r\n\r\nBreakpoint $DEC+,.*$result.*" \ |
37 "continue to $func" | 37 "continue to $func" |
38 } | 38 } |
39 } | 39 } |
40 | 40 |
41 if {[skip_cplus_tests]} { continue } | 41 if {[skip_cplus_tests]} { continue } |
42 | 42 |
43 # Tests for c++/12750 | 43 # Tests for c++/12750 |
44 set testfile "static-method" | 44 standard_testfile .cc |
45 set srcfile $testfile.cc | |
46 | 45 |
47 if {[prepare_for_testing $testfile $testfile $srcfile {c++ debug}]} { | 46 if {[prepare_for_testing $testfile $testfile $srcfile {c++ debug}]} { |
48 return -1 | 47 return -1 |
49 } | 48 } |
50 | 49 |
51 # The GDB workaround for GCC PR debug/45682 does not apply as it requires | 50 # The GDB workaround for GCC PR debug/45682 does not apply as it requires |
52 # DW_AT_linkage_name of methods. The whole class A is in anonymous namespace, | 51 # DW_AT_linkage_name of methods. The whole class A is in anonymous namespace, |
53 # therefore not accessible outside of the CU (compilation unit) and therefore | 52 # therefore not accessible outside of the CU (compilation unit) and therefore |
54 # GCC does not produce DW_AT_linkage_name for such methods. | 53 # GCC does not produce DW_AT_linkage_name for such methods. |
55 | 54 |
56 set have_gcc_45682_fixed 1 | 55 set have_gcc_45682_fixed 1 |
57 set test "info addr A::func()" | 56 set test "info addr A::func()" |
58 gdb_test_multiple $test $test { | 57 gdb_test_multiple $test $test { |
59 -re "No symbol \"A::func\\(\\)\" in current context\\.\r\n$gdb_prompt $" { | 58 -re "No symbol \"A::func\\(\\)\" in current context\\.\r\n$gdb_prompt $" { |
60 pass $test | 59 pass $test |
61 } | 60 } |
62 -re "Symbol \"A::func\\(\\)\" is a function at address .*\r\n$gdb_prompt $"
{ | 61 -re "Symbol \"A::func\\(\\)\" is a function at address .*\r\n$gdb_prompt $"
{ |
63 » kfail gcc/45682 $test | 62 » setup_xfail gcc/45682 "*-*-*" |
| 63 » fail $test |
64 set have_gcc_45682_fixed 0 | 64 set have_gcc_45682_fixed 0 |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 if {![runto_main]} { | 68 if {![runto_main]} { |
69 perror "couldn't run to breakpoint" | 69 perror "couldn't run to breakpoint" |
70 continue | 70 continue |
71 } | 71 } |
72 | 72 |
73 set ans {(anonymous namespace)} | 73 set ans {(anonymous namespace)} |
74 set methods {} | 74 set methods {} |
75 lappend methods "xxx::${ans}::func" | 75 lappend methods "xxx::${ans}::func" |
76 lappend methods "xxx::${ans}::A::func" | 76 lappend methods "xxx::${ans}::A::func" |
77 | 77 |
78 gdb_test_no_output "set listsize 1" "" | 78 gdb_test_no_output "set listsize 1" "" |
79 | 79 |
80 foreach test $methods { | 80 foreach test $methods { |
81 # The result we expect is the source code name of the symbol, | 81 # The result we expect is the source code name of the symbol, |
82 # i.e., without "(anonymous namespace)". | 82 # i.e., without "(anonymous namespace)". |
83 regsub -all [string_to_regexp "${ans}::"] $test "" expected | 83 regsub -all [string_to_regexp "${ans}::"] $test "" expected |
84 set result ".*// [string_to_regexp $expected]" | 84 set result ".*// [string_to_regexp $expected]" |
85 | 85 |
86 # Test whether the function/method can be "list"ed | 86 # Test whether the function/method can be "list"ed |
87 # with the filename pre-pended. | 87 # with the filename pre-pended. |
88 if {[string compare $test "xxx::${ans}::A::func"] == 0 | 88 if {[string compare $test "xxx::${ans}::A::func"] == 0 |
89 && !$have_gcc_45682_fixed} { | 89 && !$have_gcc_45682_fixed} { |
90 » setup_kfail gcc/45682 "*-*-*" | 90 » setup_xfail gcc/45682 "*-*-*" |
91 } | 91 } |
92 gdb_test "list ${srcfile}:$test" $result | 92 gdb_test "list ${srcfile}:$test" $result |
93 if {[string compare $test "xxx::${ans}::A::func"] == 0 | 93 if {[string compare $test "xxx::${ans}::A::func"] == 0 |
94 && !$have_gcc_45682_fixed} { | 94 && !$have_gcc_45682_fixed} { |
95 » setup_kfail gcc/45682 "*-*-*" | 95 » setup_xfail gcc/45682 "*-*-*" |
96 } | 96 } |
97 gdb_test "list '${srcfile}:$test'" $result | 97 gdb_test "list '${srcfile}:$test'" $result |
98 if {[string compare $test "xxx::${ans}::A::func"] == 0 | 98 if {[string compare $test "xxx::${ans}::A::func"] == 0 |
99 && !$have_gcc_45682_fixed} { | 99 && !$have_gcc_45682_fixed} { |
100 » setup_kfail gcc/45682 "*-*-*" | 100 » setup_xfail gcc/45682 "*-*-*" |
101 } | 101 } |
102 gdb_test "list '${srcfile}':'$test'" $result | 102 gdb_test "list '${srcfile}':'$test'" $result |
103 if {[string compare $test "xxx::${ans}::A::func"] == 0 | 103 if {[string compare $test "xxx::${ans}::A::func"] == 0 |
104 && !$have_gcc_45682_fixed} { | 104 && !$have_gcc_45682_fixed} { |
105 » setup_kfail gcc/45682 "*-*-*" | 105 » setup_xfail gcc/45682 "*-*-*" |
106 } | 106 } |
107 gdb_test "list ${srcfile}:'$test'" $result | 107 gdb_test "list ${srcfile}:'$test'" $result |
108 | 108 |
109 # Test setting and hitting a breakoint at the function/method. | 109 # Test setting and hitting a breakoint at the function/method. |
110 test_breakpoint $test $expected | 110 test_breakpoint $test $expected |
111 test_breakpoint "'$test'" $expected | 111 test_breakpoint "'$test'" $expected |
112 } | 112 } |
113 | 113 |
114 gdb_exit | 114 gdb_exit |
115 return 0 | 115 return 0 |
OLD | NEW |