1 # Copyright 2012-2022 Free Software Foundation, Inc.
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
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
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/>.
18 if { [build_executable "failed to prepare" ${testfile}] } {
22 # Setup for the test, create COUNT breakpoints at the function BREAKPT.
23 proc test_setup { count } {
27 clean_restart ${binfile}
29 if ![runto_main] then {
33 for {set i 1} {$i <= $count} {incr i} {
34 gdb_breakpoint "breakpt"
35 gdb_test_no_output "set \$bp_num_${i} = \$bpnum"
39 "spacer \\(\\) at .*$srcfile:\[0-9\]+.*" \
40 "step to place breakpoints"
46 # Test 1: Create two breakpoints at BREAKPT. Delete #1 and expect to stop
48 with_test_prefix "del_1_stop_2" {
51 gdb_test_no_output {delete $bp_num_1}
53 gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \
54 "delete #1, stop at #2"
57 # Test 2: Create two breakpoints at BREAKPT. Delete #2 and expect to stop
59 with_test_prefix "del_2_stop_1" {
62 gdb_test_no_output {delete $bp_num_2}
64 gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \
65 "delete #2, stop at #1"
68 # Test 3: Create three breakpoints at BREAKPT. Disable #1, delete #2,
69 # expect to stop at #3.
70 with_test_prefix "dis_1_del_2_stop_3" {
73 gdb_test_no_output {disable $bp_num_1}
77 gdb_test_no_output {delete $bp_num_2}
79 gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \
80 "disable #1, delete #2, stop at #3"
83 # Test 4: Create three breakpoints at BREAKPT. Disable #2, delete #1,
84 # expect to stop at #3.
85 with_test_prefix "dis_2_del_1_stop_3" {
88 gdb_test_no_output {disable $bp_num_2}
92 gdb_test_no_output {delete $bp_num_1}
94 gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \
95 "disable #2, delete #1, stop at #3"
98 # Test 5: Create three breakpoints at BREAKPT. Disable #1, delete #3,
99 # expect to stop at #2.
100 with_test_prefix "dis_1_del_3_stop_1" {
103 gdb_test_no_output {disable $bp_num_1}
107 gdb_test_no_output {delete $bp_num_3}
109 gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \
110 "disable #1, delete #3, stop at #2"
113 # Test 6: Create three breakpoints at BREAKPT. Disable #3, delete #1,
114 # expect to stop at #2
115 with_test_prefix "dis_3_del_1_stop_2" {
118 gdb_test_no_output {disable $bp_num_3}
122 gdb_test_no_output {delete $bp_num_1}
124 gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \
125 "disable #3, delete #1, stop at #2"
128 # Test 7: Create three breakpoints at BREAKPT. Disable #2, delete #3,
129 # expect to stop at #1.
130 with_test_prefix "dis_2_del_3_stop_1" {
133 gdb_test_no_output {disable $bp_num_2}
137 gdb_test_no_output {delete $bp_num_3}
139 gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \
140 "disable #2, delete #3, stop at #1"
143 # Test 8: Create three breakpoints at BREAKPT. Disable #3, delete #2,
144 # expect to stop at #1.
145 with_test_prefix "dis_3_del_2_stop_1" {
148 gdb_test_no_output {disable $bp_num_3}
152 gdb_test_no_output {delete $bp_num_2}
154 gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \
155 "disable #3, delete #2, stop at #1"