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