Commit | Line | Data |
---|---|---|
e2882c85 | 1 | # Copyright 1998-2018 Free Software Foundation, Inc. |
c906108c SS |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
c906108c SS |
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. | |
e22f8b7c | 12 | # |
c906108c | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 15 | |
c906108c SS |
16 | # This file was written by Michael Snyder (msnyder@cygnus.com) |
17 | ||
4ec70201 | 18 | load_lib "trace-support.exp" |
c906108c | 19 | |
c906108c SS |
20 | |
21 | gdb_exit | |
22 | gdb_start | |
23 | ||
497a5eb0 | 24 | standard_testfile actions.c |
8bca2978 SL |
25 | |
26 | if ![gdb_trace_common_supports_arch] { | |
27 | unsupported "no trace-common.h support for arch" | |
28 | return -1 | |
29 | } | |
30 | ||
f8b7eaf3 DJ |
31 | if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ |
32 | executable {debug nowarnings}] != "" } { | |
84c93cd5 | 33 | untested "failed to compile" |
f8b7eaf3 | 34 | return -1 |
c906108c SS |
35 | } |
36 | gdb_reinitialize_dir $srcdir/$subdir | |
37 | ||
38 | # If testing on a remote host, download the source file. | |
39 | # remote_download host $srcdir/$subdir/$srcfile | |
40 | ||
41 | gdb_file_cmd $binfile | |
42 | ||
43 | # define relative source line numbers: | |
44 | # all subsequent line numbers are relative to this first one (baseline) | |
4ec70201 | 45 | set baseline [gdb_find_recursion_test_baseline $srcfile] |
c906108c | 46 | if { $baseline == -1 } then { |
bc6c7af4 | 47 | fail "could not find gdb_recursion_test function" |
4ec70201 | 48 | return |
c906108c SS |
49 | } |
50 | set testline1 [expr $baseline + 4] | |
51 | ||
52 | # | |
53 | # test "delete tracepoints" command | |
54 | # | |
55 | ||
56 | # 3.1 delete tracepoints (all) | |
57 | gdb_delete_tracepoints | |
58 | gdb_test "trace gdb_c_test" "Tracepoint \[0-9\]+ at .*" "set tracepoint 1" | |
59 | gdb_test "trace gdb_asm_test" "Tracepoint \[0-9\]+ at .*" "set tracepoint 2" | |
60 | gdb_test "trace $testline1" "Tracepoint \[0-9\]+ at .*" "set tracepoint 3" | |
61 | ||
62 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
63 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
64 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
f2a8bc8a | 65 | \[\t \]+not installed on target. |
1042e4c0 | 66 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. |
f2a8bc8a YQ |
67 | \[\t \]+not installed on target. |
68 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. | |
69 | \[\t \]+not installed on target." \ | |
c906108c SS |
70 | "3.1a: set three tracepoints" |
71 | ||
0ab48859 MS |
72 | gdb_test "delete tracepoints" \ |
73 | "" \ | |
74 | "3.1b: delete all tracepoints" \ | |
75 | "Delete all tracepoints.*y or n.*$" \ | |
76 | "y" | |
77 | ||
c906108c SS |
78 | |
79 | # 3.2 delete tracepoint <n> | |
80 | gdb_delete_tracepoints | |
4ec70201 PA |
81 | set trcpt1 [gdb_gettpnum gdb_c_test] |
82 | set trcpt2 [gdb_gettpnum gdb_asm_test] | |
83 | set trcpt3 [gdb_gettpnum $testline1] | |
c906108c SS |
84 | if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then { |
85 | fail "setting tracepoints" | |
4ec70201 | 86 | return |
c906108c SS |
87 | } |
88 | ||
89 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
90 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
91 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
f2a8bc8a | 92 | \[\t \]+not installed on target. |
1042e4c0 | 93 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. |
f2a8bc8a YQ |
94 | \[\t \]+not installed on target. |
95 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. | |
96 | \[\t \]+not installed on target." \ | |
c906108c SS |
97 | "3.2a: set three tracepoints" |
98 | ||
35ec993f | 99 | #gdb_test_no_output "delete tracepoint $trcpt1" "" |
0ab48859 | 100 | gdb_test_multiple "delete tracepoint $trcpt1" "3.2b: delete first tracepoint" { |
c906108c SS |
101 | -re "No tracepoint number.*$gdb_prompt $" { |
102 | fail "3.2b: delete first tracepoint" | |
103 | } | |
104 | -re ".*\[Ee\]rror.*$gdb_prompt $" { | |
105 | fail "3.2b: delete first tracepoint" | |
106 | } | |
107 | -re "$gdb_prompt $" { | |
108 | pass "3.2b: delete first tracepoint" | |
109 | } | |
c906108c SS |
110 | } |
111 | ||
1042e4c0 SS |
112 | gdb_test "info tracepoints" \ |
113 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* | |
114 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
f2a8bc8a YQ |
115 | \[\t \]+not installed on target. |
116 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. | |
117 | \[\t \]+not installed on target." \ | |
1042e4c0 | 118 | "3.2c: verify delete first tracepoint" |
c906108c | 119 | |
35ec993f | 120 | #gdb_test_no_output "delete tracepoint $trcpt2" "" |
0ab48859 | 121 | gdb_test_multiple "delete tracepoint $trcpt2" "3.2d: delete second tracepoint" { |
c906108c SS |
122 | -re "No tracepoint number.*$gdb_prompt $" { |
123 | fail "3.2d: delete second tracepoint" | |
124 | } | |
125 | -re ".*\[Ee\]rror.*$gdb_prompt $" { | |
126 | fail "3.2d: delete second tracepoint" | |
127 | } | |
128 | -re "$gdb_prompt $" { | |
129 | pass "3.2d: delete second tracepoint" | |
130 | } | |
c906108c SS |
131 | } |
132 | ||
1042e4c0 SS |
133 | gdb_test "info tracepoints" \ |
134 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* | |
f2a8bc8a YQ |
135 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. |
136 | \[\t \]+not installed on target." \ | |
1042e4c0 | 137 | "3.2e: verify delete second tracepoint" |
c906108c | 138 | |
35ec993f | 139 | #gdb_test_no_output "delete tracepoint $trcpt3" "" |
0ab48859 | 140 | gdb_test_multiple "delete tracepoint $trcpt3" "3.2f: delete third tracepoint" { |
c906108c SS |
141 | -re "No tracepoint number.*$gdb_prompt $" { |
142 | fail "3.2f: delete third tracepoint" | |
143 | } | |
144 | -re ".*\[Ee\]rror.*$gdb_prompt $" { | |
145 | fail "3.2f: delete third tracepoint" | |
146 | } | |
147 | -re "$gdb_prompt $" { | |
148 | pass "3.2f: delete third tracepoint" | |
149 | } | |
c906108c SS |
150 | } |
151 | ||
152 | # send_gdb "ARF! \\n\n" | |
1042e4c0 SS |
153 | gdb_test "info tracepoints" \ |
154 | "No tracepoints." \ | |
155 | "3.2g: verify delete third tracepoint" | |
c906108c SS |
156 | |
157 | # 3.3 delete three tracepoints at once | |
158 | gdb_delete_tracepoints | |
4ec70201 PA |
159 | set trcpt1 [gdb_gettpnum gdb_c_test] |
160 | set trcpt2 [gdb_gettpnum gdb_asm_test] | |
161 | set trcpt3 [gdb_gettpnum $testline1] | |
c906108c SS |
162 | if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then { |
163 | fail "setting tracepoints" | |
4ec70201 | 164 | return |
c906108c SS |
165 | } |
166 | ||
167 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
168 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
169 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
f2a8bc8a | 170 | \[\t \]+not installed on target. |
1042e4c0 | 171 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. |
f2a8bc8a YQ |
172 | \[\t \]+not installed on target. |
173 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. | |
174 | \[\t \]+not installed on target." \ | |
c906108c SS |
175 | "3.3a: set three tracepoints" |
176 | ||
35ec993f | 177 | #gdb_test_no_output "delete tracepoint $trcpt1 $trcpt2 $trcpt3" "" |
0ab48859 MS |
178 | gdb_test_multiple "delete tracepoint $trcpt1 $trcpt2 $trcpt3" \ |
179 | "3.3b: delete three tracepoints" { | |
180 | -re "No tracepoint number.*$gdb_prompt $" { | |
181 | fail "3.3b: delete three tracepoints" | |
182 | } | |
183 | -re ".*\[Ee\]rror.*$gdb_prompt $" { | |
184 | fail "3.3b: delete three tracepoints" | |
185 | } | |
186 | -re "$gdb_prompt $" { | |
187 | pass "3.3b: delete three tracepoints" | |
188 | } | |
c906108c | 189 | } |
c906108c | 190 | |
1042e4c0 SS |
191 | gdb_test "info tracepoints" \ |
192 | "No tracepoints." \ | |
193 | "3.3c: verify delete three tracepoints" | |
c906108c SS |
194 | |
195 | # 3.4 delete invalid tracepoint number | |
196 | gdb_test "delete tracepoint [expr $trcpt2 + $trcpt3]" \ | |
1042e4c0 | 197 | "No breakpoint number [expr $trcpt2 + $trcpt3]." \ |
c906108c SS |
198 | "3.4: delete invalid tracepoint number" |
199 | ||
200 | # 3.5 delete tracepoint number zero | |
1042e4c0 | 201 | gdb_test "delete tracepoint 0" "bad breakpoint number at or near '0'" \ |
c906108c SS |
202 | "3.5: delete tracepoint number zero" |
203 | ||
204 | # 3.6 help delete tracepoints | |
205 | gdb_test "help delete tracepoints" \ | |
206 | "Delete specified tracepoints.*" \ | |
207 | "3.6: help delete tracepoints" |