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