1 |
227 |
jeremybenn |
# Copyright 1998, 1999, 2007, 2008, 2009, 2010
|
2 |
|
|
# Free Software Foundation, Inc.
|
3 |
|
|
#
|
4 |
|
|
# This program is free software; you can redistribute it and/or modify
|
5 |
|
|
# it under the terms of the GNU General Public License as published by
|
6 |
|
|
# the Free Software Foundation; either version 3 of the License, or
|
7 |
|
|
# (at your option) any later version.
|
8 |
|
|
#
|
9 |
|
|
# This program is distributed in the hope that it will be useful,
|
10 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
|
|
# GNU General Public License for more details.
|
13 |
|
|
#
|
14 |
|
|
# You should have received a copy of the GNU General Public License
|
15 |
|
|
# along with this program. If not, see .
|
16 |
|
|
|
17 |
|
|
# This file was written by Michael Snyder (msnyder@cygnus.com)
|
18 |
|
|
|
19 |
|
|
load_lib "trace-support.exp";
|
20 |
|
|
|
21 |
|
|
if $tracelevel then {
|
22 |
|
|
strace $tracelevel
|
23 |
|
|
}
|
24 |
|
|
|
25 |
|
|
set prms_id 0
|
26 |
|
|
set bug_id 0
|
27 |
|
|
|
28 |
|
|
gdb_exit
|
29 |
|
|
gdb_start
|
30 |
|
|
|
31 |
|
|
set testfile "actions"
|
32 |
|
|
set srcfile ${testfile}.c
|
33 |
|
|
set binfile $objdir/$subdir/deltrace
|
34 |
|
|
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
|
35 |
|
|
executable {debug nowarnings}] != "" } {
|
36 |
|
|
untested deltrace.exp
|
37 |
|
|
return -1
|
38 |
|
|
}
|
39 |
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
40 |
|
|
|
41 |
|
|
# If testing on a remote host, download the source file.
|
42 |
|
|
# remote_download host $srcdir/$subdir/$srcfile
|
43 |
|
|
|
44 |
|
|
gdb_file_cmd $binfile
|
45 |
|
|
|
46 |
|
|
# define relative source line numbers:
|
47 |
|
|
# all subsequent line numbers are relative to this first one (baseline)
|
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 |
|
|
set testline1 [expr $baseline + 4]
|
54 |
|
|
|
55 |
|
|
#
|
56 |
|
|
# test "delete tracepoints" command
|
57 |
|
|
#
|
58 |
|
|
|
59 |
|
|
# 3.1 delete tracepoints (all)
|
60 |
|
|
gdb_delete_tracepoints
|
61 |
|
|
gdb_test "trace gdb_c_test" "Tracepoint \[0-9\]+ at .*" "set tracepoint 1"
|
62 |
|
|
gdb_test "trace gdb_asm_test" "Tracepoint \[0-9\]+ at .*" "set tracepoint 2"
|
63 |
|
|
gdb_test "trace $testline1" "Tracepoint \[0-9\]+ at .*" "set tracepoint 3"
|
64 |
|
|
|
65 |
|
|
gdb_test "info tracepoints" \
|
66 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
67 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
|
68 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
|
69 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
|
70 |
|
|
"3.1a: set three tracepoints"
|
71 |
|
|
|
72 |
|
|
send_gdb "delete tracepoints\n"
|
73 |
|
|
gdb_expect 30 {
|
74 |
|
|
-re "Delete all tracepoints.*y or n.*$" {
|
75 |
|
|
send_gdb "y\n"
|
76 |
|
|
gdb_expect 30 {
|
77 |
|
|
-re "$gdb_prompt $" {
|
78 |
|
|
pass "3.1b: delete all tracepoints"
|
79 |
|
|
}
|
80 |
|
|
timeout { fail "3.1b: delete all tracepoints (timeout)" }
|
81 |
|
|
}
|
82 |
|
|
}
|
83 |
|
|
-re "$gdb_prompt $" { # This should only happen if there are no tracepoints
|
84 |
|
|
fail "3.1b: delete all tracepoints (no tracepoints?)"
|
85 |
|
|
}
|
86 |
|
|
timeout { fail "3.1b: delete all tracepoints (timeout)" }
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
# 3.2 delete tracepoint
|
90 |
|
|
gdb_delete_tracepoints
|
91 |
|
|
set trcpt1 [gdb_gettpnum gdb_c_test];
|
92 |
|
|
set trcpt2 [gdb_gettpnum gdb_asm_test];
|
93 |
|
|
set trcpt3 [gdb_gettpnum $testline1];
|
94 |
|
|
if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then {
|
95 |
|
|
fail "setting tracepoints"
|
96 |
|
|
return;
|
97 |
|
|
}
|
98 |
|
|
|
99 |
|
|
gdb_test "info tracepoints" \
|
100 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
101 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
|
102 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
|
103 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
|
104 |
|
|
"3.2a: set three tracepoints"
|
105 |
|
|
|
106 |
|
|
#gdb_test "delete tracepoint $trcpt1" "" ""
|
107 |
|
|
send_gdb "delete tracepoint $trcpt1\n"
|
108 |
|
|
gdb_expect {
|
109 |
|
|
-re "No tracepoint number.*$gdb_prompt $" {
|
110 |
|
|
fail "3.2b: delete first tracepoint"
|
111 |
|
|
}
|
112 |
|
|
-re ".*\[Ee\]rror.*$gdb_prompt $" {
|
113 |
|
|
fail "3.2b: delete first tracepoint"
|
114 |
|
|
}
|
115 |
|
|
-re "$gdb_prompt $" {
|
116 |
|
|
pass "3.2b: delete first tracepoint"
|
117 |
|
|
}
|
118 |
|
|
timeout {
|
119 |
|
|
fail "3.2b: delete first tracepoint (timeout)"
|
120 |
|
|
}
|
121 |
|
|
}
|
122 |
|
|
|
123 |
|
|
gdb_test "info tracepoints" \
|
124 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
125 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
|
126 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
|
127 |
|
|
"3.2c: verify delete first tracepoint"
|
128 |
|
|
|
129 |
|
|
#gdb_test "delete tracepoint $trcpt2" "" ""
|
130 |
|
|
send_gdb "delete tracepoint $trcpt2\n"
|
131 |
|
|
gdb_expect {
|
132 |
|
|
-re "No tracepoint number.*$gdb_prompt $" {
|
133 |
|
|
fail "3.2d: delete second tracepoint"
|
134 |
|
|
}
|
135 |
|
|
-re ".*\[Ee\]rror.*$gdb_prompt $" {
|
136 |
|
|
fail "3.2d: delete second tracepoint"
|
137 |
|
|
}
|
138 |
|
|
-re "$gdb_prompt $" {
|
139 |
|
|
pass "3.2d: delete second tracepoint"
|
140 |
|
|
}
|
141 |
|
|
timeout {
|
142 |
|
|
fail "3.2d: delete second tracepoint (timeout)"
|
143 |
|
|
}
|
144 |
|
|
}
|
145 |
|
|
|
146 |
|
|
gdb_test "info tracepoints" \
|
147 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
148 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
|
149 |
|
|
"3.2e: verify delete second tracepoint"
|
150 |
|
|
|
151 |
|
|
#gdb_test "delete tracepoint $trcpt3" "" ""
|
152 |
|
|
send_gdb "delete tracepoint $trcpt3\n"
|
153 |
|
|
gdb_expect {
|
154 |
|
|
-re "No tracepoint number.*$gdb_prompt $" {
|
155 |
|
|
fail "3.2f: delete third tracepoint"
|
156 |
|
|
}
|
157 |
|
|
-re ".*\[Ee\]rror.*$gdb_prompt $" {
|
158 |
|
|
fail "3.2f: delete third tracepoint"
|
159 |
|
|
}
|
160 |
|
|
-re "$gdb_prompt $" {
|
161 |
|
|
pass "3.2f: delete third tracepoint"
|
162 |
|
|
}
|
163 |
|
|
timeout {
|
164 |
|
|
fail "3.2f: delete third tracepoint (timeout)"
|
165 |
|
|
}
|
166 |
|
|
}
|
167 |
|
|
|
168 |
|
|
# send_gdb "ARF! \\n\n"
|
169 |
|
|
gdb_test "info tracepoints" \
|
170 |
|
|
"No tracepoints." \
|
171 |
|
|
"3.2g: verify delete third tracepoint"
|
172 |
|
|
|
173 |
|
|
# 3.3 delete three tracepoints at once
|
174 |
|
|
gdb_delete_tracepoints
|
175 |
|
|
set trcpt1 [gdb_gettpnum gdb_c_test];
|
176 |
|
|
set trcpt2 [gdb_gettpnum gdb_asm_test];
|
177 |
|
|
set trcpt3 [gdb_gettpnum $testline1];
|
178 |
|
|
if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then {
|
179 |
|
|
fail "setting tracepoints"
|
180 |
|
|
return;
|
181 |
|
|
}
|
182 |
|
|
|
183 |
|
|
gdb_test "info tracepoints" \
|
184 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
185 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
|
186 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
|
187 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
|
188 |
|
|
"3.3a: set three tracepoints"
|
189 |
|
|
|
190 |
|
|
#gdb_test "delete tracepoint $trcpt1 $trcpt2 $trcpt3" "" ""
|
191 |
|
|
send_gdb "delete tracepoint $trcpt1 $trcpt2 $trcpt3\n"
|
192 |
|
|
gdb_expect {
|
193 |
|
|
-re "No tracepoint number.*$gdb_prompt $" {
|
194 |
|
|
fail "3.3b: delete three tracepoints"
|
195 |
|
|
}
|
196 |
|
|
-re ".*\[Ee\]rror.*$gdb_prompt $" {
|
197 |
|
|
fail "3.3b: delete three tracepoints"
|
198 |
|
|
}
|
199 |
|
|
-re "$gdb_prompt $" {
|
200 |
|
|
pass "3.3b: delete three tracepoints"
|
201 |
|
|
}
|
202 |
|
|
timeout {
|
203 |
|
|
fail "3.3b: delete three tracepoint (timeout)"
|
204 |
|
|
}
|
205 |
|
|
}
|
206 |
|
|
|
207 |
|
|
gdb_test "info tracepoints" \
|
208 |
|
|
"No tracepoints." \
|
209 |
|
|
"3.3c: verify delete three tracepoints"
|
210 |
|
|
|
211 |
|
|
# 3.4 delete invalid tracepoint number
|
212 |
|
|
gdb_test "delete tracepoint [expr $trcpt2 + $trcpt3]" \
|
213 |
|
|
"No breakpoint number [expr $trcpt2 + $trcpt3]." \
|
214 |
|
|
"3.4: delete invalid tracepoint number"
|
215 |
|
|
|
216 |
|
|
# 3.5 delete tracepoint number zero
|
217 |
|
|
gdb_test "delete tracepoint 0" "bad breakpoint number at or near '0'" \
|
218 |
|
|
"3.5: delete tracepoint number zero"
|
219 |
|
|
|
220 |
|
|
# 3.6 help delete tracepoints
|
221 |
|
|
gdb_test "help delete tracepoints" \
|
222 |
|
|
"Delete specified tracepoints.*" \
|
223 |
|
|
"3.6: help delete tracepoints"
|