OLD | NEW |
1 # Copyright 1998, 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 1998, 2007-2012 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 3 # This program is free software; you can redistribute it and/or modify |
4 # it under the terms of the GNU General Public License as published by | 4 # it under the terms of the GNU General Public License as published by |
5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
14 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 load_lib "trace-support.exp" | 16 load_lib "trace-support.exp" |
17 | 17 |
18 if $tracelevel then { | |
19 strace $tracelevel | |
20 } | |
21 | 18 |
| 19 standard_testfile |
22 | 20 |
23 set testfile "circ" | 21 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug nowarnings}]} { |
24 set srcfile ${testfile}.c | |
25 set binfile $objdir/$subdir/$testfile | |
26 | |
27 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ | |
28 » executable {debug nowarnings}] != "" } { | |
29 untested circ.exp | |
30 return -1 | 22 return -1 |
31 } | 23 } |
32 | 24 |
33 # Tests: | 25 # Tests: |
34 # 1) Set up a trace experiment that will collect approximately 10 frames, | 26 # 1) Set up a trace experiment that will collect approximately 10 frames, |
35 # requiring more than 512 but less than 1024 bytes of cache buffer. | 27 # requiring more than 512 but less than 1024 bytes of cache buffer. |
36 # (most targets should have at least 1024 bytes of cache buffer!) | 28 # (most targets should have at least 1024 bytes of cache buffer!) |
37 # Run and confirm that it collects all 10 frames. | 29 # Run and confirm that it collects all 10 frames. |
38 # 2) Artificially limit the trace buffer to 512 bytes, and rerun the | 30 # 2) Artificially limit the trace buffer to 512 bytes, and rerun the |
39 # experiment. Confirm that the first several frames are collected, | 31 # experiment. Confirm that the first several frames are collected, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 if [set_a_tracepoint func5] then { return 1; } | 77 if [set_a_tracepoint func5] then { return 1; } |
86 if [set_a_tracepoint func6] then { return 1; } | 78 if [set_a_tracepoint func6] then { return 1; } |
87 if [set_a_tracepoint func7] then { return 1; } | 79 if [set_a_tracepoint func7] then { return 1; } |
88 if [set_a_tracepoint func8] then { return 1; } | 80 if [set_a_tracepoint func8] then { return 1; } |
89 if [set_a_tracepoint func9] then { return 1; } | 81 if [set_a_tracepoint func9] then { return 1; } |
90 return 0; | 82 return 0; |
91 } | 83 } |
92 | 84 |
93 # return 0 for success, 1 for failure | 85 # return 0 for success, 1 for failure |
94 proc trace_buffer_normal { } { | 86 proc trace_buffer_normal { } { |
95 if [gdb_test "maint packet QTBuffer:size:ffffffff" \ | 87 global gdb_prompt |
96 » "received: .OK." ""] then { | 88 |
97 » pass "This test cannot be run on this target" | 89 set ok 0 |
| 90 set test "maint packet QTBuffer:size:ffffffff" |
| 91 gdb_test_multiple $test $test { |
| 92 » -re "received: .OK.\r\n$gdb_prompt $" { |
| 93 » set ok 1 |
| 94 » pass $test |
| 95 » } |
| 96 » -re "\r\n$gdb_prompt $" { |
| 97 » } |
| 98 } |
| 99 if { !$ok } { |
| 100 » unsupported $test |
98 return 1; | 101 return 1; |
99 } | 102 } |
100 if [gdb_test "maint packet QTBuffer:circular:0" \ | 103 |
101 » "received: .OK." ""] then { | 104 set ok 0 |
102 » pass "This test cannot be run on this target" | 105 set test "maint packet QTBuffer:circular:0" |
| 106 gdb_test_multiple $test $test { |
| 107 » -re "received: .OK.\r\n$gdb_prompt $" { |
| 108 » set ok 1 |
| 109 » pass $test |
| 110 » } |
| 111 » -re "\r\n$gdb_prompt $" { |
| 112 » } |
| 113 } |
| 114 if { !$ok } { |
| 115 » unsupported $test |
103 return 1; | 116 return 1; |
104 } | 117 } |
| 118 |
105 return 0; | 119 return 0; |
106 } | 120 } |
107 | 121 |
108 # return 0 for success, 1 for failure | 122 # return 0 for success, 1 for failure |
109 proc gdb_trace_circular_tests { } { | 123 proc gdb_trace_circular_tests { } { |
110 | |
111 # We generously give ourselves one "pass" if we successfully | |
112 # detect that this test cannot be run on this target! | |
113 if { ![gdb_target_supports_trace] } then { | 124 if { ![gdb_target_supports_trace] } then { |
114 » pass "Current target does not support trace" | 125 » unsupported "Current target does not support trace" |
115 return 1; | 126 return 1; |
116 } | 127 } |
117 | 128 |
118 if [trace_buffer_normal] then { return 1; } | 129 if [trace_buffer_normal] then { return 1; } |
119 | 130 |
120 gdb_test "break begin" ".*" "" | 131 gdb_test "break begin" ".*" "" |
121 gdb_test "break end" ".*" "" | 132 gdb_test "break end" ".*" "" |
122 gdb_test "tstop" ".*" "" | 133 gdb_test "tstop" ".*" "" |
123 gdb_test "tfind none" ".*" "" | 134 gdb_test "tfind none" ".*" "" |
124 | 135 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 "#0 func9 .*" \ | 189 "#0 func9 .*" \ |
179 "find frame nine, pass 3"] then { return 1; } | 190 "find frame nine, pass 3"] then { return 1; } |
180 | 191 |
181 if [gdb_test "tfind none" \ | 192 if [gdb_test "tfind none" \ |
182 "#0 end .*" \ | 193 "#0 end .*" \ |
183 "quit trace debugging, pass 3"] then { return 1; } | 194 "quit trace debugging, pass 3"] then { return 1; } |
184 | 195 |
185 return 0; | 196 return 0; |
186 } | 197 } |
187 | 198 |
188 # Start with a fresh gdb. | |
189 | |
190 gdb_exit | |
191 gdb_start | |
192 gdb_reinitialize_dir $srcdir/$subdir | |
193 gdb_load $binfile | |
194 | |
195 if [target_info exists gdb_stub] { | |
196 gdb_step_for_stub; | |
197 } | |
198 | |
199 gdb_test_no_output "set circular-trace-buffer on" \ | 199 gdb_test_no_output "set circular-trace-buffer on" \ |
200 "set circular-trace-buffer on" | 200 "set circular-trace-buffer on" |
201 | 201 |
202 gdb_test "show circular-trace-buffer" "Target's use of circular trace buffer is
on." "show circular-trace-buffer (on)" | 202 gdb_test "show circular-trace-buffer" "Target's use of circular trace buffer is
on." "show circular-trace-buffer (on)" |
203 | 203 |
204 gdb_test_no_output "set circular-trace-buffer off" \ | 204 gdb_test_no_output "set circular-trace-buffer off" \ |
205 "set circular-trace-buffer off" | 205 "set circular-trace-buffer off" |
206 | 206 |
207 gdb_test "show circular-trace-buffer" "Target's use of circular trace buffer is
off." "show circular-trace-buffer (off)" | 207 gdb_test "show circular-trace-buffer" "Target's use of circular trace buffer is
off." "show circular-trace-buffer (off)" |
208 | 208 |
209 # Body of test encased in a proc so we can return prematurely. | 209 # Body of test encased in a proc so we can return prematurely. |
210 if { ![gdb_trace_circular_tests] } then { | 210 if { ![gdb_trace_circular_tests] } then { |
211 # Set trace buffer attributes back to normal | 211 # Set trace buffer attributes back to normal |
212 trace_buffer_normal; | 212 trace_buffer_normal; |
213 } | 213 } |
214 | 214 |
215 # Finished! | 215 # Finished! |
216 gdb_test "tfind none" ".*" "" | 216 gdb_test "tfind none" ".*" "" |
OLD | NEW |