Commit | Line | Data |
---|---|---|
c5a57081 | 1 | # Copyright 1998, 2007-2012 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 | ||
18 | load_lib "trace-support.exp"; | |
19 | ||
c906108c SS |
20 | |
21 | gdb_exit | |
22 | gdb_start | |
f8b7eaf3 DJ |
23 | set testfile "actions" |
24 | set srcfile ${testfile}.c | |
25 | set binfile $objdir/$subdir/passcount | |
26 | if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ | |
27 | executable {debug nowarnings}] != "" } { | |
28 | untested passcount.exp | |
29 | return -1 | |
c906108c SS |
30 | } |
31 | gdb_reinitialize_dir $srcdir/$subdir | |
32 | ||
33 | # If testing on a remote host, download the source file. | |
34 | # remote_download host $srcdir/$subdir/$srcfile | |
35 | ||
36 | gdb_file_cmd $binfile | |
37 | ||
38 | # define relative source line numbers: | |
39 | # all subsequent line numbers are relative to this first one (baseline) | |
40 | set baseline [gdb_find_recursion_test_baseline $srcfile]; | |
41 | if { $baseline == -1 } then { | |
42 | fail "Could not find gdb_recursion_test function" | |
43 | return; | |
44 | } | |
45 | ||
46 | set testline1 [expr $baseline + 3] | |
47 | ||
48 | # | |
49 | # test "passcount" command | |
50 | # | |
51 | ||
52 | gdb_delete_tracepoints | |
53 | set trcpt1 [gdb_gettpnum gdb_c_test]; | |
54 | set trcpt2 [gdb_gettpnum gdb_asm_test]; | |
55 | set trcpt3 [gdb_gettpnum $testline1]; | |
56 | if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then { | |
57 | fail "setting tracepoints" | |
58 | return; | |
59 | } | |
60 | ||
61 | # 4.1 passcount of specified tracepoint | |
62 | ||
63 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
64 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
65 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
66 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
67 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ | |
c906108c SS |
68 | "4.1a: set three tracepoints, passcounts all zero" |
69 | ||
70 | gdb_test "passcount 2 $trcpt1" \ | |
71 | "Setting tracepoint $trcpt1.s passcount to 2" \ | |
72 | "4.1b: set 1st tracepoint's passcount to two" | |
73 | ||
74 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
75 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
76 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
77 | \[\t \]+pass count 2 .* | |
78 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
79 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ | |
c906108c SS |
80 | "4.1c: verify 1st tracepoint's passcount set to two" |
81 | ||
82 | gdb_test "passcount 4 $trcpt2" \ | |
83 | "Setting tracepoint $trcpt2.s passcount to 4" \ | |
84 | "4.1d: set 2nd tracepoint's passcount to four" | |
85 | ||
86 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
87 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
88 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
89 | \[\t \]+pass count 2 .* | |
90 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
91 | \[\t \]+pass count 4 .* | |
92 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \ | |
c906108c SS |
93 | "4.1c: verify 2nd tracepoint's passcount set to four" |
94 | ||
95 | # 4.2 passcount of last (default) tracepoint | |
96 | ||
97 | gdb_test "passcount 6" \ | |
98 | "Setting tracepoint $trcpt3.s passcount to 6" \ | |
99 | "4.2b: set last (default) tp's passcount to six" | |
100 | ||
101 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
102 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
103 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
104 | \[\t \]+pass count 2 .* | |
105 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
106 | \[\t \]+pass count 4 .* | |
107 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. | |
108 | \[\t \]+pass count 6 .*" \ | |
c906108c SS |
109 | "4.2b: verify last (default) tp's passcount set to six" |
110 | ||
111 | # 4.3 run until stopped explicitly by user | |
112 | # [deferred to dynamic test section] | |
113 | ||
114 | # 4.4 reset the previously set passcounts to new values | |
115 | ||
116 | gdb_test "passcount 7" \ | |
117 | "Setting tracepoint $trcpt3.s passcount to 7" \ | |
118 | "4.4a: reset last (default) tp's passcount to seven" | |
119 | ||
120 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
121 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
122 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
123 | \[\t \]+pass count 2 .* | |
124 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
125 | \[\t \]+pass count 4 .* | |
126 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. | |
127 | \[\t \]+pass count 7 .*" \ | |
c906108c SS |
128 | "4.4a: verify reset last (default) tp's passcount to seven" |
129 | ||
130 | gdb_test "passcount 5 $trcpt2" \ | |
131 | "Setting tracepoint $trcpt2.s passcount to 5" \ | |
132 | "4.4b: reset second tracepoint's passcount to five" | |
133 | ||
134 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
135 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
136 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
137 | \[\t \]+pass count 2 .* | |
138 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
139 | \[\t \]+pass count 5 .* | |
140 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. | |
141 | \[\t \]+pass count 7 .*" \ | |
c906108c SS |
142 | "4.4c: verify reset second tracepoint's passcount to five" |
143 | ||
144 | # 4.20 <FIXME test number> passcount for "all" | |
145 | ||
146 | gdb_test "passcount 3 all" \ | |
147 | ".*$trcpt1.s pass.* 3.*$trcpt2.s pass.* 3.*$trcpt3.s pass.* 3" \ | |
148 | "4.20a: set all three passcounts to three" | |
149 | ||
150 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
151 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
152 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
153 | \[\t \]+pass count 3 .* | |
154 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
155 | \[\t \]+pass count 3 .* | |
156 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. | |
157 | \[\t \]+pass count 3 .*" \ | |
c906108c SS |
158 | "4.20a: set all three passcounts to three" |
159 | ||
160 | gdb_test "passcount 4 all" \ | |
161 | ".*$trcpt1.s pass.* 4.*$trcpt2.s pass.* 4.*$trcpt3.s pass.* 4" \ | |
162 | "4.20a: reset all three passcounts to four" | |
163 | ||
164 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
165 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
166 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
167 | \[\t \]+pass count 4 .* | |
168 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
169 | \[\t \]+pass count 4 .* | |
170 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. | |
171 | \[\t \]+pass count 4 .*" \ | |
c906108c SS |
172 | "4.20b: reset all three passcounts to four" |
173 | ||
174 | # 4.5 Verify trace stops on first "satisfied" passcount | |
175 | # [deferred to dynamic test section] | |
176 | ||
177 | # 4.6 minimum passcount boundary condition | |
178 | ||
179 | gdb_test "passcount 0 $trcpt1" \ | |
180 | "Setting tracepoint $trcpt1.s passcount to 0" \ | |
181 | "4.6: set passcount to zero" | |
182 | ||
183 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
184 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
185 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
186 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
187 | \[\t \]+pass count 4 .* | |
188 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. | |
189 | \[\t \]+pass count 4 .*" \ | |
c906108c SS |
190 | "4.6: set passcount to zero" |
191 | ||
192 | # 4.7 (test a very large passcount) | |
193 | ||
194 | gdb_test "passcount 32767 $trcpt1" \ | |
195 | "Setting tracepoint $trcpt1.s passcount to 32767" \ | |
196 | "4.7: set passcount to large number (32767)" | |
197 | ||
198 | gdb_test "info tracepoints" \ | |
1042e4c0 SS |
199 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
200 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. | |
201 | \[\t \]+pass count 32767 .* | |
202 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. | |
203 | \[\t \]+pass count 4 .* | |
204 | \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+. | |
205 | \[\t \]+pass count 4 .*" \ | |
c906108c SS |
206 | "4.7: set passcount to large number (32767)" |
207 | ||
208 | # 4.8 set passcount for invalid tracepoint | |
209 | ||
210 | gdb_test "passcount 1 [expr $trcpt2 + $trcpt3]" \ | |
211 | "No tracepoint number [expr $trcpt2 + $trcpt3]." \ | |
212 | "4.8: invalid tracepoint number in passcount" | |
213 | ||
214 | # 4.9 help passcount | |
215 | gdb_test "help passcount" "Set the passcount for a tracepoint.*" \ | |
216 | "4.9: help passcount" |