Initial import
[gdb.git] / gdb / testsuite / gdb.trace / deltrace.exp
blob3dfc60042701303ed47abb913f2af5aaa7bc4160
1 # Copyright 1998, 1999, 2007 Free Software Foundation, Inc.
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.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # Please email any bugs, comments, and/or additions to this file to:
17 # bug-gdb@prep.ai.mit.edu
19 # This file was written by Michael Snyder (msnyder@cygnus.com)
21 load_lib "trace-support.exp";
23 if $tracelevel then {
24 strace $tracelevel
27 set prms_id 0
28 set bug_id 0
30 gdb_exit
31 gdb_start
33 if [istarget "m68k-*-elf"] then {
34 set srcfile gdb_c_test.c
35 set binfile [board_info target d490_binfile];
36 } else {
37 set testfile "actions"
38 set srcfile ${testfile}.c
39 set binfile $objdir/$subdir/$testfile
40 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
41 executable {debug nowarnings}] != "" } {
42 untested deltrace.exp
43 return -1
46 gdb_reinitialize_dir $srcdir/$subdir
48 # If testing on a remote host, download the source file.
49 # remote_download host $srcdir/$subdir/$srcfile
51 gdb_file_cmd $binfile
53 # define relative source line numbers:
54 # all subsequent line numbers are relative to this first one (baseline)
55 set baseline [gdb_find_recursion_test_baseline $srcfile];
56 if { $baseline == -1 } then {
57 fail "Could not find gdb_recursion_test function"
58 return;
60 set testline1 [expr $baseline + 4]
63 # test "delete tracepoints" command
66 # 3.1 delete tracepoints (all)
67 gdb_delete_tracepoints
68 gdb_test "trace gdb_c_test" "Tracepoint \[0-9\]+ at .*" "set tracepoint 1"
69 gdb_test "trace gdb_asm_test" "Tracepoint \[0-9\]+ at .*" "set tracepoint 2"
70 gdb_test "trace $testline1" "Tracepoint \[0-9\]+ at .*" "set tracepoint 3"
72 gdb_test "info tracepoints" \
73 "Num Enb Address\[ \]+PassC StepC What.*\[0-9\]+\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*in gdb_c_test.*\[0-9\]+\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*gdb_asm_test.*\[0-9\]+\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*in gdb_recursion_test.*" \
74 "3.1a: set three tracepoints"
76 send_gdb "delete tracepoints\n"
77 gdb_expect 30 {
78 -re "Delete all tracepoints.*y or n.*$" {
79 send_gdb "y\n"
80 gdb_expect 30 {
81 -re "$gdb_prompt $" {
82 pass "3.1b: delete all tracepoints"
84 timeout { fail "3.1b: delete all tracepoints (timeout)" }
87 -re "$gdb_prompt $" { # This should only happen if there are no tracepoints
88 fail "3.1b: delete all tracepoints (no tracepoints?)"
90 timeout { fail "3.1b: delete all tracepoints (timeout)" }
93 # 3.2 delete tracepoint <n>
94 gdb_delete_tracepoints
95 set trcpt1 [gdb_gettpnum gdb_c_test];
96 set trcpt2 [gdb_gettpnum gdb_asm_test];
97 set trcpt3 [gdb_gettpnum $testline1];
98 if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then {
99 fail "setting tracepoints"
100 return;
103 gdb_test "info tracepoints" \
104 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*in.*gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*in.*gdb_recursion_test.*" \
105 "3.2a: set three tracepoints"
107 #gdb_test "delete tracepoint $trcpt1" "" ""
108 send_gdb "delete tracepoint $trcpt1\n"
109 gdb_expect {
110 -re "No tracepoint number.*$gdb_prompt $" {
111 fail "3.2b: delete first tracepoint"
113 -re ".*\[Ee\]rror.*$gdb_prompt $" {
114 fail "3.2b: delete first tracepoint"
116 -re "$gdb_prompt $" {
117 pass "3.2b: delete first tracepoint"
119 timeout {
120 fail "3.2b: delete first tracepoint (timeout)"
124 send_gdb "info tracepoints\n"
125 gdb_expect {
126 -re "$trcpt1\[\t \]+y\[\t \]+0x.*in.*gdb_c_test.*$gdb_prompt $" {
127 fail "3.2c: verify delete first tracepoint (argh)"
129 -re "$trcpt2\[\t \]+y.*gdb_asm_test.*\[\r\n\t ]+$trcpt3\[\t \]+y.* in gdb_recursion_test at .*$gdb_prompt $" {
130 pass "3.2c: verify delete first tracepoint"
132 -re ".*$gdb_prompt $" {
133 fail "3.2c: verify delete first tracepoint (mumble)"
135 timeout {
136 fail "3.2c: verify delete first tracepoint (timeout)"
140 #gdb_test "delete tracepoint $trcpt2" "" ""
141 send_gdb "delete tracepoint $trcpt2\n"
142 gdb_expect {
143 -re "No tracepoint number.*$gdb_prompt $" {
144 fail "3.2d: delete second tracepoint"
146 -re ".*\[Ee\]rror.*$gdb_prompt $" {
147 fail "3.2d: delete second tracepoint"
149 -re "$gdb_prompt $" {
150 pass "3.2d: delete second tracepoint"
152 timeout {
153 fail "3.2d: delete second tracepoint (timeout)"
157 send_gdb "info tracepoints\n"
158 gdb_expect {
159 -re "$trcpt1\[\t \]+y\[\t \]+0x.*in.*gdb_c_test.*$gdb_prompt $" {
160 fail "3.2e: verify delete second tracepoint"
162 -re "$trcpt2\[\t \]+y\[\t \]+0x.*in gdb_asm_test.*$gdb_prompt $" {
163 fail "3.2e: verify delete second tracepoint"
165 -re "$trcpt3\[\t \]+y\[\t \]+0x.*in gdb_recursion_test.*$gdb_prompt $" {
166 pass "3.2e: verify delete second tracepoint"
168 -re "$gdb_prompt $" {
169 fail "3.2e: verify delete second tracepoint"
171 timeout {
172 fail "3.2e: verify delete second tracepoint (timeout)"
176 #gdb_test "delete tracepoint $trcpt3" "" ""
177 send_gdb "delete tracepoint $trcpt3\n"
178 gdb_expect {
179 -re "No tracepoint number.*$gdb_prompt $" {
180 fail "3.2f: delete third tracepoint"
182 -re ".*\[Ee\]rror.*$gdb_prompt $" {
183 fail "3.2f: delete third tracepoint"
185 -re "$gdb_prompt $" {
186 pass "3.2f: delete third tracepoint"
188 timeout {
189 fail "3.2f: delete third tracepoint (timeout)"
193 # send_gdb "ARF! \\n\n"
194 send_gdb "info tracepoints\n"
195 gdb_expect {
196 -re "$trcpt3\[\t \]+y\[\t \]+0x.*in gdb_recursion_test.*$gdb_prompt $" {
197 fail "3.2g: verify delete third tracepoint"
199 -re "$gdb_prompt $" {
200 pass "3.2g: verify delete third tracepoint"
202 timeout {
203 fail "3.2g: verify delete third tracepoint (timeout)"
207 # 3.3 delete three tracepoints at once
208 gdb_delete_tracepoints
209 set trcpt1 [gdb_gettpnum gdb_c_test];
210 set trcpt2 [gdb_gettpnum gdb_asm_test];
211 set trcpt3 [gdb_gettpnum $testline1];
212 if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then {
213 fail "setting tracepoints"
214 return;
217 gdb_test "info tracepoints" \
218 "Num Enb Address\[ \]+PassC StepC What.*$trcpt1\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*in gdb_c_test.*$trcpt2\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*gdb_asm_test.*$trcpt3\[\t \]+y\[\t \]+0x\[0-9a-fA-F\]+.*in gdb_recursion_test.*" \
219 "3.3a: set three tracepoints"
221 #gdb_test "delete tracepoint $trcpt1 $trcpt2 $trcpt3" "" ""
222 send_gdb "delete tracepoint $trcpt1 $trcpt2 $trcpt3\n"
223 gdb_expect {
224 -re "No tracepoint number.*$gdb_prompt $" {
225 fail "3.3b: delete three tracepoints"
227 -re ".*\[Ee\]rror.*$gdb_prompt $" {
228 fail "3.3b: delete three tracepoints"
230 -re "$gdb_prompt $" {
231 pass "3.3b: delete three tracepoints"
233 timeout {
234 fail "3.3b: delete three tracepoint (timeout)"
238 send_gdb "info tracepoints\n"
239 gdb_expect {
240 -re "$trcpt1\[\t \]+y\[\t \]+0x.*in gdb_c_test.*$gdb_prompt $" {
241 fail "3.3c: verify delete three tracepoints (first one persists)"
243 -re "$trcpt2\[\t \]+y\[\t \]+0x.*in gdb_asm_test.*$gdb_prompt $" {
244 fail "3.3c: verify delete three tracepoints (second one persists)"
246 -re "$trcpt3\[\t \]+y\[\t \]+0x.*in gdb_recursion_test.*$gdb_prompt $" {
247 fail "3.3c: verify delete three tracepoints (third one persists)"
249 -re "$gdb_prompt $" {
250 pass "3.3c: verify delete three tracepoints"
252 timeout {
253 fail "3.3c: verify delete three tracepoints (timeout)"
257 # 3.4 delete invalid tracepoint number
258 gdb_test "delete tracepoint [expr $trcpt2 + $trcpt3]" \
259 "No tracepoint number [expr $trcpt2 + $trcpt3]." \
260 "3.4: delete invalid tracepoint number"
262 # 3.5 delete tracepoint number zero
263 gdb_test "delete tracepoint 0" "bad tracepoint number at or near '0'" \
264 "3.5: delete tracepoint number zero"
266 # 3.6 help delete tracepoints
267 gdb_test "help delete tracepoints" \
268 "Delete specified tracepoints.*" \
269 "3.6: help delete tracepoints"