| 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 "pending" | 21 standard_testfile |
| 26 set libfile1 "pendshr1" | 22 set libfile1 "pendshr1" |
| 27 set libfile2 "pendshr2" | 23 set libfile2 "pendshr2" |
| 28 set executable $testfile | 24 set executable $testfile |
| 29 set srcfile $testfile.c | |
| 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 [gdb_target_symbol_prefix_flags] | 30 set lib_opts [gdb_target_symbol_prefix_flags] |
| 37 | 31 |
| 38 if { [gdb_compile_shlib $libsrc1 $lib_sl1 $lib_opts] != "" | 32 if { [gdb_compile_shlib $libsrc1 $lib_sl1 $lib_opts] != "" |
| 39 || [gdb_compile_shlib $libsrc2 $lib_sl2 $lib_opts] != ""} { | 33 || [gdb_compile_shlib $libsrc2 $lib_sl2 $lib_opts] != ""} { |
| 40 untested "Could not compile either $libsrc1 or $libsrc2" | 34 untested "Could not compile either $libsrc1 or $libsrc2" |
| 41 return -1 | 35 return -1 |
| 42 } | 36 } |
| 43 | 37 |
| 44 set exec_opts [list debug shlib=$lib_sl1 shlib_load] | 38 set exec_opts [list debug shlib=$lib_sl1 shlib_load] |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 return -1 | 51 return -1 |
| 58 } | 52 } |
| 59 | 53 |
| 60 if ![gdb_target_supports_trace] { | 54 if ![gdb_target_supports_trace] { |
| 61 unsupported "Current target does not support trace" | 55 unsupported "Current target does not support trace" |
| 62 return -1; | 56 return -1; |
| 63 } | 57 } |
| 64 | 58 |
| 65 # Verify pending tracepoint is resolved to running to main. | 59 # Verify pending tracepoint is resolved to running to main. |
| 66 | 60 |
| 67 proc pending_tracepoint_resolved { trace_type } { | 61 proc pending_tracepoint_resolved { trace_type } { with_test_prefix "$trace_type
resolved" { |
| 68 global srcdir | 62 global srcdir |
| 69 global subdir | 63 global subdir |
| 70 global binfile | 64 global binfile |
| 71 global srcfile | 65 global srcfile |
| 72 global lib_sl1 | 66 global lib_sl1 |
| 73 global pf_prefix | |
| 74 | |
| 75 set old_pf_prefix $pf_prefix | |
| 76 lappend pf_prefix "$trace_type" "resolved:" | |
| 77 | 67 |
| 78 # Start with a fresh gdb. | 68 # Start with a fresh gdb. |
| 79 gdb_exit | 69 gdb_exit |
| 80 gdb_start | 70 gdb_start |
| 81 gdb_reinitialize_dir $srcdir/$subdir | 71 gdb_reinitialize_dir $srcdir/$subdir |
| 82 | 72 |
| 83 gdb_test_multiple "$trace_type set_point1" "set pending tracepoint" { | 73 gdb_test_multiple "$trace_type set_point1" "set pending tracepoint" { |
| 84 -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" { | 74 -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" { |
| 85 gdb_test "y" "\(Fast t|T\)racepoint.*set_point1.*pending." \ | 75 gdb_test "y" "\(Fast t|T\)racepoint.*set_point1.*pending." \ |
| 86 "set pending tracepoint (without symbols)" | 76 "set pending tracepoint (without symbols)" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 98 "breakpoint function" | 88 "breakpoint function" |
| 99 | 89 |
| 100 gdb_run_cmd | 90 gdb_run_cmd |
| 101 gdb_test "" "Breakpoint 2, main.*" | 91 gdb_test "" "Breakpoint 2, main.*" |
| 102 | 92 |
| 103 # Run to main which should resolve a pending tracepoint | 93 # Run to main which should resolve a pending tracepoint |
| 104 gdb_test "info trace" \ | 94 gdb_test "info trace" \ |
| 105 "Num Type\[ \]+Disp Enb Address\[ \]+What.* | 95 "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
| 106 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*pendfunc.*" \ | 96 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*pendfunc.*" \ |
| 107 "single tracepoint info" | 97 "single tracepoint info" |
| 108 | 98 }} |
| 109 set pf_prefix $old_pf_prefix | |
| 110 } | |
| 111 | 99 |
| 112 # Verify pending tracepoint is resolved and works as expected. | 100 # Verify pending tracepoint is resolved and works as expected. |
| 113 | 101 |
| 114 proc pending_tracepoint_works { trace_type } { | 102 proc pending_tracepoint_works { trace_type } { with_test_prefix "$trace_type wor
ks" { |
| 115 global executable | 103 global executable |
| 116 global srcfile | 104 global srcfile |
| 117 global lib_sl1 | 105 global lib_sl1 |
| 118 global pf_prefix | |
| 119 global gdb_prompt | 106 global gdb_prompt |
| 120 | 107 |
| 121 set old_pf_prefix $pf_prefix | |
| 122 lappend pf_prefix "$trace_type" "works:" | |
| 123 | |
| 124 # Restart with a fresh gdb. | 108 # Restart with a fresh gdb. |
| 125 clean_restart $executable | 109 clean_restart $executable |
| 126 | 110 |
| 127 # Test setting and querying pending tracepoints | 111 # Test setting and querying pending tracepoints |
| 128 | 112 |
| 129 gdb_test_multiple "$trace_type set_point1" "set pending tracepoint" { | 113 gdb_test_multiple "$trace_type set_point1" "set pending tracepoint" { |
| 130 -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" { | 114 -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" { |
| 131 gdb_test "y" "\(Fast t|T\)racepoint.*set_point1.*pending." "set pend
ing tracepoint" | 115 gdb_test "y" "\(Fast t|T\)racepoint.*set_point1.*pending." "set pend
ing tracepoint" |
| 132 } | 116 } |
| 133 } | 117 } |
| 134 | 118 |
| 135 gdb_test "info trace" \ | 119 gdb_test "info trace" \ |
| 136 "Num Type\[ \]+Disp Enb Address\[ \]+What.* | 120 "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
| 137 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*PENDING.*set_point1.*" \ | 121 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*PENDING.*set_point1.*" \ |
| 138 "single pending tracepoint info" | 122 "single pending tracepoint info" |
| 139 | 123 |
| 140 # Run to main which should resolve a pending tracepoint | 124 # Run to main which should resolve a pending tracepoint |
| 141 gdb_test "break main" "Breakpoint.*at.* file .*$srcfile, line.*" \ | 125 gdb_test "break main" "Breakpoint.*at.* file .*$srcfile, line.*" \ |
| 142 "breakpoint function" | 126 "breakpoint function" |
| 143 gdb_run_cmd | 127 gdb_run_cmd |
| 144 gdb_test "" "Breakpoint 2, main.*" | 128 gdb_test "" "Breakpoint 2, main.*" |
| 145 | 129 |
| 146 gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \ | 130 gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \ |
| 147 "breakpoint on marker" | 131 "breakpoint on marker" |
| 148 | 132 |
| 149 gdb_test_no_output "tstart" "start trace experiment" | 133 set test "start trace experiment" |
| 134 gdb_test_multiple "tstart" $test { |
| 135 » -re "^tstart\r\n$gdb_prompt $" { |
| 136 » pass $test |
| 137 » } |
| 138 » -re "Target returns error code .* too far .*$gdb_prompt $" { |
| 139 » if [string equal $trace_type "ftrace"] { |
| 140 » » # The target was unable to install the fast tracepoint |
| 141 » » # (e.g., jump pad too far from tracepoint). |
| 142 » » pass "$test (too far)" |
| 143 » » # Skip the rest of the tests. |
| 144 » » return |
| 145 » } else { |
| 146 » » fail $test |
| 147 » } |
| 148 » } |
| 150 | 149 |
| 151 gdb_test_multiple "continue" "continue to marker" { | |
| 152 -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $"
{ | |
| 153 pass "continue to marker" | |
| 154 } | |
| 155 -re ".*$gdb_prompt $" { | |
| 156 kfail "gdb/13392" "continue to marker" | |
| 157 set pf_prefix $old_pf_prefix | |
| 158 return | |
| 159 } | |
| 160 } | 150 } |
| 161 | 151 |
| 152 gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*"
\ |
| 153 "continue to marker" |
| 154 |
| 162 gdb_test "tstop" "\[\r\n\]+" "stop trace experiment" | 155 gdb_test "tstop" "\[\r\n\]+" "stop trace experiment" |
| 163 | 156 |
| 164 gdb_test "tfind start" "#0 .*" "tfind test frame 0" | 157 gdb_test "tfind start" "#0 .*" "tfind test frame 0" |
| 165 gdb_test "tfind" "Found trace frame 1, tracepoint 1.*" "tfind test frame 1" | 158 gdb_test "tfind" "Found trace frame 1, tracepoint 1.*" "tfind test frame 1" |
| 166 gdb_test "tfind" "Found trace frame 2, tracepoint 1.*" "tfind test frame 2" | 159 gdb_test "tfind" "Found trace frame 2, tracepoint 1.*" "tfind test frame 2" |
| 167 gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind tes
t frame" | 160 gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind tes
t frame" |
| 168 | 161 }} |
| 169 set pf_prefix $old_pf_prefix | |
| 170 } | |
| 171 | 162 |
| 172 # Verify pending tracepoint is resolved during trace. | 163 # Verify pending tracepoint is resolved during trace. |
| 173 | 164 |
| 174 proc pending_tracepoint_resolved_during_trace { trace_type } { | 165 proc pending_tracepoint_resolved_during_trace { trace_type } \ |
| 166 { with_test_prefix "$trace_type resolved_in_trace" \ |
| 167 { |
| 175 global executable | 168 global executable |
| 176 global srcfile | 169 global srcfile |
| 177 global gdb_prompt | 170 global gdb_prompt |
| 178 global lib_sl1 | 171 global lib_sl1 |
| 179 global pf_prefix | |
| 180 | |
| 181 set old_pf_prefix $pf_prefix | |
| 182 lappend pf_prefix "$trace_type" "resolved_in_trace:" | |
| 183 | 172 |
| 184 # Start with a fresh gdb. | 173 # Start with a fresh gdb. |
| 185 clean_restart $executable | 174 clean_restart $executable |
| 186 if ![runto_main] { | 175 if ![runto_main] { |
| 187 fail "Can't run to main" | 176 fail "Can't run to main" |
| 188 set pf_prefix $old_pf_prefix | |
| 189 return -1 | 177 return -1 |
| 190 } | 178 } |
| 191 | 179 |
| 192 gdb_test_multiple "$trace_type set_point2" "set pending tracepoint on set_po
int2" { | 180 gdb_test_multiple "$trace_type set_point2" "set pending tracepoint on set_po
int2" { |
| 193 -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" { | 181 -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" { |
| 194 gdb_test "y" "\(Fast t|T\)racepoint.*set_point2.*pending." \ | 182 gdb_test "y" "\(Fast t|T\)racepoint.*set_point2.*pending." \ |
| 195 "set pending tracepoint (without symbols)" | 183 "set pending tracepoint (without symbols)" |
| 196 } | 184 } |
| 197 } | 185 } |
| 198 | 186 |
| 199 gdb_test "info trace" \ | 187 gdb_test "info trace" \ |
| 200 "Num Type\[ \]+Disp Enb Address\[ \]+What.* | 188 "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
| 201 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*PENDING.*set_point2.*" \ | 189 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*PENDING.*set_point2.*" \ |
| 202 "single pending tracepoint on set_point2" | 190 "single pending tracepoint on set_point2" |
| 203 | 191 |
| 204 gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \ | 192 gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \ |
| 205 "breakpoint on marker" | 193 "breakpoint on marker" |
| 206 | 194 |
| 207 gdb_test_no_output "tstart" "start trace experiment" | 195 gdb_test_no_output "tstart" "start trace experiment" |
| 208 | 196 |
| 209 gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*pending.c.*"
\ | 197 gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*pending.c.*"
\ |
| 210 "continue to marker 1" | 198 "continue to marker 1" |
| 211 | 199 |
| 212 gdb_test_multiple "continue" "continue to marker 2" { | 200 set test "continue to marker 2" |
| 201 gdb_test_multiple "continue" $test { |
| 202 » -re "Target returns error code .* too far .*$gdb_prompt $" { |
| 203 » if [string equal $trace_type "ftrace"] { |
| 204 » » # Expected if the target was unable to install the |
| 205 » » # fast tracepoint (e.g., jump pad too far from |
| 206 » » # tracepoint). |
| 207 » » pass "$test (too far)" |
| 208 » » # Skip the rest of the tests. |
| 209 » » return |
| 210 » } else { |
| 211 » » fail $test |
| 212 » } |
| 213 » } |
| 213 -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $"
{ | 214 -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $"
{ |
| 214 » pass "continue to marker 2" | 215 » pass $test |
| 215 » } | |
| 216 » -re ".*$gdb_prompt $" { | |
| 217 » kfail "gdb/13392" "continue to marker 2" | |
| 218 » set pf_prefix $old_pf_prefix | |
| 219 » return | |
| 220 } | 216 } |
| 221 } | 217 } |
| 222 | 218 |
| 223 gdb_test "tstop" "\[\r\n\]+" "stop trace experiment" | 219 gdb_test "tstop" "\[\r\n\]+" "stop trace experiment" |
| 224 | 220 |
| 225 # tracepoint should be resolved. | 221 # tracepoint should be resolved. |
| 226 gdb_test "info trace" \ | 222 gdb_test "info trace" \ |
| 227 "Num Type\[ \]+Disp Enb Address\[ \]+What.* | 223 "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
| 228 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*pendfunc2.*" \ | 224 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*pendfunc2.*" \ |
| 229 "tracepoint is resolved" | 225 "tracepoint is resolved" |
| 230 | 226 |
| 231 gdb_test "tfind start" "#0 .*" "tfind test frame 0" | 227 gdb_test "tfind start" "#0 .*" "tfind test frame 0" |
| 232 gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind tes
t frame" | 228 gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind tes
t frame" |
| 233 | 229 }} |
| 234 set pf_prefix $old_pf_prefix | |
| 235 } | |
| 236 | 230 |
| 237 # Verify pending tracepoint is resolved and installed during trace. | 231 # Verify pending tracepoint is resolved and installed during trace. |
| 238 | 232 |
| 239 proc pending_tracepoint_installed_during_trace { trace_type } { | 233 proc pending_tracepoint_installed_during_trace { trace_type } \ |
| 234 { with_test_prefix "$trace_type installed_in_trace" \ |
| 235 { |
| 240 global executable | 236 global executable |
| 241 global srcfile | 237 global srcfile |
| 242 global lib_sl1 | 238 global lib_sl1 |
| 243 global gdb_prompt | 239 global gdb_prompt |
| 244 global pf_prefix | |
| 245 global hex | 240 global hex |
| 246 | 241 |
| 247 set old_pf_prefix $pf_prefix | |
| 248 lappend pf_prefix "$trace_type" "installed_in_trace:" | |
| 249 | |
| 250 # Start with a fresh gdb. | 242 # Start with a fresh gdb. |
| 251 clean_restart $executable | 243 clean_restart $executable |
| 252 if ![runto_main] { | 244 if ![runto_main] { |
| 253 fail "Can't run to main" | 245 fail "Can't run to main" |
| 254 set pf_prefix $old_pf_prefix | |
| 255 return -1 | 246 return -1 |
| 256 } | 247 } |
| 257 | 248 |
| 258 gdb_test "next" ".*" | 249 gdb_test "next" ".*" |
| 259 gdb_test "trace main" "Tracepoint \[0-9\] at .*" "set tracepoint on main" | 250 gdb_test "trace main" "Tracepoint \[0-9\] at .*" "set tracepoint on main" |
| 260 | 251 |
| 261 gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \ | 252 gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \ |
| 262 "breakpoint on marker" | 253 "breakpoint on marker" |
| 263 | 254 |
| 264 gdb_test_no_output "tstart" "start trace experiment" | 255 gdb_test_no_output "tstart" "start trace experiment" |
| 265 | 256 |
| 266 gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*${srcfile}.*
" \ | 257 gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*${srcfile}.*
" \ |
| 267 "continue to marker 1" | 258 "continue to marker 1" |
| 268 | 259 |
| 269 # Set a pending tracepoint during a tracing experiment. | 260 # Set a pending tracepoint during a tracing experiment. |
| 270 gdb_test_multiple "$trace_type set_point2" "set pending tracepoint on set_po
int2" { | 261 gdb_test_multiple "$trace_type set_point2" "set pending tracepoint on set_po
int2" { |
| 271 -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" { | 262 -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" { |
| 272 gdb_test "y" "\(Fast t|T\)racepoint.*set_point2.*pending." \ | 263 gdb_test "y" "\(Fast t|T\)racepoint.*set_point2.*pending." \ |
| 273 "set pending tracepoint" | 264 "set pending tracepoint" |
| 274 } | 265 } |
| 275 } | 266 } |
| 276 | 267 |
| 277 gdb_test "info trace" \ | 268 gdb_test "info trace" \ |
| 278 "Num Type\[ \]+Disp Enb Address\[ \]+What.* | 269 "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
| 279 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \t\]+keep y.*PENDING.*set_point2.*" \ | 270 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \t\]+keep y.*PENDING.*set_point2.*" \ |
| 280 "single pending tracepoint on set_point2" | 271 "single pending tracepoint on set_point2" |
| 281 | 272 |
| 282 gdb_test_multiple "continue" "continue to marker 2" { | 273 set test "continue to marker 2" |
| 274 gdb_test_multiple "continue" $test { |
| 275 » -re "Target returns error code .* too far .*$gdb_prompt $" { |
| 276 » if [string equal $trace_type "ftrace"] { |
| 277 » » # Expected if the target was unable to install the |
| 278 » » # fast tracepoint (e.g., jump pad too far from |
| 279 » » # tracepoint). |
| 280 » » pass "$test (too far)" |
| 281 » » # Skip the rest of the tests. |
| 282 » » return |
| 283 » } else { |
| 284 » » fail $test |
| 285 » } |
| 286 » } |
| 283 -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $"
{ | 287 -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $"
{ |
| 284 » pass "continue to marker 2" | 288 pass $test |
| 285 » } | 289 } |
| 286 » -re ".*$gdb_prompt $" { | |
| 287 » kfail "gdb/13392" "continue to marker 2" | |
| 288 » set pf_prefix $old_pf_prefix | |
| 289 » return | |
| 290 » } | |
| 291 } | 290 } |
| 292 | 291 |
| 293 gdb_test "tstop" "\[\r\n\]+" "stop trace experiment" | 292 gdb_test "tstop" "\[\r\n\]+" "stop trace experiment" |
| 294 | 293 |
| 295 # tracepoint should be resolved. | 294 # tracepoint should be resolved. |
| 296 gdb_test "info trace" \ | 295 gdb_test "info trace" \ |
| 297 "Num Type\[ \]+Disp Enb Address\[ \]+What.* | 296 "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
| 298 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*pendfunc2.*" \ | 297 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*pendfunc2.*" \ |
| 299 "tracepoint is resolved" | 298 "tracepoint is resolved" |
| 300 | 299 |
| 301 gdb_test "tfind start" "#0 $hex in pendfunc2 .*" "tfind test frame 0" | 300 gdb_test "tfind start" "#0 $hex in pendfunc2 .*" "tfind test frame 0" |
| 302 gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind tes
t frame" | 301 gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind tes
t frame" |
| 303 | 302 }} |
| 304 set pf_prefix $old_pf_prefix | |
| 305 } | |
| 306 | 303 |
| 307 | 304 |
| 308 # Verify pending tracepoint will no longer work if we disconnect during tracing. | 305 # Verify pending tracepoint will no longer work if we disconnect during tracing. |
| 309 | 306 |
| 310 proc pending_tracepoint_disconnect_during_trace { trace_type } { | 307 proc pending_tracepoint_disconnect_during_trace { trace_type } \ |
| 308 { with_test_prefix "$trace_type disconn" \ |
| 309 { |
| 311 global executable | 310 global executable |
| 312 global srcfile | 311 global srcfile |
| 313 global lib_sl1 | 312 global lib_sl1 |
| 314 global pf_prefix | |
| 315 global gdb_prompt | 313 global gdb_prompt |
| 316 | 314 |
| 317 set old_pf_prefix $pf_prefix | |
| 318 lappend pf_prefix "$trace_type" "disconn:" | |
| 319 | |
| 320 # Start with a fresh gdb. | 315 # Start with a fresh gdb. |
| 321 clean_restart $executable | 316 clean_restart $executable |
| 322 if ![runto_main] { | 317 if ![runto_main] { |
| 323 fail "Can't run to main" | 318 fail "Can't run to main" |
| 324 set pf_prefix $old_pf_prefix | |
| 325 return -1 | 319 return -1 |
| 326 } | 320 } |
| 327 | 321 |
| 328 gdb_test_multiple "trace pendfunc3" "set pending tracepoint on set_point2" { | 322 gdb_test_multiple "trace pendfunc3" "set pending tracepoint on set_point2" { |
| 329 -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" { | 323 -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" { |
| 330 gdb_test "y" "\(Fast t|T\)racepoint.*pendfunc3.*pending." \ | 324 gdb_test "y" "\(Fast t|T\)racepoint.*pendfunc3.*pending." \ |
| 331 "set pending tracepoint on pendfun3" | 325 "set pending tracepoint on pendfun3" |
| 332 } | 326 } |
| 333 } | 327 } |
| 334 | 328 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 346 pass $test | 340 pass $test |
| 347 | 341 |
| 348 set test "disconnected" | 342 set test "disconnected" |
| 349 gdb_test_multiple "y" $test { | 343 gdb_test_multiple "y" $test { |
| 350 -re "$gdb_prompt $" { | 344 -re "$gdb_prompt $" { |
| 351 pass "$test" | 345 pass "$test" |
| 352 } | 346 } |
| 353 } | 347 } |
| 354 } | 348 } |
| 355 } | 349 } |
| 356 | 350 }} |
| 357 set pf_prefix $old_pf_prefix | |
| 358 } | |
| 359 | 351 |
| 360 | 352 |
| 361 # Verify disconnect after pending tracepoint has been resolved. | 353 # Verify disconnect after pending tracepoint has been resolved. |
| 362 | 354 |
| 363 proc pending_tracepoint_disconnect_after_resolved { trace_type } { | 355 proc pending_tracepoint_disconnect_after_resolved { trace_type } \ |
| 356 { with_test_prefix "$trace_type disconn_resolved" \ |
| 357 { |
| 364 global executable | 358 global executable |
| 365 global srcfile | 359 global srcfile |
| 366 global lib_sl1 | 360 global lib_sl1 |
| 367 global gdb_prompt | 361 global gdb_prompt |
| 368 global pf_prefix | |
| 369 | |
| 370 set old_pf_prefix $pf_prefix | |
| 371 lappend pf_prefix "$trace_type" "disconn_resolved:" | |
| 372 | 362 |
| 373 # Start with a fresh gdb. | 363 # Start with a fresh gdb. |
| 374 clean_restart $executable | 364 clean_restart $executable |
| 375 if ![runto_main] { | 365 if ![runto_main] { |
| 376 fail "Can't run to main" | 366 fail "Can't run to main" |
| 377 set pf_prefix $old_pf_prefix | |
| 378 return -1 | 367 return -1 |
| 379 } | 368 } |
| 380 | 369 |
| 381 gdb_test_multiple "trace set_point2" "set pending tracepoint on set_point2"
{ | 370 gdb_test_multiple "trace set_point2" "set pending tracepoint on set_point2"
{ |
| 382 -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" { | 371 -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" { |
| 383 gdb_test "y" "\(Fast t|T\)racepoint.*set_point2.*pending." \ | 372 gdb_test "y" "\(Fast t|T\)racepoint.*set_point2.*pending." \ |
| 384 "set pending tracepoint on pendfun2" | 373 "set pending tracepoint on pendfun2" |
| 385 } | 374 } |
| 386 } | 375 } |
| 387 | 376 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 404 -re "Trace is running but will stop on detach; detach anyway\\? \\(y or
n\\) $" { | 393 -re "Trace is running but will stop on detach; detach anyway\\? \\(y or
n\\) $" { |
| 405 pass $test | 394 pass $test |
| 406 } | 395 } |
| 407 } | 396 } |
| 408 set test "disconnected" | 397 set test "disconnected" |
| 409 gdb_test_multiple "y" $test { | 398 gdb_test_multiple "y" $test { |
| 410 -re "$gdb_prompt $" { | 399 -re "$gdb_prompt $" { |
| 411 pass "$test" | 400 pass "$test" |
| 412 } | 401 } |
| 413 } | 402 } |
| 414 | 403 }} |
| 415 set pf_prefix $old_pf_prefix | |
| 416 } | |
| 417 | 404 |
| 418 # Verify action works properly in resolved tracepoint. | 405 # Verify action works properly in resolved tracepoint. |
| 419 | 406 |
| 420 proc pending_tracepoint_with_action_resolved { trace_type } { | 407 proc pending_tracepoint_with_action_resolved { trace_type } \ |
| 408 { with_test_prefix "$trace_type action_resolved" \ |
| 409 { |
| 421 global executable | 410 global executable |
| 422 global srcfile | 411 global srcfile |
| 423 global lib_sl1 | 412 global lib_sl1 |
| 424 global gdb_prompt | 413 global gdb_prompt |
| 425 global pf_prefix | |
| 426 | |
| 427 set old_pf_prefix $pf_prefix | |
| 428 lappend pf_prefix "$trace_type" "action_resolved:" | |
| 429 | 414 |
| 430 # Start with a fresh gdb. | 415 # Start with a fresh gdb. |
| 431 clean_restart $executable | 416 clean_restart $executable |
| 432 if ![runto_main] { | 417 if ![runto_main] { |
| 433 fail "Can't run to main" | 418 fail "Can't run to main" |
| 434 set pf_prefix $old_pf_prefix | |
| 435 return -1 | 419 return -1 |
| 436 } | 420 } |
| 437 | 421 |
| 438 gdb_test_multiple "$trace_type set_point2" "set pending tracepoint on set_po
int2" { | 422 gdb_test_multiple "$trace_type set_point2" "set pending tracepoint on set_po
int2" { |
| 439 -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" { | 423 -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" { |
| 440 gdb_test "y" "\(Fast t|T\)racepoint.*set_point2.*pending." \ | 424 gdb_test "y" "\(Fast t|T\)racepoint.*set_point2.*pending." \ |
| 441 "set pending tracepoint (without symbols)" | 425 "set pending tracepoint (without symbols)" |
| 442 } | 426 } |
| 443 } | 427 } |
| 444 | 428 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 458 "single pending tracepoint on set_point2" | 442 "single pending tracepoint on set_point2" |
| 459 | 443 |
| 460 gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \ | 444 gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \ |
| 461 "breakpoint on marker" | 445 "breakpoint on marker" |
| 462 | 446 |
| 463 gdb_test_no_output "tstart" "start trace experiment" | 447 gdb_test_no_output "tstart" "start trace experiment" |
| 464 | 448 |
| 465 gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*pending.c.*"
\ | 449 gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*pending.c.*"
\ |
| 466 "continue to marker 1" | 450 "continue to marker 1" |
| 467 | 451 |
| 468 gdb_test_multiple "continue" "continue to marker 2" { | 452 set test "continue to marker 2" |
| 453 gdb_test_multiple "continue" $test { |
| 454 » -re "Target returns error code .* too far .*$gdb_prompt $" { |
| 455 if [string equal $trace_type "ftrace"] { |
| 456 » » # Expected if the target was unable to install the |
| 457 » » # fast tracepoint (e.g., jump pad too far from |
| 458 » » # tracepoint). |
| 459 » » pass "$test (too far)" |
| 460 » » # Skip the rest of the tests. |
| 461 » » return |
| 462 } else { |
| 463 » » fail $test |
| 464 } |
| 465 » } |
| 469 -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $"
{ | 466 -re "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*$gdb_prompt $"
{ |
| 470 pass "continue to marker 2" | 467 pass "continue to marker 2" |
| 471 } | 468 } |
| 472 » -re ".*$gdb_prompt $" { | 469 |
| 473 » kfail "gdb/13392" "continue to marker 2" | |
| 474 » set pf_prefix $old_pf_prefix | |
| 475 » return | |
| 476 » } | |
| 477 } | 470 } |
| 478 | 471 |
| 479 gdb_test "tstop" "\[\r\n\]+" "stop trace experiment" | 472 gdb_test "tstop" "\[\r\n\]+" "stop trace experiment" |
| 480 | 473 |
| 481 # tracepoint should be resolved. | 474 # tracepoint should be resolved. |
| 482 gdb_test "info trace" \ | 475 gdb_test "info trace" \ |
| 483 "Num Type\[ \]+Disp Enb Address\[ \]+What.* | 476 "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
| 484 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*pendfunc2.*" \ | 477 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*pendfunc2.*" \ |
| 485 "tracepoint is resolved" | 478 "tracepoint is resolved" |
| 486 | 479 |
| 487 gdb_test "tfind start" "#0 .*" "tfind test frame 0" | 480 gdb_test "tfind start" "#0 .*" "tfind test frame 0" |
| 488 gdb_test "tdump" "Data collected at tracepoint .*, trace frame \[0-9\]:.*\\$
${pcreg} = .*" | 481 gdb_test "tdump" "Data collected at tracepoint .*, trace frame \[0-9\]:.*\\$
${pcreg} = .*" |
| 489 gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind tes
t frame" | 482 gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind tes
t frame" |
| 490 | 483 }} |
| 491 set pf_prefix $old_pf_prefix | |
| 492 } | |
| 493 | 484 |
| 494 pending_tracepoint_resolved "trace" | 485 pending_tracepoint_resolved "trace" |
| 495 | 486 |
| 496 pending_tracepoint_works "trace" | 487 pending_tracepoint_works "trace" |
| 497 | 488 |
| 498 pending_tracepoint_resolved_during_trace "trace" | 489 pending_tracepoint_resolved_during_trace "trace" |
| 499 | 490 |
| 500 pending_tracepoint_disconnect_during_trace "trace" | 491 pending_tracepoint_disconnect_during_trace "trace" |
| 501 | 492 |
| 502 pending_tracepoint_disconnect_after_resolved "trace" | 493 pending_tracepoint_disconnect_after_resolved "trace" |
| 503 | 494 |
| 504 pending_tracepoint_with_action_resolved "trace" | 495 pending_tracepoint_with_action_resolved "trace" |
| 505 | 496 |
| 506 pending_tracepoint_installed_during_trace "trace" | 497 pending_tracepoint_installed_during_trace "trace" |
| 507 | 498 |
| 508 # Re-compile test case with IPA. | 499 # Re-compile test case with IPA. |
| 509 set libipa $objdir/../gdbserver/libinproctrace.so | 500 set libipa [get_in_proc_agent] |
| 510 gdb_load_shlibs $libipa | 501 gdb_load_shlibs $libipa |
| 511 | 502 |
| 512 lappend exec_opts "shlib=$libipa" | 503 lappend exec_opts "shlib=$libipa" |
| 513 | 504 |
| 514 if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""
} { | 505 if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $exec_opts] != ""
} { |
| 515 untested "Failed to compile $srcfile" | 506 untested "Failed to compile $srcfile" |
| 516 return -1 | 507 return -1 |
| 517 } | 508 } |
| 518 | 509 |
| 519 pending_tracepoint_resolved "ftrace" | 510 pending_tracepoint_resolved "ftrace" |
| 520 pending_tracepoint_works "ftrace" | 511 pending_tracepoint_works "ftrace" |
| 521 pending_tracepoint_resolved_during_trace "ftrace" | 512 pending_tracepoint_resolved_during_trace "ftrace" |
| 522 pending_tracepoint_disconnect_during_trace "ftrace" | 513 pending_tracepoint_disconnect_during_trace "ftrace" |
| 523 pending_tracepoint_disconnect_after_resolved "ftrace" | 514 pending_tracepoint_disconnect_after_resolved "ftrace" |
| 524 pending_tracepoint_with_action_resolved "ftrace" | 515 pending_tracepoint_with_action_resolved "ftrace" |
| 525 pending_tracepoint_installed_during_trace "ftrace" | 516 pending_tracepoint_installed_during_trace "ftrace" |
| OLD | NEW |