| OLD | NEW |
| 1 # Copyright 2011-2012 Free Software Foundation, Inc. | 1 # Copyright 2011-2013 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 {[skip_shlib_tests]} { | 17 if {[skip_shlib_tests]} { |
| 18 return 0 | 18 return 0 |
| 19 } | 19 } |
| 20 | 20 |
| 21 standard_testfile | 21 standard_testfile |
| 22 set executable $testfile | 22 set executable $testfile |
| 23 | 23 |
| 24 set libipa [get_in_proc_agent] | 24 set libipa [get_in_proc_agent] |
| 25 | 25 |
| 26 set lib_opts debug | 26 set lib_opts debug |
| 27 | 27 |
| 28 if [get_compiler_info] { | 28 if [get_compiler_info] { |
| 29 return -1 | 29 return -1 |
| 30 } | 30 } |
| 31 | 31 |
| 32 set additional_flags [list quiet debug shlib=$libipa shlib_load \ | 32 set additional_flags [list quiet debug shlib=$libipa shlib_load \ |
| 33 "additional_flags=-lust -lurcu-bp" ] | 33 "additional_flags=-lust -lurcu-bp" ] |
| 34 | 34 |
| 35 if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $additional_flags
] != ""} { | 35 if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable $additional_flags
] != ""} { |
| 36 untested "UST library or headers are not installed" | 36 untested "UST library or headers are not installed" |
| 37 return -1 | 37 return -1 |
| 38 } | 38 } |
| 39 | 39 |
| 40 proc strace_info_marker { } { with_test_prefix "info_marker" { | 40 # Test that the socket file is removed when GDB quits, detaches or |
| 41 # resumes the inferior until it exits. |
| 42 |
| 43 proc strace_remove_socket { action } { |
| 44 with_test_prefix "remove_socket_after_${action}" { |
| 45 |
| 41 global executable | 46 global executable |
| 42 global gdb_prompt | 47 global gdb_prompt |
| 48 global libipa |
| 43 | 49 |
| 44 # Restart with a fresh gdb. | 50 # Restart with a fresh gdb. |
| 45 clean_restart $executable | 51 clean_restart $executable |
| 52 gdb_load_shlibs $libipa |
| 46 if ![runto_main] { | 53 if ![runto_main] { |
| 47 fail "Can't run to main" | 54 fail "Can't run to main" |
| 48 return -1 | 55 return -1 |
| 49 } | 56 } |
| 50 | 57 |
| 51 # List the markers in program. They should be disabled. | 58 # List the markers in program. |
| 52 gdb_test "info static-tracepoint-markers" \ | 59 gdb_test "info static-tracepoint-markers" \ |
| 53 ".*ust/bar\[\t \]+n\[\t \]+.*ust/bar2\[\t \]+n\[\t \]+.*" | 60 ".*ust/bar\[\t \]+n\[\t \]+.*ust/bar2\[\t \]+n\[\t \]+.*" |
| 54 | 61 |
| 55 # List all the thread. It is expected to get three threads without | 62 set pid "" |
| 56 # any errors. | 63 set test "collect pid" |
| 57 gdb_test_multiple "info threads 3 2 1" "info threads" { | 64 gdb_test_multiple "info inferiors" $test { |
| 58 » -re "3\[ \t\]+Thread .*2\[ \t\]+Thread .*1\[ \t\]+Thread .*${gdb_prompt}
$" { | 65 » -re "process (\[-0-9a-fx\]+) \[^\n\]*\n.*${gdb_prompt} $" { |
| 59 » pass "info threads" | 66 » set pid $expect_out(1,string) |
| 60 » } | 67 » pass $test |
| 68 » } |
| 69 » -re ".*${gdb_prompt} $" { |
| 70 » fail $test |
| 71 » } |
| 72 } |
| 73 |
| 74 set test "socket file exists" |
| 75 set socket_file "/tmp/gdb_ust${pid}" |
| 76 set status [remote_exec target "sh -c { \[ -S $socket_file \] }"] |
| 77 |
| 78 if { [lindex $status 0] == 0 } { |
| 79 » pass $test |
| 80 } else { |
| 81 » fail $test |
| 82 } |
| 83 |
| 84 send_gdb "${action}\n" |
| 85 gdb_expect { |
| 86 » -re "A debugging session is active.\r\n.*\r\nQuit anyway\\? \\(y or n\\)
$" { |
| 87 » send_gdb "y\n" |
| 88 » } |
| 89 » -re "Detaching .*, process .*$" { |
| 90 » } |
| 91 » -re "Continuing.*$" { |
| 92 » } |
| 93 } |
| 94 |
| 95 set exists 1 |
| 96 |
| 97 for {set i 1} {$i <= 5} {incr i} { |
| 98 » set status [remote_exec target "sh -c { \[ -S $socket_file \] }"] |
| 99 » if { [lindex $status 0] != 0 } { |
| 100 » set exists 0 |
| 101 » break |
| 102 » } |
| 103 » sleep 1 |
| 104 } |
| 105 |
| 106 if { ![is_remote target] && ![string equal $action "detach"] } { |
| 107 » setup_kfail gdb/14161 *-*-* |
| 108 } |
| 109 |
| 110 set test "socket file removed" |
| 111 |
| 112 if { $exists } { |
| 113 » fail $test |
| 114 » # Since $socket_file is a socket file instead of a regular file, we |
| 115 » # can't use 'remote_file target delete $socket_file' here. |
| 116 » remote_exec target "sh -c \"rm -r $socket_file\"" |
| 117 } else { |
| 118 » pass $test |
| 119 } |
| 120 |
| 121 if { [string equal $action "quit"] && [is_remote host] } { |
| 122 » global gdb_spawn_id |
| 123 » # unset gdb_spawn_id here to avoid sending command 'quit' to GDB |
| 124 » # later in default_gdb_exit. |
| 125 » unset gdb_spawn_id |
| 61 } | 126 } |
| 62 }} | 127 }} |
| 63 | 128 |
| 64 proc strace_probe_marker { } { with_test_prefix "probe_marker" { | 129 proc strace_info_marker { } { |
| 65 global executable | 130 with_test_prefix "info_marker" { |
| 66 global expect_out | 131 » global executable |
| 67 global gdb_prompt | 132 » global gdb_prompt |
| 68 global hex | 133 » global libipa |
| 69 | 134 |
| 70 # Restart with a fresh gdb. | 135 » # Restart with a fresh gdb. |
| 71 clean_restart $executable | 136 » clean_restart $executable |
| 72 if ![runto_main] { | 137 » gdb_load_shlibs $libipa |
| 73 » fail "Can't run to main" | 138 » if ![runto_main] { |
| 74 » return -1 | 139 » fail "Can't run to main" |
| 75 } | 140 » return -1 |
| 76 | 141 » } |
| 77 gdb_test "strace -m ust/bar" "Static tracepoint \[0-9\]+ at ${hex}: file.*" | 142 |
| 78 gdb_test "strace -m ust/bar2" "Static tracepoint \[0-9\]+ at ${hex}: file.*" | 143 » # List the markers in program. They should be disabled. |
| 79 # Two trace markers should be enabled. | 144 » gdb_test "info static-tracepoint-markers" \ |
| 80 gdb_test "info static-tracepoint-markers" \ | 145 » ".*ust/bar\[\t \]+n\[\t \]+.*ust/bar2\[\t \]+n\[\t \]+.*" |
| 81 » "ust/bar\[\t \]+y\[\t \]+$hex .*ust/bar2\[\t \]+y\[\t \]+$hex.*" | 146 |
| 82 | 147 » # List all the thread. It is expected to get three threads without |
| 83 gdb_test "break end" "Breakpoint \[0-9\]+ at.*" | 148 » # any errors. |
| 84 | 149 » gdb_test_multiple "info threads 3 2 1" "info threads" { |
| 85 gdb_test_no_output "tstart" | 150 » -re "3\[ \t\]+Thread .*2\[ \t\]+Thread .*1\[ \t\]+Thread .*${gdb_pro
mpt} $" { |
| 86 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end" | 151 » » pass "info threads" |
| 87 gdb_test_no_output "tstop" | 152 » } |
| 88 | 153 » } |
| 89 gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0" | 154 |
| 90 gdb_test "tfind" "Found trace frame 1, tracepoint .*" "tfind frame 1" | 155 » # GDB detaches inferior so that the socket file can be removed. |
| 91 gdb_test "tfind" "Target failed to find requested trace frame\\..*" | 156 » gdb_test_multiple "detach" "detach" { |
| 92 }} | 157 » -re "Detaching .*, process .*${gdb_prompt} $" { |
| 93 | 158 » » pass "detach" |
| 94 proc strace_trace_on_same_addr { type } { | 159 » } |
| 95 with_test_prefix "trace_same_addr $type" { | 160 » } |
| 96 global executable | 161 } |
| 97 global expect_out | 162 } |
| 98 global gdb_prompt | 163 |
| 99 global hex | 164 proc strace_probe_marker { } { |
| 100 | 165 with_test_prefix "probe_marker" { |
| 101 # Restart with a fresh gdb. | 166 » global executable |
| 102 clean_restart $executable | 167 » global expect_out |
| 103 if ![runto_main] { | 168 » global gdb_prompt |
| 104 » fail "Can't run to main" | 169 » global hex |
| 105 » return -1 | 170 » global libipa |
| 106 } | 171 |
| 107 | 172 » # Restart with a fresh gdb. |
| 108 set marker_bar_addr "" | 173 » clean_restart $executable |
| 109 set marker_bar2_addr "" | 174 » gdb_load_shlibs $libipa |
| 110 | 175 » if ![runto_main] { |
| 111 # List the markers in program. They should be disabled. | 176 » fail "Can't run to main" |
| 112 gdb_test_multiple "info static-tracepoint-markers" "info static-tracepoint-m
arkers 1" { | 177 » return -1 |
| 113 » -re ".*ust/bar\[\t \]+n.*${gdb_prompt} $" { | 178 » } |
| 114 » set ignore "" | 179 |
| 115 | 180 » gdb_test "strace -m ust/bar" \ |
| 116 » regexp "ust/bar\[\t \]+n\[\t \]+($hex) .*ust/bar2\[\t \]+n\[\t \]+($
hex) " \ | 181 » "Static tracepoint \[0-9\]+ at ${hex}: file.*" |
| 117 » » "$expect_out(0,string)" ignore marker_bar_addr marker_bar2_addr | 182 » gdb_test "strace -m ust/bar2" \ |
| 118 | 183 » "Static tracepoint \[0-9\]+ at ${hex}: file.*" |
| 119 » pass "info static-tracepoint-markers 1" | 184 » # Two trace markers should be enabled. |
| 120 » } | 185 » gdb_test "info static-tracepoint-markers" \ |
| 121 » -re ".*${gdb_prompt} $" { | 186 » "ust/bar\[\t \]+y\[\t \]+$hex .*ust/bar2\[\t \]+y\[\t \]+$hex.*" |
| 122 » fail "info static-tracepoint-markers 1" | 187 |
| 123 » } | 188 » gdb_test "break end" "Breakpoint \[0-9\]+ at.*" |
| 124 } | |
| 125 | |
| 126 gdb_test "strace -m ust/bar" "Static tracepoint \[0-9\]+ at ${hex}: file.*" | |
| 127 gdb_test "strace -m ust/bar2" "Static tracepoint \[0-9\]+ at ${hex}: file.*" | |
| 128 # Two trace markers should be enabled. | |
| 129 gdb_test "info static-tracepoint-markers" \ | |
| 130 » "ust/bar\[\t \]+y\[\t \]+$hex .*ust/bar2\[\t \]+y\[\t \]+$hex.*" \ | |
| 131 » "info static-tracepoint-markers 2" | |
| 132 | |
| 133 # Set breapoints or tracepoints. | |
| 134 set test "${type} on marker bar" | |
| 135 gdb_test_multiple "${type} *${marker_bar_addr}" $test { | |
| 136 » -re "\(Fast trace|Trace|Break\)point \[0-9\]+ at ${hex}: file.*\r\n$gdb_
prompt $" { | |
| 137 » pass $test | |
| 138 » } | |
| 139 » -re ".*\r\n$gdb_prompt $" { | |
| 140 » if [string equal $type "ftrace"] { | |
| 141 » » # The instruction may be not long enough to set a fast | |
| 142 » » # tracepoint. Skip the rest of this test. | |
| 143 » » return -1; | |
| 144 » } else { | |
| 145 » » fail $test | |
| 146 » } | |
| 147 » } | |
| 148 } | |
| 149 set test "${type} on marker bar2" | |
| 150 gdb_test_multiple "${type} *${marker_bar2_addr}" $test { | |
| 151 » -re "\(Fast trace|Trace|Break\)point \[0-9\]+ at ${hex}: file.*" { | |
| 152 » pass $test | |
| 153 » } | |
| 154 » -re ".*\r\n$gdb_prompt $" { | |
| 155 » if [string equal $type "ftrace"] { | |
| 156 » » # The instruction may be not long enough to set a fast | |
| 157 » » # tracepoint. Skip the rest of this test. | |
| 158 » » return -1; | |
| 159 » } else { | |
| 160 » » fail $test | |
| 161 » } | |
| 162 » } | |
| 163 } | |
| 164 | |
| 165 gdb_test "break end" "Breakpoint \[0-9\]+ at.*" | |
| 166 | |
| 167 if [string equal $type "break"] { | |
| 168 » gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \ | |
| 169 » "continue to bar" | |
| 170 » gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \ | |
| 171 » "continue to bar2" | |
| 172 » gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \ | |
| 173 » "continue to end" | |
| 174 } else { | |
| 175 | 189 |
| 176 gdb_test_no_output "tstart" | 190 gdb_test_no_output "tstart" |
| 177 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \ | 191 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \ |
| 178 "continue to end" | 192 "continue to end" |
| 179 gdb_test_no_output "tstop" | 193 gdb_test_no_output "tstop" |
| 180 | 194 |
| 181 » gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0" | 195 » gdb_test "tfind" "Found trace frame 0, tracepoint .*" \ |
| 182 » gdb_test "tfind" "Found trace frame 1, tracepoint .*" "tfind frame 1" | 196 » "tfind frame 0" |
| 183 » gdb_test "tfind" "Found trace frame 2, tracepoint .*" "tfind frame 2" | 197 » gdb_test "tfind" "Found trace frame 1, tracepoint .*" \ |
| 184 » gdb_test "tfind" "Found trace frame 3, tracepoint .*" "tfind frame 3" | 198 » "tfind frame 1" |
| 185 » gdb_test "tfind" "Target failed to find requested trace frame\\..*" | 199 » gdb_test "tfind" \ |
| 186 } | 200 » "Target failed to find requested trace frame\\..*" |
| 187 }} | 201 } |
| 188 | 202 } |
| 189 proc strace_trace_on_diff_addr { } { with_test_prefix "trace_diff_addr" { | 203 |
| 190 | 204 proc strace_trace_on_same_addr { type } { |
| 191 global executable | 205 with_test_prefix "trace_same_addr $type" { |
| 192 global expect_out | 206 » global executable |
| 193 global gdb_prompt | 207 » global expect_out |
| 194 global hex | 208 » global gdb_prompt |
| 195 | 209 » global hex |
| 196 # Restart with a fresh gdb. | 210 » global libipa |
| 197 clean_restart $executable | 211 |
| 198 if ![runto_main] { | 212 » # Restart with a fresh gdb. |
| 199 » fail "Can't run to main" | 213 » clean_restart $executable |
| 200 » return -1 | 214 » gdb_load_shlibs $libipa |
| 201 } | 215 » if ![runto_main] { |
| 202 | 216 » fail "Can't run to main" |
| 203 set marker_bar_addr "" | 217 » return -1 |
| 204 set marker_bar2_addr "" | 218 » } |
| 205 | 219 |
| 206 # List the markers in program. They should be disabled. | 220 » set marker_bar_addr "" |
| 207 gdb_test_multiple "info static-tracepoint-markers" "info static-tracepoint-m
arkers 1" { | 221 » set marker_bar2_addr "" |
| 208 » -re ".*ust/bar\[\t \]+n.*${gdb_prompt} $" { | 222 |
| 209 » set ignore "" | 223 » # List the markers in program. They should be disabled. |
| 210 | 224 » gdb_test_multiple "info static-tracepoint-markers" "info static-tracepoi
nt-markers 1" { |
| 211 » regexp "ust/bar\[\t \]+n\[\t \]+($hex) .*ust/bar2\[\t \]+n\[\t \]+($
hex) " \ | 225 » -re ".*ust/bar\[\t \]+n.*${gdb_prompt} $" { |
| 212 » » "$expect_out(0,string)" ignore marker_bar_addr marker_bar2_addr | 226 » » set ignore "" |
| 213 | 227 |
| 214 » pass "info static-tracepoint-markers 1" | 228 » » regexp "ust/bar\[\t \]+n\[\t \]+($hex) .*ust/bar2\[\t \]+n\[\t \
]+($hex) " \ |
| 215 » } | 229 » » "$expect_out(0,string)" ignore marker_bar_addr marker_bar2_a
ddr |
| 216 » -re ".*${gdb_prompt} $" { | 230 |
| 217 » fail "info static-tracepoint-markers 1" | 231 » » pass "info static-tracepoint-markers 1" |
| 218 » } | 232 » } |
| 219 } | 233 » -re ".*${gdb_prompt} $" { |
| 220 | 234 » » fail "info static-tracepoint-markers 1" |
| 221 gdb_test "strace -m ust/bar" "Static tracepoint \[0-9\]+ at ${hex}: file.*" | 235 » } |
| 222 | 236 » } |
| 223 gdb_test "info static-tracepoint-markers" \ | 237 |
| 224 » "ust/bar\[\t \]+y\[\t \]+$hex .*ust/bar2\[\t \]+n\[\t \]+$hex.*" \ | 238 » gdb_test "strace -m ust/bar" "Static tracepoint \[0-9\]+ at ${hex}: file
.*" |
| 225 » "info static-tracepoint-markers 2" | 239 » gdb_test "strace -m ust/bar2" "Static tracepoint \[0-9\]+ at ${hex}: fil
e.*" |
| 226 | 240 » # Two trace markers should be enabled. |
| 227 | 241 » gdb_test "info static-tracepoint-markers" \ |
| 228 # Set common tracepoint. | 242 » "ust/bar\[\t \]+y\[\t \]+$hex .*ust/bar2\[\t \]+y\[\t \]+$hex.*" \ |
| 229 gdb_test "trace *${marker_bar2_addr}" \ | 243 » "info static-tracepoint-markers 2" |
| 230 » "Tracepoint \[0-9\]+ at ${hex}: file.*" | 244 |
| 231 | 245 » # Set breapoints or tracepoints. |
| 232 gdb_test "break end" "Breakpoint \[0-9\]+ at.*" | 246 » set test "${type} on marker bar" |
| 233 | 247 » gdb_test_multiple "${type} *${marker_bar_addr}" $test { |
| 234 gdb_test_no_output "tstart" | 248 » -re "\(Fast trace|Trace|Break\)point \[0-9\]+ at ${hex}: file.*\r\n$
gdb_prompt $" { |
| 235 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end" | 249 » » pass $test |
| 236 gdb_test_no_output "tstop" | 250 » } |
| 237 | 251 » -re ".*\r\n$gdb_prompt $" { |
| 238 gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0" | 252 » » if [string equal $type "ftrace"] { |
| 239 gdb_test "tfind" "Found trace frame 1, tracepoint .*" "tfind frame 1" | 253 » » # The instruction may be not long enough to set a fast |
| 240 gdb_test "tfind" "Target failed to find requested trace frame\\..*" | 254 » » # tracepoint. Skip the rest of this test. |
| 241 }} | 255 » » return -1 |
| 256 » » } else { |
| 257 » » fail $test |
| 258 » » } |
| 259 » } |
| 260 » } |
| 261 » set test "${type} on marker bar2" |
| 262 » gdb_test_multiple "${type} *${marker_bar2_addr}" $test { |
| 263 » -re "\(Fast trace|Trace|Break\)point \[0-9\]+ at ${hex}: file.*" { |
| 264 » » pass $test |
| 265 » } |
| 266 » -re ".*\r\n$gdb_prompt $" { |
| 267 » » if [string equal $type "ftrace"] { |
| 268 » » # The instruction may be not long enough to set a fast |
| 269 » » # tracepoint. Skip the rest of this test. |
| 270 » » return -1 |
| 271 » » } else { |
| 272 » » fail $test |
| 273 » » } |
| 274 » } |
| 275 » } |
| 276 |
| 277 » gdb_test "break end" "Breakpoint \[0-9\]+ at.*" |
| 278 |
| 279 » if [string equal $type "break"] { |
| 280 » gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \ |
| 281 » » "continue to bar" |
| 282 » gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \ |
| 283 » » "continue to bar2" |
| 284 » gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \ |
| 285 » » "continue to end" |
| 286 » } else { |
| 287 |
| 288 » gdb_test_no_output "tstart" |
| 289 » gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \ |
| 290 » » "continue to end" |
| 291 » gdb_test_no_output "tstop" |
| 292 |
| 293 » gdb_test "tfind" "Found trace frame 0, tracepoint .*" \ |
| 294 » » "tfind frame 0" |
| 295 » gdb_test "tfind" "Found trace frame 1, tracepoint .*" \ |
| 296 » » "tfind frame 1" |
| 297 » gdb_test "tfind" "Found trace frame 2, tracepoint .*" \ |
| 298 » » "tfind frame 2" |
| 299 » gdb_test "tfind" "Found trace frame 3, tracepoint .*" \ |
| 300 » » "tfind frame 3" |
| 301 » gdb_test "tfind" \ |
| 302 » » "Target failed to find requested trace frame\\..*" |
| 303 » } |
| 304 } |
| 305 } |
| 306 |
| 307 proc strace_trace_on_diff_addr { } { |
| 308 with_test_prefix "trace_diff_addr" { |
| 309 |
| 310 » global executable |
| 311 » global expect_out |
| 312 » global gdb_prompt |
| 313 » global hex |
| 314 » global libipa |
| 315 |
| 316 » # Restart with a fresh gdb. |
| 317 » clean_restart $executable |
| 318 » gdb_load_shlibs $libipa |
| 319 » if ![runto_main] { |
| 320 » fail "Can't run to main" |
| 321 » return -1 |
| 322 » } |
| 323 |
| 324 » set marker_bar_addr "" |
| 325 » set marker_bar2_addr "" |
| 326 |
| 327 » # List the markers in program. They should be disabled. |
| 328 » gdb_test_multiple "info static-tracepoint-markers" "info static-tracepoi
nt-markers 1" { |
| 329 » -re ".*ust/bar\[\t \]+n.*${gdb_prompt} $" { |
| 330 » » set ignore "" |
| 331 |
| 332 » » regexp "ust/bar\[\t \]+n\[\t \]+($hex) .*ust/bar2\[\t \]+n\[\t \
]+($hex) " \ |
| 333 » » "$expect_out(0,string)" ignore marker_bar_addr marker_bar2_a
ddr |
| 334 |
| 335 » » pass "info static-tracepoint-markers 1" |
| 336 » } |
| 337 » -re ".*${gdb_prompt} $" { |
| 338 » » fail "info static-tracepoint-markers 1" |
| 339 » } |
| 340 » } |
| 341 |
| 342 » gdb_test "strace -m ust/bar" "Static tracepoint \[0-9\]+ at ${hex}: file
.*" |
| 343 |
| 344 » gdb_test "info static-tracepoint-markers" \ |
| 345 » "ust/bar\[\t \]+y\[\t \]+$hex .*ust/bar2\[\t \]+n\[\t \]+$hex.*" \ |
| 346 » "info static-tracepoint-markers 2" |
| 347 |
| 348 |
| 349 » # Set common tracepoint. |
| 350 » gdb_test "trace *${marker_bar2_addr}" \ |
| 351 » "Tracepoint \[0-9\]+ at ${hex}: file.*" |
| 352 |
| 353 » gdb_test "break end" "Breakpoint \[0-9\]+ at.*" |
| 354 |
| 355 » gdb_test_no_output "tstart" |
| 356 » gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \ |
| 357 » "continue to end" |
| 358 » gdb_test_no_output "tstop" |
| 359 |
| 360 » gdb_test "tfind" "Found trace frame 0, tracepoint .*" \ |
| 361 » "tfind frame 0" |
| 362 » gdb_test "tfind" "Found trace frame 1, tracepoint .*" \ |
| 363 » "tfind frame 1" |
| 364 » gdb_test "tfind" \ |
| 365 » "Target failed to find requested trace frame\\..*" |
| 366 } |
| 367 } |
| 368 |
| 369 # Run it on x86/x86_64 linux. |
| 370 if { [istarget "x86_64-*-linux*"] || [istarget "i\[34567\]86-*-linux*"] } { |
| 371 strace_info_marker |
| 372 strace_remove_socket "quit" |
| 373 strace_remove_socket "detach" |
| 374 strace_remove_socket "continue" |
| 375 } |
| 242 | 376 |
| 243 clean_restart $executable | 377 clean_restart $executable |
| 244 | 378 gdb_load_shlibs $libipa |
| 245 if ![runto_main] { | 379 if ![runto_main] { |
| 246 fail "Can't run to main to check for trace support" | 380 fail "Can't run to main to check for trace support" |
| 247 return -1 | 381 return -1 |
| 248 } | 382 } |
| 249 | |
| 250 # Run it on native x86/x86_64 linux. | |
| 251 if { ![is_remote target] | |
| 252 && ([istarget "x86_64-*-linux*"] || [istarget "i\[34567\]86-*-linux*"]) } { | |
| 253 strace_info_marker | |
| 254 return | |
| 255 } | |
| 256 | |
| 257 if { ![gdb_target_supports_trace] } then { | 383 if { ![gdb_target_supports_trace] } then { |
| 384 # At this point, the socket file has been created. We must make sure it is |
| 385 # removed when we return here. GDB detaches inferior so that the socket |
| 386 # file can be removed. Note that GDB simply kill inferior doesn't remove |
| 387 # the socket file. |
| 388 gdb_test "detach" "Detaching .*, process .*" |
| 258 unsupported "Current target does not support trace" | 389 unsupported "Current target does not support trace" |
| 259 return -1; | 390 return -1 |
| 260 } | 391 } |
| 261 | 392 |
| 262 gdb_load_shlibs $libipa | |
| 263 | |
| 264 strace_info_marker | |
| 265 strace_probe_marker | 393 strace_probe_marker |
| 266 | 394 |
| 267 strace_trace_on_same_addr "trace" | 395 strace_trace_on_same_addr "trace" |
| 268 strace_trace_on_same_addr "ftrace" | 396 strace_trace_on_same_addr "ftrace" |
| 269 strace_trace_on_same_addr "break" | 397 strace_trace_on_same_addr "break" |
| 270 strace_trace_on_diff_addr | 398 strace_trace_on_diff_addr |
| OLD | NEW |