| OLD | NEW |
| 1 # Copyright 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 2007-2012 Free Software Foundation, Inc. |
| 2 | 2 |
| 3 # This program is free software; you can redistribute it and/or modify | 3 # This program is free software; you can redistribute it and/or modify |
| 4 # it under the terms of the GNU General Public License as published by | 4 # it under the terms of the GNU General Public License as published by |
| 5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
| 6 # (at your option) any later version. | 6 # (at your option) any later version. |
| 7 # | 7 # |
| 8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
| 12 # | 12 # |
| 13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
| 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | 15 |
| 16 # This test verifies that setting breakpoint on line in template | 16 # This test verifies that setting breakpoint on line in template |
| 17 # function will fire in all instantiations of that template. | 17 # function will fire in all instantiations of that template. |
| 18 | 18 |
| 19 if $tracelevel then { | |
| 20 strace $tracelevel | |
| 21 } | |
| 22 | |
| 23 if { [skip_stl_tests] } { continue } | 19 if { [skip_stl_tests] } { continue } |
| 24 | 20 |
| 25 # On SPU this test fails because the executable exceeds local storage size. | 21 # On SPU this test fails because the executable exceeds local storage size. |
| 26 if { [istarget "spu*-*-*"] } { | 22 if { [istarget "spu*-*-*"] } { |
| 27 return 0 | 23 return 0 |
| 28 } | 24 } |
| 29 | 25 |
| 30 | 26 |
| 31 set testfile "mb-templates" | 27 standard_testfile .cc |
| 32 set srcfile ${testfile}.cc | |
| 33 set binfile ${objdir}/${subdir}/${testfile} | |
| 34 | 28 |
| 35 if [get_compiler_info ${binfile} "c++"] { | 29 if [get_compiler_info "c++"] { |
| 36 return -1 | 30 return -1 |
| 37 } | 31 } |
| 38 | 32 |
| 39 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug c++}] != "" } { | 33 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { |
| 40 untested mb-templates.exp | 34 return -1 |
| 41 return -1 | |
| 42 } | 35 } |
| 43 | 36 |
| 44 gdb_exit | |
| 45 gdb_start | |
| 46 gdb_reinitialize_dir $srcdir/$subdir | |
| 47 gdb_load ${binfile} | |
| 48 | |
| 49 set bp_location [gdb_get_line_number "set breakpoint here"] | 37 set bp_location [gdb_get_line_number "set breakpoint here"] |
| 50 | 38 |
| 51 # Set a breakpoint with multiple locations | 39 # Set a breakpoint with multiple locations |
| 52 # and a condition. | 40 # and a condition. |
| 53 | 41 |
| 54 gdb_test "break $srcfile:$bp_location if i==1" \ | 42 gdb_test "break $srcfile:$bp_location if i==1" \ |
| 55 "Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \ | 43 "Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \ |
| 56 "initial condition: set breakpoint" | 44 "initial condition: set breakpoint" |
| 57 | 45 |
| 58 gdb_run_cmd | 46 gdb_run_cmd |
| 59 gdb_expect { | 47 |
| 48 set test "initial condition: run to breakpoint" |
| 49 gdb_test_multiple "" $test { |
| 60 -re "Breakpoint \[0-9\]+,.*foo<int> \\(i=1\\).*$gdb_prompt $" { | 50 -re "Breakpoint \[0-9\]+,.*foo<int> \\(i=1\\).*$gdb_prompt $" { |
| 61 » pass "initial condition: run to breakpoint" | 51 » pass $test |
| 62 } | 52 » break |
| 63 -re "$gdb_prompt $" { | |
| 64 » fail "initial condition: run to breakpoint" | |
| 65 } | |
| 66 timeout { | |
| 67 » fail "initial condition: run to breakpoint (timeout)" | |
| 68 } | 53 } |
| 69 } | 54 } |
| 70 | 55 |
| 71 gdb_test "continue" \ | 56 gdb_test "continue" \ |
| 72 ".*Breakpoint.*foo<double> \\(i=1\\).*" \ | 57 ".*Breakpoint.*foo<double> \\(i=1\\).*" \ |
| 73 "initial condition: run to breakpoint 2" | 58 "initial condition: run to breakpoint 2" |
| 74 | 59 |
| 75 # Set breakpoint with multiple locations. | 60 # Set breakpoint with multiple locations. |
| 76 # Separately set the condition. | 61 # Separately set the condition. |
| 77 gdb_exit | 62 |
| 78 gdb_start | 63 delete_breakpoints |
| 79 gdb_reinitialize_dir $srcdir/$subdir | 64 gdb_test "kill" "" "kill" \ |
| 80 gdb_load ${binfile} | 65 {Kill the program being debugged\? \(y or n\) } "y" |
| 81 | 66 |
| 82 gdb_test "break $srcfile:$bp_location" \ | 67 gdb_test "break $srcfile:$bp_location" \ |
| 83 "Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \ | 68 "Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \ |
| 84 "separate condition: set breakpoint" | 69 "separate condition: set breakpoint" |
| 85 | 70 |
| 86 gdb_test_no_output "condition 1 i==1" \ | 71 gdb_test_no_output {condition $bpnum i==1} \ |
| 87 "separate condition: set condition" | 72 "separate condition: set condition" |
| 88 | 73 |
| 89 gdb_run_cmd | 74 gdb_run_cmd |
| 90 gdb_expect { | 75 gdb_expect { |
| 91 -re "Breakpoint \[0-9\]+,.*foo<int> \\(i=1\\).*$gdb_prompt $" { | 76 -re "Breakpoint \[0-9\]+,.*foo<int> \\(i=1\\).*$gdb_prompt $" { |
| 92 pass "separate condition: run to breakpoint" | 77 pass "separate condition: run to breakpoint" |
| 93 } | 78 } |
| 94 -re "$gdb_prompt $" { | 79 -re "$gdb_prompt $" { |
| 95 fail "separate condition: run to breakpoint" | 80 fail "separate condition: run to breakpoint" |
| 96 } | 81 } |
| 97 timeout { | 82 timeout { |
| 98 fail "separate condition: run to breakpoint (timeout)" | 83 fail "separate condition: run to breakpoint (timeout)" |
| 99 } | 84 } |
| 100 } | 85 } |
| 101 | 86 |
| 102 gdb_test "continue" \ | 87 gdb_test "continue" \ |
| 103 ".*Breakpoint.*foo<double> \\(i=1\\).*" \ | 88 ".*Breakpoint.*foo<double> \\(i=1\\).*" \ |
| 104 "separate condition: run to breakpoint 2" | 89 "separate condition: run to breakpoint 2" |
| 105 | 90 |
| 106 # Try disabling a single location. We also test | 91 # Try disabling a single location. We also test |
| 107 # that at least in simple cases, the enable/disable | 92 # that at least in simple cases, the enable/disable |
| 108 # state of locations surive "run". | 93 # state of locations surive "run". |
| 109 gdb_test_no_output "disable 1.1" "disabling location: disable" | 94 gdb_test_no_output {disable $bpnum.1} "disabling location: disable" |
| 110 | 95 |
| 111 gdb_run_cmd | 96 gdb_run_cmd |
| 112 gdb_expect { | 97 gdb_expect { |
| 113 -re "Breakpoint \[0-9\]+,.*foo<double> \\(i=1\\).*$gdb_prompt $" { | 98 -re "Breakpoint \[0-9\]+,.*foo<double> \\(i=1\\).*$gdb_prompt $" { |
| 114 pass "disabling location: run to breakpoint" | 99 pass "disabling location: run to breakpoint" |
| 115 } | 100 } |
| 116 -re "$gdb_prompt $" { | 101 -re "$gdb_prompt $" { |
| 117 fail "disabling location: run to breakpoint" | 102 fail "disabling location: run to breakpoint" |
| 118 } | 103 } |
| 119 timeout { | 104 timeout { |
| 120 fail "disabling location: run to breakpoint (timeout)" | 105 fail "disabling location: run to breakpoint (timeout)" |
| 121 } | 106 } |
| 122 } | 107 } |
| 123 | 108 |
| 124 # Try disabling entire breakpoint | 109 # Try disabling entire breakpoint |
| 125 gdb_test_no_output "enable 1.1" "disabling location: enable" | 110 gdb_test_no_output {enable $bpnum.1} "disabling location: enable" |
| 126 | 111 |
| 127 | 112 |
| 128 gdb_test_no_output "disable 1" "disable breakpoint: disable" | 113 gdb_test_no_output {disable $bpnum} "disable breakpoint: disable" |
| 129 | 114 |
| 130 gdb_run_cmd | 115 gdb_run_cmd |
| 131 gdb_expect { | 116 gdb_expect { |
| 132 -re "$inferior_exited_re normally.*$gdb_prompt $" { | 117 -re "$inferior_exited_re normally.*$gdb_prompt $" { |
| 133 pass "disable breakpoint: run to breakpoint" | 118 pass "disable breakpoint: run to breakpoint" |
| 134 } | 119 } |
| 135 -re "$gdb_prompt $" { | 120 -re "$gdb_prompt $" { |
| 136 fail "disable breakpoint: run to breakpoint" | 121 fail "disable breakpoint: run to breakpoint" |
| 137 } | 122 } |
| 138 timeout { | 123 timeout { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 163 |
| 179 gdb_test "break $srcfile:$bp_location" \ | 164 gdb_test "break $srcfile:$bp_location" \ |
| 180 "Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \ | 165 "Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \ |
| 181 "set multi_line_foo breakpoint" | 166 "set multi_line_foo breakpoint" |
| 182 gdb_test "continue" \ | 167 gdb_test "continue" \ |
| 183 ".*Breakpoint.*multi_line_foo<int> \\(i=0\\).*" \ | 168 ".*Breakpoint.*multi_line_foo<int> \\(i=0\\).*" \ |
| 184 "run to multi_line_foo breakpoint 2 <int>" | 169 "run to multi_line_foo breakpoint 2 <int>" |
| 185 gdb_test "continue" \ | 170 gdb_test "continue" \ |
| 186 ".*Breakpoint.*multi_line_foo<double> \\(i=0\\).*" \ | 171 ".*Breakpoint.*multi_line_foo<double> \\(i=0\\).*" \ |
| 187 "run to multi_line_foo breakpoint 2 <double>" | 172 "run to multi_line_foo breakpoint 2 <double>" |
| OLD | NEW |