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