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