Commit | Line | Data |
---|---|---|
618f726f | 1 | # Copyright 2012-2016 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 | ||
18 | if { [prepare_for_testing ${testfile}.exp ${testfile}] } { | |
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 | ||
29 | if ![runto_main] then { | |
30 | fail "can't run to main" | |
31 | return 0 | |
32 | } | |
33 | ||
34 | for {set i 1} {$i <= $count} {incr i} { | |
35 | gdb_breakpoint "breakpt" | |
36 | gdb_test_no_output "set \$bp_num_${i} = \$bpnum" | |
37 | } | |
38 | ||
39 | gdb_test "step" \ | |
40 | "spacer \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
41 | "step to place breakpoints" | |
42 | ||
43 | return 1 | |
44 | } | |
45 | ||
46 | ||
47 | # Test 1: Create two breakpoints at BREAKPT. Delete #1 and expect to stop | |
48 | # at #2. | |
49 | with_test_prefix "del_1_stop_2" { | |
50 | test_setup 2 | |
51 | ||
52 | gdb_test_no_output {delete $bp_num_1} | |
53 | ||
54 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
55 | "delete #1, stop at #2" | |
56 | } | |
57 | ||
58 | # Test 2: Create two breakpoints at BREAKPT. Delete #2 and expect to stop | |
59 | # at #1. | |
60 | with_test_prefix "del_2_stop_1" { | |
61 | test_setup 2 | |
62 | ||
63 | gdb_test_no_output {delete $bp_num_2} | |
64 | ||
65 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
66 | "delete #2, stop at #1" | |
67 | } | |
68 | ||
69 | # Test 3: Create three breakpoints at BREAKPT. Disable #1, delete #2, | |
70 | # expect to stop at #3. | |
71 | with_test_prefix "dis_1_del_2_stop_3" { | |
72 | test_setup 3 | |
73 | ||
74 | gdb_test_no_output {disable $bp_num_1} | |
75 | ||
76 | gdb_test "step" ".*" | |
77 | ||
78 | gdb_test_no_output {delete $bp_num_2} | |
79 | ||
80 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
81 | "disable #1, delete #2, stop at #3" | |
82 | } | |
83 | ||
84 | # Test 4: Create three breakpoints at BREAKPT. Disable #2, delete #1, | |
85 | # expect to stop at #3. | |
86 | with_test_prefix "dis_2_del_1_stop_3" { | |
87 | test_setup 3 | |
88 | ||
89 | gdb_test_no_output {disable $bp_num_2} | |
90 | ||
91 | gdb_test "step" ".*" | |
92 | ||
93 | gdb_test_no_output {delete $bp_num_1} | |
94 | ||
95 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
96 | "disable #2, delete #1, stop at #3" | |
97 | } | |
98 | ||
99 | # Test 5: Create three breakpoints at BREAKPT. Disable #1, delete #3, | |
100 | # expect to stop at #2. | |
101 | with_test_prefix "dis_1_del_3_stop_1" { | |
102 | test_setup 3 | |
103 | ||
104 | gdb_test_no_output {disable $bp_num_1} | |
105 | ||
106 | gdb_test "step" ".*" | |
107 | ||
108 | gdb_test_no_output {delete $bp_num_3} | |
109 | ||
110 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
111 | "disable #1, delete #3, stop at #2" | |
112 | } | |
113 | ||
114 | # Test 6: Create three breakpoints at BREAKPT. Disable #3, delete #1, | |
115 | # expect to stop at #2 | |
116 | with_test_prefix "dis_3_del_1_stop_2" { | |
117 | test_setup 3 | |
118 | ||
119 | gdb_test_no_output {disable $bp_num_3} | |
120 | ||
121 | gdb_test "step" ".*" | |
122 | ||
123 | gdb_test_no_output {delete $bp_num_1} | |
124 | ||
125 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
126 | "disable #3, delete #1, stop at #2" | |
127 | } | |
128 | ||
129 | # Test 7: Create three breakpoints at BREAKPT. Disable #2, delete #3, | |
130 | # expect to stop at #1. | |
131 | with_test_prefix "dis_2_del_3_stop_1" { | |
132 | test_setup 3 | |
133 | ||
134 | gdb_test_no_output {disable $bp_num_2} | |
135 | ||
136 | gdb_test "step" ".*" | |
137 | ||
138 | gdb_test_no_output {delete $bp_num_3} | |
139 | ||
140 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
141 | "disable #2, delete #3, stop at #1" | |
142 | } | |
143 | ||
144 | # Test 8: Create three breakpoints at BREAKPT. Disable #3, delete #2, | |
145 | # expect to stop at #1. | |
146 | with_test_prefix "dis_3_del_2_stop_1" { | |
147 | test_setup 3 | |
148 | ||
149 | gdb_test_no_output {disable $bp_num_3} | |
150 | ||
151 | gdb_test "step" ".*" | |
152 | ||
153 | gdb_test_no_output {delete $bp_num_2} | |
154 | ||
155 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, breakpt \\(\\) at .*$srcfile:\[0-9\]+.*" \ | |
156 | "disable #3, delete #2, stop at #1" | |
157 | } |