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