2011-02-16 Tom Tromey <tromey@redhat.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.trace / passcount.exp
CommitLineData
7b6bb8da
JB
1# Copyright 1998, 2007, 2008, 2009, 2010, 2011
2# Free Software Foundation, Inc.
c906108c
SS
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
e22f8b7c 6# the Free Software Foundation; either version 3 of the License, or
c906108c 7# (at your option) any later version.
e22f8b7c 8#
c906108c
SS
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
e22f8b7c 13#
c906108c 14# You should have received a copy of the GNU General Public License
e22f8b7c 15# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c 16
c906108c
SS
17# This file was written by Michael Snyder (msnyder@cygnus.com)
18
19load_lib "trace-support.exp";
20
21if $tracelevel then {
22 strace $tracelevel
23}
24
c906108c
SS
25
26gdb_exit
27gdb_start
f8b7eaf3
DJ
28set testfile "actions"
29set srcfile ${testfile}.c
30set binfile $objdir/$subdir/passcount
31if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
32 executable {debug nowarnings}] != "" } {
33 untested passcount.exp
34 return -1
c906108c
SS
35}
36gdb_reinitialize_dir $srcdir/$subdir
37
38# If testing on a remote host, download the source file.
39# remote_download host $srcdir/$subdir/$srcfile
40
41gdb_file_cmd $binfile
42
43# define relative source line numbers:
44# all subsequent line numbers are relative to this first one (baseline)
45set baseline [gdb_find_recursion_test_baseline $srcfile];
46if { $baseline == -1 } then {
47 fail "Could not find gdb_recursion_test function"
48 return;
49}
50
51set testline1 [expr $baseline + 3]
52
53#
54# test "passcount" command
55#
56
57gdb_delete_tracepoints
58set trcpt1 [gdb_gettpnum gdb_c_test];
59set trcpt2 [gdb_gettpnum gdb_asm_test];
60set trcpt3 [gdb_gettpnum $testline1];
61if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then {
62 fail "setting tracepoints"
63 return;
64}
65
66# 4.1 passcount of specified tracepoint
67
68gdb_test "info tracepoints" \
1042e4c0
SS
69 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
70\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
71\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
72\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
c906108c
SS
73 "4.1a: set three tracepoints, passcounts all zero"
74
75gdb_test "passcount 2 $trcpt1" \
76 "Setting tracepoint $trcpt1.s passcount to 2" \
77 "4.1b: set 1st tracepoint's passcount to two"
78
79gdb_test "info tracepoints" \
1042e4c0
SS
80 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
81\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
82\[\t \]+pass count 2 .*
83\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
84\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
c906108c
SS
85 "4.1c: verify 1st tracepoint's passcount set to two"
86
87gdb_test "passcount 4 $trcpt2" \
88 "Setting tracepoint $trcpt2.s passcount to 4" \
89 "4.1d: set 2nd tracepoint's passcount to four"
90
91gdb_test "info tracepoints" \
1042e4c0
SS
92 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
93\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
94\[\t \]+pass count 2 .*
95\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
96\[\t \]+pass count 4 .*
97\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
c906108c
SS
98 "4.1c: verify 2nd tracepoint's passcount set to four"
99
100# 4.2 passcount of last (default) tracepoint
101
102gdb_test "passcount 6" \
103 "Setting tracepoint $trcpt3.s passcount to 6" \
104 "4.2b: set last (default) tp's passcount to six"
105
106gdb_test "info tracepoints" \
1042e4c0
SS
107 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
108\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
109\[\t \]+pass count 2 .*
110\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
111\[\t \]+pass count 4 .*
112\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+.
113\[\t \]+pass count 6 .*" \
c906108c
SS
114 "4.2b: verify last (default) tp's passcount set to six"
115
116# 4.3 run until stopped explicitly by user
117# [deferred to dynamic test section]
118
119# 4.4 reset the previously set passcounts to new values
120
121gdb_test "passcount 7" \
122 "Setting tracepoint $trcpt3.s passcount to 7" \
123 "4.4a: reset last (default) tp's passcount to seven"
124
125gdb_test "info tracepoints" \
1042e4c0
SS
126 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
127\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
128\[\t \]+pass count 2 .*
129\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
130\[\t \]+pass count 4 .*
131\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+.
132\[\t \]+pass count 7 .*" \
c906108c
SS
133 "4.4a: verify reset last (default) tp's passcount to seven"
134
135gdb_test "passcount 5 $trcpt2" \
136 "Setting tracepoint $trcpt2.s passcount to 5" \
137 "4.4b: reset second tracepoint's passcount to five"
138
139gdb_test "info tracepoints" \
1042e4c0
SS
140 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
141\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
142\[\t \]+pass count 2 .*
143\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
144\[\t \]+pass count 5 .*
145\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+.
146\[\t \]+pass count 7 .*" \
c906108c
SS
147 "4.4c: verify reset second tracepoint's passcount to five"
148
149# 4.20 <FIXME test number> passcount for "all"
150
151gdb_test "passcount 3 all" \
152 ".*$trcpt1.s pass.* 3.*$trcpt2.s pass.* 3.*$trcpt3.s pass.* 3" \
153 "4.20a: set all three passcounts to three"
154
155gdb_test "info tracepoints" \
1042e4c0
SS
156 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
157\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
158\[\t \]+pass count 3 .*
159\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
160\[\t \]+pass count 3 .*
161\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+.
162\[\t \]+pass count 3 .*" \
c906108c
SS
163 "4.20a: set all three passcounts to three"
164
165gdb_test "passcount 4 all" \
166 ".*$trcpt1.s pass.* 4.*$trcpt2.s pass.* 4.*$trcpt3.s pass.* 4" \
167 "4.20a: reset all three passcounts to four"
168
169gdb_test "info tracepoints" \
1042e4c0
SS
170 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
171\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
172\[\t \]+pass count 4 .*
173\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
174\[\t \]+pass count 4 .*
175\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+.
176\[\t \]+pass count 4 .*" \
c906108c
SS
177 "4.20b: reset all three passcounts to four"
178
179# 4.5 Verify trace stops on first "satisfied" passcount
180# [deferred to dynamic test section]
181
182# 4.6 minimum passcount boundary condition
183
184gdb_test "passcount 0 $trcpt1" \
185 "Setting tracepoint $trcpt1.s passcount to 0" \
186 "4.6: set passcount to zero"
187
188gdb_test "info tracepoints" \
1042e4c0
SS
189 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
190\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
191\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
192\[\t \]+pass count 4 .*
193\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+.
194\[\t \]+pass count 4 .*" \
c906108c
SS
195 "4.6: set passcount to zero"
196
197# 4.7 (test a very large passcount)
198
199gdb_test "passcount 32767 $trcpt1" \
200 "Setting tracepoint $trcpt1.s passcount to 32767" \
201 "4.7: set passcount to large number (32767)"
202
203gdb_test "info tracepoints" \
1042e4c0
SS
204 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
205\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
206\[\t \]+pass count 32767 .*
207\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
208\[\t \]+pass count 4 .*
209\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+.
210\[\t \]+pass count 4 .*" \
c906108c
SS
211 "4.7: set passcount to large number (32767)"
212
213# 4.8 set passcount for invalid tracepoint
214
215gdb_test "passcount 1 [expr $trcpt2 + $trcpt3]" \
216 "No tracepoint number [expr $trcpt2 + $trcpt3]." \
217 "4.8: invalid tracepoint number in passcount"
218
219# 4.9 help passcount
220gdb_test "help passcount" "Set the passcount for a tracepoint.*" \
221 "4.9: help passcount"
This page took 1.036906 seconds and 4 git commands to generate.