Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: gdb/testsuite/gdb.trace/actions.exp

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/testsuite/gdb.trace/actions.c ('k') | gdb/testsuite/gdb.trace/actions-changed.exp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 1998, 2007-2012 Free Software Foundation, Inc. 1 # Copyright 1998-2013 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 # This file was written by Michael Snyder (msnyder@cygnus.com) 16 # This file was written by Michael Snyder (msnyder@cygnus.com)
17 17
18 load_lib "trace-support.exp"; 18 load_lib "trace-support.exp"
19 19
20 20
21 gdb_exit 21 gdb_exit
22 gdb_start 22 gdb_start
23 23
24 standard_testfile 24 standard_testfile
25 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ 25 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
26 executable {debug nowarnings}] != "" } { 26 executable {debug nowarnings}] != "" } {
27 untested actions.exp 27 untested actions.exp
28 return -1 28 return -1
29 } 29 }
30 gdb_reinitialize_dir $srcdir/$subdir 30 gdb_reinitialize_dir $srcdir/$subdir
31 31
32 # If testing on a remote host, download the source file. 32 # If testing on a remote host, download the source file.
33 # remote_download host $srcdir/$subdir/$srcfile 33 # remote_download host $srcdir/$subdir/$srcfile
34 34
35 gdb_file_cmd $binfile 35 gdb_file_cmd $binfile
36 36
37 # define relative source line numbers: 37 # define relative source line numbers:
38 # all subsequent line numbers are relative to this first one (baseline) 38 # all subsequent line numbers are relative to this first one (baseline)
39 39
40 set baseline [gdb_find_recursion_test_baseline $srcfile]; 40 set baseline [gdb_find_recursion_test_baseline $srcfile]
41 if { $baseline == -1 } then { 41 if { $baseline == -1 } then {
42 fail "Could not find gdb_recursion_test function" 42 fail "Could not find gdb_recursion_test function"
43 return; 43 return
44 } 44 }
45 45
46 set testline1 [expr $baseline + 7] 46 set testline1 [expr $baseline + 7]
47 47
48 # 48 #
49 # test actions command 49 # test actions command
50 # 50 #
51 51
52 gdb_delete_tracepoints 52 gdb_delete_tracepoints
53 set trcpt1 [gdb_gettpnum gdb_c_test]; 53 set trcpt1 [gdb_gettpnum gdb_c_test]
54 set trcpt2 [gdb_gettpnum gdb_asm_test]; 54 set trcpt2 [gdb_gettpnum gdb_asm_test]
55 set trcpt3 [gdb_gettpnum $testline1]; 55 set trcpt3 [gdb_gettpnum $testline1]
56 if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then { 56 if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then {
57 fail "setting tracepoints" 57 fail "setting tracepoints"
58 return; 58 return
59 } 59 }
60 60
61 # 5.1 actions of specified tracepoint 61 # 5.1 actions of specified tracepoint
62 62
63 gdb_test_multiple "info tracepoints" "5.1a: set three tracepoints, no actions" { 63 gdb_test_multiple "info tracepoints" "5.1a: set three tracepoints, no actions" {
64 -re "Actions for tracepoint \[0-9\]+:.*$gdb_prompt $" { 64 -re "Actions for tracepoint \[0-9\]+:.*$gdb_prompt $" {
65 fail "5.1a: testsuite failure (tracepoint already has action)!" 65 fail "5.1a: testsuite failure (tracepoint already has action)!"
66 } 66 }
67 -re "No tracepoints.*$gdb_prompt $" { 67 -re "No tracepoints.*$gdb_prompt $" {
68 fail "5.1a: set three tracepoints, no actions (No tracepoints!)" 68 fail "5.1a: set three tracepoints, no actions (No tracepoints!)"
69 } 69 }
70 -re "$gdb_prompt $" { 70 -re "$gdb_prompt $" {
71 pass "5.1a: set three tracepoints, no actions" 71 pass "5.1a: set three tracepoints, no actions"
72 } 72 }
73 } 73 }
74 74
75 gdb_trace_setactions "5.1b: set actions for first tracepoint" \ 75 gdb_trace_setactions "5.1b: set actions for first tracepoint" \
76 "$trcpt1" \ 76 "$trcpt1" \
77 "collect gdb_char_test" "^$" 77 "collect gdb_char_test" "^$"
78 78
79 gdb_test "info tracepoints" \ 79 gdb_test "info tracepoints" \
80 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 80 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
81 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 81 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
82 \[\t \]+collect gdb_char_test. 82 \[\t \]+collect gdb_char_test.
83 \[\t \]+not installed on target.
83 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 84 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
84 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0- 9\]+" \ 85 \[\t \]+not installed on target.
86 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0- 9\]+.
87 \[\t \]+not installed on target." \
85 "5.1c: verify actions set for first tracepoint" 88 "5.1c: verify actions set for first tracepoint"
86 89
87 gdb_trace_setactions "5.1d: set actions for second tracepoint" \ 90 gdb_trace_setactions "5.1d: set actions for second tracepoint" \
88 "$trcpt2" \ 91 "$trcpt2" \
89 "collect gdb_short_test" "^$" 92 "collect gdb_short_test" "^$"
90 93
91 gdb_test "info tracepoints" \ 94 gdb_test "info tracepoints" \
92 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 95 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
93 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 96 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
94 \[\t \]+collect gdb_char_test. 97 \[\t \]+collect gdb_char_test.
98 \[\t \]+not installed on target.
95 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 99 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
96 \[\t \]+collect gdb_short_test. 100 \[\t \]+collect gdb_short_test.
97 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0- 9\]+" \ 101 \[\t \]+not installed on target.
102 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0- 9\]+.
103 \[\t \]+not installed on target." \
98 "5.1e: verify actions set for second tracepoint" 104 "5.1e: verify actions set for second tracepoint"
99 105
100 gdb_trace_setactions "5.2a: set actions for last (default) tracepoint" \ 106 gdb_trace_setactions "5.2a: set actions for last (default) tracepoint" \
101 "" \ 107 "" \
102 "collect gdb_long_test" "^$" 108 "collect gdb_long_test" "^$"
103 109
104 gdb_test "info tracepoints" \ 110 gdb_test "info tracepoints" \
105 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 111 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
106 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 112 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
107 \[\t \]+collect gdb_char_test. 113 \[\t \]+collect gdb_char_test.
114 \[\t \]+not installed on target.
108 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 115 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
109 \[\t \]+collect gdb_short_test. 116 \[\t \]+collect gdb_short_test.
117 \[\t \]+not installed on target.
110 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0- 9\]+. 118 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0- 9\]+.
111 \[\t \]+collect gdb_long_test." \ 119 \[\t \]+collect gdb_long_test.
112 » » "5.1e: verify actions set for second tracepoint" 120 \[\t \]+not installed on target." \
121 » » "5.2b: verify actions set for second tracepoint"
113 122
114 # 5.3 replace actions set earlier 123 # 5.3 replace actions set earlier
115 124
116 gdb_trace_setactions "5.3a: reset actions for first tracepoint" \ 125 gdb_trace_setactions "5.3a: reset actions for first tracepoint" \
117 "$trcpt1" \ 126 "$trcpt1" \
118 "collect gdb_struct1_test" "^$" 127 "collect gdb_struct1_test" "^$"
119 128
120 gdb_test "info tracepoints" \ 129 gdb_test "info tracepoints" \
121 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 130 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
122 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 131 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
123 \[\t \]+collect gdb_struct1_test. 132 \[\t \]+collect gdb_struct1_test.
133 \[\t \]+not installed on target.
124 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 134 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
125 \[\t \]+collect gdb_short_test. 135 \[\t \]+collect gdb_short_test.
136 \[\t \]+not installed on target.
126 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0- 9\]+. 137 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0- 9\]+.
127 \[\t \]+collect gdb_long_test." \ 138 \[\t \]+collect gdb_long_test.
139 \[\t \]+not installed on target." \
128 "5.3b: verify actions set for first tracepoint" 140 "5.3b: verify actions set for first tracepoint"
129 141
130 # 142 #
131 # test end command (all by itself) 143 # test end command (all by itself)
132 # 144 #
133 145
134 # 5.4 end outside of context 146 # 5.4 end outside of context
135 147
136 gdb_test "end" "This command cannot be used at the top level." \ 148 gdb_test "end" "This command cannot be used at the top level." \
137 "5.4: 'end' command out of context" 149 "5.4: 'end' command out of context"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 "teval gdb_char_test" "^$" 219 "teval gdb_char_test" "^$"
208 220
209 gdb_trace_setactions "5.10a: set teval action for second tracepoint" \ 221 gdb_trace_setactions "5.10a: set teval action for second tracepoint" \
210 "$trcpt2" \ 222 "$trcpt2" \
211 "teval \$tsv += 1" "^$" 223 "teval \$tsv += 1" "^$"
212 224
213 gdb_test "info tracepoints" \ 225 gdb_test "info tracepoints" \
214 "Num Type\[ \]+Disp Enb Address\[ \]+What.* 226 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
215 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+. 227 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .*$srcfile:\[0-9\]+.
216 \[\t \]+teval gdb_char_test. 228 \[\t \]+teval gdb_char_test.
229 \[\t \]+not installed on target.
217 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+. 230 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+.
218 \[\t \]+teval \\\$tsv \\\+= 1. 231 \[\t \]+teval \\\$tsv \\\+= 1.
232 \[\t \]+not installed on target.
219 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0- 9\]+. 233 \[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_test at .*$srcfile:\[0- 9\]+.
220 \[\t \]+collect gdb_long_test." \ 234 \[\t \]+collect gdb_long_test.
235 \[\t \]+not installed on target." \
221 "5.10a: verify teval actions set for two tracepoints" 236 "5.10a: verify teval actions set for two tracepoints"
222 237
238 gdb_test "break main"
239 gdb_run_cmd
240 gdb_test "" "Breakpoint .*"
241 if ![gdb_target_supports_trace] {
242 unsupported "target does not support trace"
243 return -1
244 }
245
246 gdb_trace_setactions "set actions for first tracepoint" \
247 "$trcpt1" \
248 "collect \$regs" "^$" \
249 "end" ""
250
251 # Check the definition of tracepoints. These tracepoints may have
252 # different number in different runs.
253
254 proc check_tracepoint { data_source } {
255 with_test_prefix "$data_source" {
256 global gdb_prompt
257 global srcfile
258
259 set tp_on_gdb_c_test 0
260 set tp_on_gdb_asm_test 0
261 set tp_on_gdb_recursion_test 0
262
263 # Since the three tracepoints may appear in different orders, so
264 # we can't do 'info tracepoints' to match the output. Instead, we
265 # show each tracepoint one by one and record the number of each
266 # tracepoint shown up the output. Check the number finally.
267 for {set i 1} {$i < 4} {incr i 1} {
268 set test "info tracepoints $i"
269 gdb_test_multiple "info tracepoints $i" $test {
270 -re "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_c_test at .* $srcfile:\[0-9\]+\\r\\n\[\t \]+collect \\\$regs\\r\\n\[\t \]+installed on target " {
271 incr tp_on_gdb_c_test
272 exp_continue
273 }
274 -re "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_asm_test at .*$srcfile:\[0-9\]+\\r\\n\[\t \]+teval \\\$tsv \\+= 1\\r\\n\[\t \]+installed on target" {
275 incr tp_on_gdb_asm_test
276 exp_continue
277 }
278 -re "\[0-9\]+\[\t \]+tracepoint keep y.* in gdb_recursion_te st at .*$srcfile:\[0-9\]+\\r\\n\[\t \]+collect gdb_long_test\\r\\n\[\t \]+instal led on target" {
279 incr tp_on_gdb_recursion_test
280 exp_continue
281 }
282 -re "${gdb_prompt} $" {
283 }
284 }
285 }
286
287 if {$tp_on_gdb_c_test == 1} {
288 pass "tracepoint on gdb_c_test"
289 } else {
290 fail "tracepoint on gdb_c_test"
291 }
292 if {$tp_on_gdb_asm_test == 1} {
293 pass "tracepoint on gdb_asm_test"
294 } else {
295 fail "tracepoint on gdb_asm_test"
296 }
297 if {$tp_on_gdb_recursion_test == 1} {
298 pass "tracepoint on gdb_recursion_test"
299 } else {
300 fail "tracepoint on gdb_recursion_test $tp_on_gdb_recursion_test"
301 }
302 }
303 }
304
305 # Start and stop the tracing, so that we can save tracepoints
306 # definitions to trace file.
307 gdb_test_no_output "tstart" ""
308 check_tracepoint "live"
309 gdb_test_no_output "tstop" ""
310 set tracefile [standard_output_file ${testfile}]
311 gdb_test "tsave ${tracefile}.tf" \
312 "Trace data saved to file '${tracefile}.tf'\.\\r" \
313 "tsave ${testfile}.tf"
314 gdb_test "tsave -ctf ${tracefile}.ctf" \
315 "Trace data saved to directory '${tracefile}.ctf'\.\\r" \
316 "save ctf trace file"
317
318 # Restart GDB and read the trace data in tfile target.
319 gdb_exit
320 gdb_start
321 gdb_reinitialize_dir $srcdir/$subdir
322 gdb_file_cmd $binfile
323 gdb_test "target tfile ${tracefile}.tf" ".*" \
324 "change to tfile target"
325 check_tracepoint "tfile"
326
327 # Try to read ctf data if GDB supports.
328 set gdb_can_read_ctf_data 0
329 gdb_test_multiple "target ctf" "" {
330 -re "Undefined target command: \"ctf\"\. Try \"help target\"\.\r\n$gdb_prom pt $" {
331 set gdb_can_read_ctf_data 0
332 }
333 -re "No CTF directory specified.*\r\n$gdb_prompt $" {
334 set gdb_can_read_ctf_data 1
335 }
336 }
337
338 if { $gdb_can_read_ctf_data } {
339 gdb_exit
340 gdb_start
341 gdb_reinitialize_dir $srcdir/$subdir
342 gdb_file_cmd $binfile
343 gdb_test "target ctf ${tracefile}.ctf" ".*" \
344 "change to ctf target"
345 check_tracepoint "ctf"
346 }
OLDNEW
« no previous file with comments | « gdb/testsuite/gdb.trace/actions.c ('k') | gdb/testsuite/gdb.trace/actions-changed.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698