]>
Commit | Line | Data |
---|---|---|
213516ef | 1 | # Copyright 2012-2023 Free Software Foundation, Inc. |
6f380991 AB |
2 | |
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. | |
7 | # | |
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. | |
12 | # | |
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/>. | |
15 | ||
16 | standard_testfile | |
17 | ||
98bf5c02 | 18 | if { [build_executable "failed to prepare" ${testfile}] } { |
6f380991 AB |
19 | return -1 |
20 | } | |
21 | ||
22 | # Setup for the test, create COUNT breakpoints at the function BREAKPT. | |
23 | proc test_setup { count } { | |
24 | global srcfile | |
25 | global binfile | |
26 | ||
27 | clean_restart ${binfile} | |
28 | ||
65a33d75 | 29 | if {![runto_main]} { |
6f380991 AB |
30 | return 0 |
31 | } | |
32 | ||
33 | for {set i 1} {$i <= $count} {incr i} { | |
34 | gdb_breakpoint "breakpt" | |
35 | gdb_test_no_output "set \$bp_num_${i} = \$bpnum" | |
36 | } | |
37 | ||
38 | gdb_test "step" \ | |
39 | "spacer \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
40 | "step to place breakpoints" | |
41 | ||
42 | return 1 | |
43 | } | |
44 | ||
45 | ||
46 | # Test 1: Create two breakpoints at BREAKPT. Delete #1 and expect to stop | |
47 | # at #2. | |
48 | with_test_prefix "del_1_stop_2" { | |
49 | test_setup 2 | |
50 | ||
51 | gdb_test_no_output {delete $bp_num_1} | |
52 | ||
53 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
54 | "delete #1, stop at #2" | |
55 | } | |
56 | ||
57 | # Test 2: Create two breakpoints at BREAKPT. Delete #2 and expect to stop | |
58 | # at #1. | |
59 | with_test_prefix "del_2_stop_1" { | |
60 | test_setup 2 | |
61 | ||
62 | gdb_test_no_output {delete $bp_num_2} | |
63 | ||
64 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
65 | "delete #2, stop at #1" | |
66 | } | |
67 | ||
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" { | |
71 | test_setup 3 | |
72 | ||
73 | gdb_test_no_output {disable $bp_num_1} | |
74 | ||
75 | gdb_test "step" ".*" | |
76 | ||
77 | gdb_test_no_output {delete $bp_num_2} | |
78 | ||
79 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
80 | "disable #1, delete #2, stop at #3" | |
81 | } | |
82 | ||
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" { | |
86 | test_setup 3 | |
87 | ||
88 | gdb_test_no_output {disable $bp_num_2} | |
89 | ||
90 | gdb_test "step" ".*" | |
91 | ||
92 | gdb_test_no_output {delete $bp_num_1} | |
93 | ||
94 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
95 | "disable #2, delete #1, stop at #3" | |
96 | } | |
97 | ||
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" { | |
101 | test_setup 3 | |
102 | ||
103 | gdb_test_no_output {disable $bp_num_1} | |
104 | ||
105 | gdb_test "step" ".*" | |
106 | ||
107 | gdb_test_no_output {delete $bp_num_3} | |
108 | ||
109 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
110 | "disable #1, delete #3, stop at #2" | |
111 | } | |
112 | ||
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" { | |
116 | test_setup 3 | |
117 | ||
118 | gdb_test_no_output {disable $bp_num_3} | |
119 | ||
120 | gdb_test "step" ".*" | |
121 | ||
122 | gdb_test_no_output {delete $bp_num_1} | |
123 | ||
124 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
125 | "disable #3, delete #1, stop at #2" | |
126 | } | |
127 | ||
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" { | |
131 | test_setup 3 | |
132 | ||
133 | gdb_test_no_output {disable $bp_num_2} | |
134 | ||
135 | gdb_test "step" ".*" | |
136 | ||
137 | gdb_test_no_output {delete $bp_num_3} | |
138 | ||
139 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
140 | "disable #2, delete #3, stop at #1" | |
141 | } | |
142 | ||
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" { | |
146 | test_setup 3 | |
147 | ||
148 | gdb_test_no_output {disable $bp_num_3} | |
149 | ||
150 | gdb_test "step" ".*" | |
151 | ||
152 | gdb_test_no_output {delete $bp_num_2} | |
153 | ||
154 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
155 | "disable #3, delete #2, stop at #1" | |
156 | } |