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