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 |
|
|
|
28 |
|
|
set testfile "actions"
|
29 |
|
|
set srcfile ${testfile}.c
|
30 |
|
|
set binfile $objdir/$subdir/actions
|
31 |
|
|
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
|
32 |
|
|
executable {debug nowarnings}] != "" } {
|
33 |
|
|
untested actions.exp
|
34 |
|
|
return -1
|
35 |
|
|
}
|
36 |
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
37 |
|
|
|
38 |
|
|
# If testing on a remote host, download the source file.
|
39 |
|
|
# remote_download host $srcdir/$subdir/$srcfile
|
40 |
|
|
|
41 |
|
|
gdb_file_cmd $binfile
|
42 |
|
|
|
43 |
|
|
# define relative source line numbers:
|
44 |
|
|
# all subsequent line numbers are relative to this first one (baseline)
|
45 |
|
|
|
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 + 7]
|
53 |
|
|
|
54 |
|
|
#
|
55 |
|
|
# test actions 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 |
|
|
# 5.1 actions of specified tracepoint
|
68 |
|
|
|
69 |
|
|
gdb_test_multiple "info tracepoints" "5.1a: set three tracepoints, no actions" {
|
70 |
|
|
-re "Actions for tracepoint \[0-9\]+:.*$gdb_prompt $" {
|
71 |
|
|
fail "5.1a: testsuite failure (tracepoint already has action)!"
|
72 |
|
|
}
|
73 |
|
|
-re "No tracepoints.*$gdb_prompt $" {
|
74 |
|
|
fail "5.1a: set three tracepoints, no actions (No tracepoints!)"
|
75 |
|
|
}
|
76 |
|
|
-re "$gdb_prompt $" {
|
77 |
|
|
pass "5.1a: set three tracepoints, no actions"
|
78 |
|
|
}
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
gdb_trace_setactions "5.1b: set actions for first tracepoint" \
|
82 |
|
|
"$trcpt1" \
|
83 |
|
|
"collect gdb_char_test" "^$"
|
84 |
|
|
|
85 |
|
|
gdb_test "info tracepoints" \
|
86 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
87 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
|
88 |
|
|
\[\t \]+collect gdb_char_test.
|
89 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
|
90 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
|
91 |
|
|
"5.1c: verify actions set for first tracepoint"
|
92 |
|
|
|
93 |
|
|
gdb_trace_setactions "5.1d: set actions for second tracepoint" \
|
94 |
|
|
"$trcpt2" \
|
95 |
|
|
"collect gdb_short_test" "^$"
|
96 |
|
|
|
97 |
|
|
gdb_test "info tracepoints" \
|
98 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
99 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
|
100 |
|
|
\[\t \]+collect gdb_char_test.
|
101 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
|
102 |
|
|
\[\t \]+collect gdb_short_test.
|
103 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
|
104 |
|
|
"5.1e: verify actions set for second tracepoint"
|
105 |
|
|
|
106 |
|
|
gdb_trace_setactions "5.2a: set actions for last (default) tracepoint" \
|
107 |
|
|
"" \
|
108 |
|
|
"collect gdb_long_test" "^$"
|
109 |
|
|
|
110 |
|
|
gdb_test "info tracepoints" \
|
111 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
112 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
|
113 |
|
|
\[\t \]+collect gdb_char_test.
|
114 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
|
115 |
|
|
\[\t \]+collect gdb_short_test.
|
116 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+.
|
117 |
|
|
\[\t \]+collect gdb_long_test." \
|
118 |
|
|
"5.1e: verify actions set for second tracepoint"
|
119 |
|
|
|
120 |
|
|
# 5.3 replace actions set earlier
|
121 |
|
|
|
122 |
|
|
gdb_trace_setactions "5.3a: reset actions for first tracepoint" \
|
123 |
|
|
"$trcpt1" \
|
124 |
|
|
"collect gdb_struct1_test" "^$"
|
125 |
|
|
|
126 |
|
|
gdb_test "info tracepoints" \
|
127 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
128 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
|
129 |
|
|
\[\t \]+collect gdb_struct1_test.
|
130 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
|
131 |
|
|
\[\t \]+collect gdb_short_test.
|
132 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+.
|
133 |
|
|
\[\t \]+collect gdb_long_test." \
|
134 |
|
|
"5.3b: verify actions set for first tracepoint"
|
135 |
|
|
|
136 |
|
|
#
|
137 |
|
|
# test end command (all by itself)
|
138 |
|
|
#
|
139 |
|
|
|
140 |
|
|
# 5.4 end outside of context
|
141 |
|
|
|
142 |
|
|
gdb_test "end" "This command cannot be used at the top level." \
|
143 |
|
|
"5.4: 'end' command out of context"
|
144 |
|
|
|
145 |
|
|
# 5.5 empty actions (just an end with no other actions)
|
146 |
|
|
|
147 |
|
|
gdb_trace_setactions "5.5a: set empty actions for first tracepoint" \
|
148 |
|
|
"$trcpt1"
|
149 |
|
|
|
150 |
|
|
gdb_test_multiple "info tracepoints" "5.5c: verify NO actions for first tracepoint" {
|
151 |
|
|
-re "No tracepoints.*$gdb_prompt $" {
|
152 |
|
|
fail "5.5c: verify NO actions for first tracepoint"
|
153 |
|
|
}
|
154 |
|
|
-re "Actions for.* $trcpt1:.*$gdb_prompt $" {
|
155 |
|
|
fail "5.5c: verify NO actions for first tracepoint"
|
156 |
|
|
}
|
157 |
|
|
-re "$gdb_prompt $" {
|
158 |
|
|
pass "5.5c: verify NO actions for first tracepoint"
|
159 |
|
|
}
|
160 |
|
|
}
|
161 |
|
|
|
162 |
|
|
# 5.6 actions for invalid tracepoint number
|
163 |
|
|
|
164 |
|
|
gdb_test "actions [expr $trcpt2 + $trcpt3]" \
|
165 |
|
|
"No tracepoint number [expr $trcpt2 + $trcpt3]." \
|
166 |
|
|
"5.6: actions for invalid tracepoint number"
|
167 |
|
|
|
168 |
|
|
# 5.7 invalid action (other than 'collect', 'while-stepping' or 'end')
|
169 |
|
|
# "warning: .print gdb_c_test. is not a supported trace.*> $" \
|
170 |
|
|
|
171 |
|
|
gdb_trace_setactions "5.7: invalid action" \
|
172 |
|
|
"$trcpt1" \
|
173 |
|
|
"print gdb_c_test" \
|
174 |
|
|
"`print gdb_c_test' is not a supported tracepoint action"
|
175 |
|
|
|
176 |
|
|
# 5.8 help actions (collect, while-stepping, end)
|
177 |
|
|
|
178 |
|
|
gdb_test "help actions" \
|
179 |
|
|
"Specify the actions to be taken at a tracepoint.*" \
|
180 |
|
|
"5.8a: help actions"
|
181 |
|
|
|
182 |
|
|
gdb_test "help collect" \
|
183 |
|
|
"Specify one or more data items to be collected at a tracepoint.*" \
|
184 |
|
|
"5.8b: help collect"
|
185 |
|
|
|
186 |
|
|
gdb_test "help while-stepping" \
|
187 |
|
|
"Specify single-stepping behavior at a tracepoint.*" \
|
188 |
|
|
"5.8c: help while-stepping"
|
189 |
|
|
|
190 |
|
|
gdb_test "help end" "Ends a list of commands or actions.*" \
|
191 |
|
|
"5.8d: help end"
|
192 |
|
|
|
193 |
|
|
# 5.9 default-collect
|
194 |
|
|
|
195 |
|
|
gdb_test_no_output "set default-collect gdb_char_test, gdb_long_test - 100" \
|
196 |
|
|
"5.9a: set default-collect"
|
197 |
|
|
|
198 |
|
|
gdb_test "show default-collect" \
|
199 |
|
|
"The list of expressions to collect by default is \"gdb_char_test, gdb_long_test - 100\"..*" \
|
200 |
|
|
"5.9b: show default-collect"
|
201 |
|
|
|
202 |
|
|
gdb_test_no_output "set default-collect" \
|
203 |
|
|
"5.9c: set default-collect"
|
204 |
|
|
|
205 |
|
|
# 5.10 teval
|
206 |
|
|
|
207 |
|
|
gdb_test "tvariable \$tsv" \
|
208 |
|
|
"Trace state variable \\\$tsv created, with initial value 0." \
|
209 |
|
|
"Create a trace state variable"
|
210 |
|
|
|
211 |
|
|
gdb_trace_setactions "5.10a: set teval action for first tracepoint" \
|
212 |
|
|
"$trcpt1" \
|
213 |
|
|
"teval gdb_char_test" "^$"
|
214 |
|
|
|
215 |
|
|
gdb_trace_setactions "5.10a: set teval action for second tracepoint" \
|
216 |
|
|
"$trcpt2" \
|
217 |
|
|
"teval \$tsv += 1" "^$"
|
218 |
|
|
|
219 |
|
|
gdb_test "info tracepoints" \
|
220 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
221 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
|
222 |
|
|
\[\t \]+teval gdb_char_test.
|
223 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
|
224 |
|
|
\[\t \]+teval \\\$tsv \\\+= 1.
|
225 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+.
|
226 |
|
|
\[\t \]+collect gdb_long_test." \
|
227 |
|
|
"5.10a: verify teval actions set for two tracepoints"
|
228 |
|
|
|