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