1 |
330 |
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 |
|
|
|
26 |
|
|
gdb_exit
|
27 |
|
|
gdb_start
|
28 |
|
|
|
29 |
|
|
set testfile "actions"
|
30 |
|
|
set srcfile ${testfile}.c
|
31 |
|
|
set binfile $objdir/$subdir/deltrace
|
32 |
|
|
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
|
33 |
|
|
executable {debug nowarnings}] != "" } {
|
34 |
|
|
untested deltrace.exp
|
35 |
|
|
return -1
|
36 |
|
|
}
|
37 |
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
38 |
|
|
|
39 |
|
|
# If testing on a remote host, download the source file.
|
40 |
|
|
# remote_download host $srcdir/$subdir/$srcfile
|
41 |
|
|
|
42 |
|
|
gdb_file_cmd $binfile
|
43 |
|
|
|
44 |
|
|
# define relative source line numbers:
|
45 |
|
|
# all subsequent line numbers are relative to this first one (baseline)
|
46 |
|
|
set baseline [gdb_find_recursion_test_baseline $srcfile];
|
47 |
|
|
if { $baseline == -1 } then {
|
48 |
|
|
fail "Could not find gdb_recursion_test function"
|
49 |
|
|
return;
|
50 |
|
|
}
|
51 |
|
|
set testline1 [expr $baseline + 4]
|
52 |
|
|
|
53 |
|
|
#
|
54 |
|
|
# test "delete tracepoints" command
|
55 |
|
|
#
|
56 |
|
|
|
57 |
|
|
# 3.1 delete tracepoints (all)
|
58 |
|
|
gdb_delete_tracepoints
|
59 |
|
|
gdb_test "trace gdb_c_test" "Tracepoint \[0-9\]+ at .*" "set tracepoint 1"
|
60 |
|
|
gdb_test "trace gdb_asm_test" "Tracepoint \[0-9\]+ at .*" "set tracepoint 2"
|
61 |
|
|
gdb_test "trace $testline1" "Tracepoint \[0-9\]+ at .*" "set tracepoint 3"
|
62 |
|
|
|
63 |
|
|
gdb_test "info tracepoints" \
|
64 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
65 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
|
66 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
|
67 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
|
68 |
|
|
"3.1a: set three tracepoints"
|
69 |
|
|
|
70 |
|
|
gdb_test "delete tracepoints" \
|
71 |
|
|
"" \
|
72 |
|
|
"3.1b: delete all tracepoints" \
|
73 |
|
|
"Delete all tracepoints.*y or n.*$" \
|
74 |
|
|
"y"
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
# 3.2 delete tracepoint
|
78 |
|
|
gdb_delete_tracepoints
|
79 |
|
|
set trcpt1 [gdb_gettpnum gdb_c_test];
|
80 |
|
|
set trcpt2 [gdb_gettpnum gdb_asm_test];
|
81 |
|
|
set trcpt3 [gdb_gettpnum $testline1];
|
82 |
|
|
if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then {
|
83 |
|
|
fail "setting tracepoints"
|
84 |
|
|
return;
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
gdb_test "info tracepoints" \
|
88 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
89 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
|
90 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
|
91 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
|
92 |
|
|
"3.2a: set three tracepoints"
|
93 |
|
|
|
94 |
|
|
#gdb_test_no_output "delete tracepoint $trcpt1" ""
|
95 |
|
|
gdb_test_multiple "delete tracepoint $trcpt1" "3.2b: delete first tracepoint" {
|
96 |
|
|
-re "No tracepoint number.*$gdb_prompt $" {
|
97 |
|
|
fail "3.2b: delete first tracepoint"
|
98 |
|
|
}
|
99 |
|
|
-re ".*\[Ee\]rror.*$gdb_prompt $" {
|
100 |
|
|
fail "3.2b: delete first tracepoint"
|
101 |
|
|
}
|
102 |
|
|
-re "$gdb_prompt $" {
|
103 |
|
|
pass "3.2b: delete first tracepoint"
|
104 |
|
|
}
|
105 |
|
|
}
|
106 |
|
|
|
107 |
|
|
gdb_test "info tracepoints" \
|
108 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
109 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
|
110 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
|
111 |
|
|
"3.2c: verify delete first tracepoint"
|
112 |
|
|
|
113 |
|
|
#gdb_test_no_output "delete tracepoint $trcpt2" ""
|
114 |
|
|
gdb_test_multiple "delete tracepoint $trcpt2" "3.2d: delete second tracepoint" {
|
115 |
|
|
-re "No tracepoint number.*$gdb_prompt $" {
|
116 |
|
|
fail "3.2d: delete second tracepoint"
|
117 |
|
|
}
|
118 |
|
|
-re ".*\[Ee\]rror.*$gdb_prompt $" {
|
119 |
|
|
fail "3.2d: delete second tracepoint"
|
120 |
|
|
}
|
121 |
|
|
-re "$gdb_prompt $" {
|
122 |
|
|
pass "3.2d: delete second tracepoint"
|
123 |
|
|
}
|
124 |
|
|
}
|
125 |
|
|
|
126 |
|
|
gdb_test "info tracepoints" \
|
127 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
128 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
|
129 |
|
|
"3.2e: verify delete second tracepoint"
|
130 |
|
|
|
131 |
|
|
#gdb_test_no_output "delete tracepoint $trcpt3" ""
|
132 |
|
|
gdb_test_multiple "delete tracepoint $trcpt3" "3.2f: delete third tracepoint" {
|
133 |
|
|
-re "No tracepoint number.*$gdb_prompt $" {
|
134 |
|
|
fail "3.2f: delete third tracepoint"
|
135 |
|
|
}
|
136 |
|
|
-re ".*\[Ee\]rror.*$gdb_prompt $" {
|
137 |
|
|
fail "3.2f: delete third tracepoint"
|
138 |
|
|
}
|
139 |
|
|
-re "$gdb_prompt $" {
|
140 |
|
|
pass "3.2f: delete third tracepoint"
|
141 |
|
|
}
|
142 |
|
|
}
|
143 |
|
|
|
144 |
|
|
# send_gdb "ARF! \\n\n"
|
145 |
|
|
gdb_test "info tracepoints" \
|
146 |
|
|
"No tracepoints." \
|
147 |
|
|
"3.2g: verify delete third tracepoint"
|
148 |
|
|
|
149 |
|
|
# 3.3 delete three tracepoints at once
|
150 |
|
|
gdb_delete_tracepoints
|
151 |
|
|
set trcpt1 [gdb_gettpnum gdb_c_test];
|
152 |
|
|
set trcpt2 [gdb_gettpnum gdb_asm_test];
|
153 |
|
|
set trcpt3 [gdb_gettpnum $testline1];
|
154 |
|
|
if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then {
|
155 |
|
|
fail "setting tracepoints"
|
156 |
|
|
return;
|
157 |
|
|
}
|
158 |
|
|
|
159 |
|
|
gdb_test "info tracepoints" \
|
160 |
|
|
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
|
161 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
|
162 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
|
163 |
|
|
\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0-9\]+" \
|
164 |
|
|
"3.3a: set three tracepoints"
|
165 |
|
|
|
166 |
|
|
#gdb_test_no_output "delete tracepoint $trcpt1 $trcpt2 $trcpt3" ""
|
167 |
|
|
gdb_test_multiple "delete tracepoint $trcpt1 $trcpt2 $trcpt3" \
|
168 |
|
|
"3.3b: delete three tracepoints" {
|
169 |
|
|
-re "No tracepoint number.*$gdb_prompt $" {
|
170 |
|
|
fail "3.3b: delete three tracepoints"
|
171 |
|
|
}
|
172 |
|
|
-re ".*\[Ee\]rror.*$gdb_prompt $" {
|
173 |
|
|
fail "3.3b: delete three tracepoints"
|
174 |
|
|
}
|
175 |
|
|
-re "$gdb_prompt $" {
|
176 |
|
|
pass "3.3b: delete three tracepoints"
|
177 |
|
|
}
|
178 |
|
|
}
|
179 |
|
|
|
180 |
|
|
gdb_test "info tracepoints" \
|
181 |
|
|
"No tracepoints." \
|
182 |
|
|
"3.3c: verify delete three tracepoints"
|
183 |
|
|
|
184 |
|
|
# 3.4 delete invalid tracepoint number
|
185 |
|
|
gdb_test "delete tracepoint [expr $trcpt2 + $trcpt3]" \
|
186 |
|
|
"No breakpoint number [expr $trcpt2 + $trcpt3]." \
|
187 |
|
|
"3.4: delete invalid tracepoint number"
|
188 |
|
|
|
189 |
|
|
# 3.5 delete tracepoint number zero
|
190 |
|
|
gdb_test "delete tracepoint 0" "bad breakpoint number at or near '0'" \
|
191 |
|
|
"3.5: delete tracepoint number zero"
|
192 |
|
|
|
193 |
|
|
# 3.6 help delete tracepoints
|
194 |
|
|
gdb_test "help delete tracepoints" \
|
195 |
|
|
"Delete specified tracepoints.*" \
|
196 |
|
|
"3.6: help delete tracepoints"
|