OLD | NEW |
1 # Copyright 2011-2012 Free Software Foundation, Inc. | 1 # Copyright 2011-2012 Free Software Foundation, Inc. |
2 # This program is free software; you can redistribute it and/or modify | 2 # This program is free software; you can redistribute it and/or modify |
3 # it under the terms of the GNU General Public License as published by | 3 # it under the terms of the GNU General Public License as published by |
4 # the Free Software Foundation; either version 3 of the License, or | 4 # the Free Software Foundation; either version 3 of the License, or |
5 # (at your option) any later version. | 5 # (at your option) any later version. |
6 # | 6 # |
7 # This program is distributed in the hope that it will be useful, | 7 # This program is distributed in the hope that it will be useful, |
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 # GNU General Public License for more details. | 10 # GNU General Public License for more details. |
11 # | 11 # |
12 # You should have received a copy of the GNU General Public License | 12 # You should have received a copy of the GNU General Public License |
13 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 13 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
14 | 14 |
15 load_lib "trace-support.exp"; | 15 load_lib "trace-support.exp"; |
16 | 16 |
17 if $tracelevel then { | |
18 strace $tracelevel | |
19 } | |
20 | |
21 if {[skip_shlib_tests]} { | 17 if {[skip_shlib_tests]} { |
22 return 0 | 18 return 0 |
23 } | 19 } |
24 | 20 |
25 set testfile "change-loc" | 21 standard_testfile |
26 set libfile1 "change-loc-1" | 22 set libfile1 "change-loc-1" |
27 set libfile2 "change-loc-2" | 23 set libfile2 "change-loc-2" |
28 set srcfile $testfile.c | |
29 set executable $testfile | 24 set executable $testfile |
30 set libsrc1 $srcdir/$subdir/$libfile1.c | 25 set libsrc1 $srcdir/$subdir/$libfile1.c |
31 set libsrc2 $srcdir/$subdir/$libfile2.c | 26 set libsrc2 $srcdir/$subdir/$libfile2.c |
32 set binfile $objdir/$subdir/$testfile | 27 set lib_sl1 [standard_output_file $libfile1.sl] |
33 set lib_sl1 $objdir/$subdir/$libfile1.sl | 28 set lib_sl2 [standard_output_file $libfile2.sl] |
34 set lib_sl2 $objdir/$subdir/$libfile2.sl | |
35 | 29 |
36 set lib_opts debug | 30 set lib_opts debug |
37 | 31 |
38 if [get_compiler_info ${binfile}] { | 32 if [get_compiler_info] { |
39 return -1 | 33 return -1 |
40 } | 34 } |
41 | 35 |
42 # Some targets have leading underscores on assembly symbols. | 36 # Some targets have leading underscores on assembly symbols. |
43 set additional_flags [list debug shlib=$lib_sl1 shlib_load [gdb_target_symbol_pr
efix_flags]] | 37 set additional_flags [list debug shlib=$lib_sl1 shlib_load [gdb_target_symbol_pr
efix_flags]] |
44 | 38 |
45 if { [gdb_compile_shlib $libsrc1 $lib_sl1 $lib_opts] != "" | 39 if { [gdb_compile_shlib $libsrc1 $lib_sl1 $lib_opts] != "" |
46 || [gdb_compile_shlib $libsrc2 $lib_sl2 $lib_opts] != "" | 40 || [gdb_compile_shlib $libsrc2 $lib_sl2 $lib_opts] != "" |
47 || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $additional_fl
ags] != ""} { | 41 || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $additional_fl
ags] != ""} { |
48 untested "Could not compile either $libsrc1 or $srcdir/$subdir/$srcfile." | 42 untested "Could not compile either $libsrc1 or $srcdir/$subdir/$srcfile." |
(...skipping 19 matching lines...) Expand all Loading... |
68 set pcreg "rip" | 62 set pcreg "rip" |
69 } elseif [is_x86_like_target] { | 63 } elseif [is_x86_like_target] { |
70 set pcreg "eip" | 64 set pcreg "eip" |
71 } else { | 65 } else { |
72 set pcreg "pc" | 66 set pcreg "pc" |
73 } | 67 } |
74 | 68 |
75 | 69 |
76 # Set tracepoint during tracing experiment. | 70 # Set tracepoint during tracing experiment. |
77 | 71 |
78 proc tracepoint_change_loc_1 { trace_type } { | 72 proc tracepoint_change_loc_1 { trace_type } { with_test_prefix "1 $trace_type" { |
79 global testfile | 73 global testfile |
80 global srcfile | 74 global srcfile |
81 global pcreg | 75 global pcreg |
82 global gdb_prompt | 76 global gdb_prompt |
83 global pf_prefix | |
84 | |
85 set old_pf_prefix $pf_prefix | |
86 set pf_prefix "$pf_prefix 1 $trace_type:" | |
87 | 77 |
88 clean_restart ${testfile} | 78 clean_restart ${testfile} |
89 if ![runto_main] { | 79 if ![runto_main] { |
90 fail "Can't run to main" | 80 fail "Can't run to main" |
91 set pf_prefix $old_pf_prefix | |
92 return -1 | 81 return -1 |
93 } | 82 } |
94 gdb_test_no_output "delete break 1" | 83 gdb_test_no_output "delete break 1" |
95 | 84 |
96 # Set a tracepoint we'll never meet. Just to avoid the complain after | 85 # Set a tracepoint we'll never meet. Just to avoid the complain after |
97 # type `tstart' later. | 86 # type `tstart' later. |
98 gdb_test "next" ".*" | 87 gdb_test "next" ".*" |
99 gdb_test "trace main" "Tracepoint \[0-9\] at.* file .*$srcfile, line.*" \ | 88 gdb_test "trace main" "Tracepoint \[0-9\] at.* file .*$srcfile, line.*" \ |
100 "set tracepoint on main" | 89 "set tracepoint on main" |
101 | 90 |
102 gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \ | 91 gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \ |
103 "breakpoint on marker" | 92 "breakpoint on marker" |
104 | 93 |
105 gdb_test_no_output "tstart" | 94 gdb_test_no_output "tstart" |
106 | 95 |
107 gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \ | 96 gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \ |
108 "continue to marker 1" | 97 "continue to marker 1" |
109 # Set a tracepoint during tracing. | 98 # Set a tracepoint during tracing. |
110 gdb_test "${trace_type} set_tracepoint" ".*" "set tracepoint on set_tracepoi
nt" | 99 set test "set tracepoint on set_tracepoint" |
| 100 gdb_test_multiple "${trace_type} set_tracepoint" $test { |
| 101 » -re "Target returns error code .* too far .*$gdb_prompt $" { |
| 102 » if [string equal $trace_type "ftrace"] { |
| 103 » » # The target was unable to install the fast tracepoint |
| 104 » » # (e.g., jump pad too far from tracepoint). |
| 105 » » pass "$test (too far)" |
| 106 » } else { |
| 107 » » fail $test |
| 108 » } |
| 109 » } |
| 110 » -re "\r\n$gdb_prompt $" { |
| 111 » pass $test |
| 112 » } |
| 113 } |
111 | 114 |
112 gdb_trace_setactions "set action for tracepoint" "" \ | 115 gdb_trace_setactions "set action for tracepoint" "" \ |
113 "collect \$$pcreg" "^$" | 116 "collect \$$pcreg" "^$" |
114 | 117 |
115 # tracepoint has two locations after shlib change-loc-1 is loaded. | 118 # tracepoint has two locations after shlib change-loc-1 is loaded. |
116 gdb_test "info trace" \ | 119 gdb_test "info trace" \ |
117 "Num Type\[ \]+Disp Enb Address\[ \]+What.* | 120 "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
118 \[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*4\.1.* in func4.
*4\.2.* in func4.*" \ | 121 \[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*4\.1.* in func4.
*4\.2.* in func4.*" \ |
119 "tracepoint with two locations" | 122 "tracepoint with two locations" |
120 | 123 |
121 gdb_test_multiple "continue" "continue to marker 2" { | 124 set test "continue to marker 2" |
122 » -re ".*Breakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" { | 125 gdb_test_multiple "continue" $test { |
123 » pass "continue to marker 2" | 126 » -re "Target returns error code .* too far .*$gdb_prompt $" { |
124 » } | 127 if [string equal $trace_type "ftrace"] { |
125 » -re ".*$gdb_prompt $" { | 128 » » # Expected if the target was unable to install the |
126 » kfail "gdb/13392" "continue to marker 2" | 129 » » # fast tracepoint (e.g., jump pad too far from |
127 » set pf_prefix $old_pf_prefix | 130 » » # tracepoint). |
128 » return | 131 » » pass "$test (too far)" |
129 » } | 132 » » # Skip the rest of the tests. |
| 133 return |
| 134 } else { |
| 135 » » fail "continue to marker 2" |
| 136 » » fail $test |
| 137 } |
| 138 |
| 139 } |
| 140 -re ".*Breakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" { |
| 141 pass "continue to marker 2" |
| 142 } |
130 } | 143 } |
| 144 |
131 # tracepoint has three locations after shlib change-loc-2 is loaded. | 145 # tracepoint has three locations after shlib change-loc-2 is loaded. |
132 gdb_test "info trace" \ | 146 gdb_test "info trace" \ |
133 "Num Type\[ \]+Disp Enb Address\[ \]+What.* | 147 "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
134 \[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*4\.1.* in func4.
*4\.2.* in func4.*4\.3.* in func4 .*" \ | 148 \[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*4\.1.* in func4.
*4\.2.* in func4.*4\.3.* in func4 .*" \ |
135 "tracepoint with three locations" | 149 "tracepoint with three locations" |
136 | 150 |
137 gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \ | 151 gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \ |
138 "continue to marker 3" | 152 "continue to marker 3" |
139 | 153 |
140 # shlib is unloaded, there are still three locations, but one is pending. | 154 # shlib is unloaded, there are still three locations, but one is pending. |
141 gdb_test "info trace" \ | 155 gdb_test "info trace" \ |
142 "Num Type\[ \]+Disp Enb Address\[ \]+What.* | 156 "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
143 \[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*4\.1.* in func4.
*4\.2.* in func4.*4\.3.* \<PENDING\>\[\t \]+set_tracepoint.*" \ | 157 \[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*4\.1.* in func4.
*(4\.2.* in func4.*4\.3.* \<PENDING\>\[\t \]+set_tracepoint|4\.2.* \<PENDING\>\[
\t \]+set_tracepoint\r\n4\.3.* in func4).*" \ |
144 "tracepoint with two locations (unload)" | 158 "tracepoint with two locations (unload)" |
145 | 159 |
146 gdb_test_no_output "tstop" | 160 gdb_test_no_output "tstop" |
147 | 161 |
148 gdb_test "tfind" "Found trace frame 0, tracepoint 4.*" "tfind frame 0" | 162 gdb_test "tfind" "Found trace frame 0, tracepoint 4.*" "tfind frame 0" |
149 gdb_test "tfind" "Target failed to find requested trace frame\\..*" | 163 gdb_test "tfind" "Target failed to find requested trace frame\\..*" |
150 | 164 }} |
151 set pf_prefix $old_pf_prefix | |
152 } | |
153 | 165 |
154 # Set pending tracepoint. | 166 # Set pending tracepoint. |
155 | 167 |
156 proc tracepoint_change_loc_2 { trace_type } { | 168 proc tracepoint_change_loc_2 { trace_type } { with_test_prefix "2 $trace_type" { |
157 global srcdir | 169 global srcdir |
158 global srcfile | 170 global srcfile |
159 global subdir | 171 global subdir |
160 global pcreg | 172 global pcreg |
161 global binfile | 173 global binfile |
162 global gdb_prompt | 174 global gdb_prompt |
163 global pf_prefix | |
164 | |
165 set old_pf_prefix $pf_prefix | |
166 set pf_prefix "$pf_prefix 2 $trace_type:" | |
167 | 175 |
168 gdb_exit | 176 gdb_exit |
169 gdb_start | 177 gdb_start |
170 gdb_reinitialize_dir $srcdir/$subdir | 178 gdb_reinitialize_dir $srcdir/$subdir |
171 | 179 |
172 gdb_test_multiple "${trace_type} set_tracepoint" "set pending tracepoint" { | 180 gdb_test_multiple "${trace_type} set_tracepoint" "set pending tracepoint" { |
173 -re ".*Make \(|fast \)tracepoint pending.*y or \\\[n\\\]. $" { | 181 -re ".*Make \(|fast \)tracepoint pending.*y or \\\[n\\\]. $" { |
174 gdb_test "y" "\(Fast t|T\)racepoint.*set_tracepoint.*pending." "set
pending tracepoint" | 182 gdb_test "y" "\(Fast t|T\)racepoint.*set_tracepoint.*pending." "set
pending tracepoint" |
175 } | 183 } |
176 } | 184 } |
(...skipping 30 matching lines...) Expand all Loading... |
207 # tracepoint has two locations after shlib change-loc-1 is loaded. | 215 # tracepoint has two locations after shlib change-loc-1 is loaded. |
208 gdb_test "info trace" \ | 216 gdb_test "info trace" \ |
209 "Num Type\[ \]+Disp Enb Address\[ \]+What.* | 217 "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
210 \[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*1\.1.* in func4.
*1\.2.* in func4.*" \ | 218 \[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*1\.1.* in func4.
*1\.2.* in func4.*" \ |
211 "tracepoint with two locations" | 219 "tracepoint with two locations" |
212 | 220 |
213 gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \ | 221 gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \ |
214 "breakpoint on marker" | 222 "breakpoint on marker" |
215 | 223 |
216 # tracepoint with two locations will be downloaded and installed. | 224 # tracepoint with two locations will be downloaded and installed. |
217 gdb_test_no_output "tstart" | 225 set test "tstart" |
218 | 226 gdb_test_multiple "tstart" $test { |
219 gdb_test_multiple "continue" "continue to marker 1" { | 227 -re "^tstart\r\n$gdb_prompt $" { |
220 » -re ".*Breakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" { | 228 » pass "tstart" |
221 » pass "continue to marker 1" | 229 } |
222 » } | 230 » -re "Target returns error code .* too far .*$gdb_prompt $" { |
223 » -re ".*$gdb_prompt $" { | 231 if [string equal $trace_type "ftrace"] { |
224 » kfail "gdb/13392" "continue to marker 1" | 232 » » # The target was unable to install the fast tracepoint |
225 » set pf_prefix $old_pf_prefix | 233 » » # (e.g., jump pad too far from tracepoint). |
226 » return | 234 » » pass "$test (too far)" |
| 235 » » # Skip the rest of the tests. |
| 236 » » return |
| 237 } else { |
| 238 » » fail $test |
| 239 } |
227 } | 240 } |
228 } | 241 } |
229 | 242 |
230 gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \ | 243 gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \ |
| 244 "continue to marker 1" |
| 245 |
| 246 gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \ |
231 "continue to marker 2" | 247 "continue to marker 2" |
232 | 248 |
233 # tracepoint has three locations after shlib change-loc-2 is loaded. | 249 # tracepoint has three locations after shlib change-loc-2 is loaded. |
234 gdb_test "info trace" \ | 250 gdb_test "info trace" \ |
235 "Num Type\[ \]+Disp Enb Address\[ \]+What.* | 251 "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
236 \[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*1\.1.* in func4.
*1\.2.* in func4.*1\.3.* in func4 .*" \ | 252 \[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*1\.1.* in func4.
*1\.2.* in func4.*1\.3.* in func4 .*" \ |
237 "tracepoint with three locations" | 253 "tracepoint with three locations" |
238 | 254 |
239 gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \ | 255 gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \ |
240 "continue to marker 3" | 256 "continue to marker 3" |
241 | 257 |
242 # shlib is unloaded, there are still three locations, but one is pending. | 258 # shlib is unloaded, there are still three locations, but one is pending. |
243 gdb_test "info trace" \ | 259 gdb_test "info trace" \ |
244 "Num Type\[ \]+Disp Enb Address\[ \]+What.* | 260 "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
245 \[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*1\.1.* in func4.
*1\.2.* in func4.*1\.3.* \<PENDING\>\[\t \]+set_tracepoint.*" \ | 261 \[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*1\.1.* in func4.
*(1\.2.* in func4.*1\.3.* \<PENDING\>\[\t \]+set_tracepoint|1\.2.* \<PENDING\>\[
\t \]+set_tracepoint\r\n1\.3.* in func4).*" \ |
246 "tracepoint with two locations (unload)" | 262 "tracepoint with two locations (unload)" |
247 | 263 |
248 gdb_test_no_output "tstop" | 264 gdb_test_no_output "tstop" |
249 | 265 |
250 gdb_test "tfind" "Found trace frame 0, tracepoint 1.*" "tfind frame 0" | 266 gdb_test "tfind" "Found trace frame 0, tracepoint 1.*" "tfind frame 0" |
251 gdb_test "tfind" "Found trace frame 1, tracepoint 1.*" "tfind frame 1" | 267 gdb_test "tfind" "Found trace frame 1, tracepoint 1.*" "tfind frame 1" |
252 gdb_test "tfind" "Found trace frame 2, tracepoint 1.*" "tfind frame 2" | 268 gdb_test "tfind" "Found trace frame 2, tracepoint 1.*" "tfind frame 2" |
253 gdb_test "tfind" "Target failed to find requested trace frame\\..*" | 269 gdb_test "tfind" "Target failed to find requested trace frame\\..*" |
254 | 270 }} |
255 set pf_prefix $old_pf_prefix | |
256 } | |
257 | 271 |
258 tracepoint_change_loc_1 "trace" | 272 tracepoint_change_loc_1 "trace" |
259 tracepoint_change_loc_2 "trace" | 273 tracepoint_change_loc_2 "trace" |
260 | 274 |
261 # Re-compile test case with IPA. | 275 # Re-compile test case with IPA. |
262 set libipa $objdir/../gdbserver/libinproctrace.so | 276 set libipa [get_in_proc_agent] |
263 gdb_load_shlibs $libipa | 277 gdb_load_shlibs $libipa |
264 | 278 |
265 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable \ | 279 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable \ |
266 [list debug nowarnings shlib=$libipa shlib=$lib_sl1 shlib_load] ] != "
" } { | 280 [list debug nowarnings shlib=$libipa shlib=$lib_sl1 shlib_load] ] != "
" } { |
267 untested change-loc.exp | 281 untested change-loc.exp |
268 return -1 | 282 return -1 |
269 } | 283 } |
270 | 284 |
271 tracepoint_change_loc_1 "ftrace" | 285 tracepoint_change_loc_1 "ftrace" |
272 tracepoint_change_loc_2 "ftrace" | 286 tracepoint_change_loc_2 "ftrace" |
OLD | NEW |