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