]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.trace/tspeed.exp
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.trace / tspeed.exp
1 # Copyright 2011-2013 Free Software Foundation, Inc.
2
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
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
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/>.
15
16 load_lib "trace-support.exp"
17
18 standard_testfile
19 set executable $testfile
20
21 set ipalib [get_in_proc_agent]
22
23 if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
24 executable [concat {debug nowarnings c} libs=$ipalib]] != "" } {
25 untested tspeed.exp
26 return -1
27 }
28
29 # Typically we need a little extra time for this test.
30 set timeout 180
31
32 set ws "\[\r\n\t \]+"
33 set cr "\[\r\n\]+"
34
35 #
36 # Utility procs
37 #
38
39 proc prepare_for_trace_test {} {
40 global executable
41
42 clean_restart $executable
43
44 runto_main
45
46 set testline [gdb_get_line_number "set pre-run breakpoint here"]
47
48 gdb_test "break $testline" ".*" ""
49
50 set testline [gdb_get_line_number "set post-run breakpoint here"]
51
52 gdb_test "break $testline" ".*" ""
53 }
54
55 proc run_trace_experiment {} {
56
57 gdb_test "continue" \
58 ".*Breakpoint \[0-9\]+, main .*" \
59 "advance to trace begin"
60
61 gdb_test_no_output "tstart" "start trace experiment"
62
63 gdb_test "continue" \
64 ".*Breakpoint \[0-9\]+, main .*" \
65 "advance through tracing"
66
67 gdb_test "tstatus" ".*Trace .*" "check on trace status"
68
69 gdb_test "tstop" "" ""
70 }
71
72 proc gdb_slow_trace_speed_test { } {
73
74 gdb_delete_tracepoints
75
76 gdb_test "print iters = init_iters" ".* = .*";
77
78 set testline [gdb_get_line_number "set tracepoint here"]
79
80 gdb_test "trace $testline if (globfoo != 12 && globfoo2 == 45)" \
81 "Tracepoint \[0-9\]+ at .*" \
82 "set slow tracepoint"
83
84 # Begin the test.
85 run_trace_experiment
86 }
87
88 proc gdb_fast_trace_speed_test { } {
89 global gdb_prompt
90
91 gdb_delete_tracepoints
92
93 gdb_test "print iters = init_iters" ".* = .*";
94
95 set run_ftrace 0
96
97 set testline [gdb_get_line_number "set tracepoint here"]
98
99 gdb_test_multiple "ftrace $testline if (globfoo != 12 && globfoo2 == 45)" \
100 "set conditional fast tracepoint" {
101 -re "Fast tracepoint \[0-9\]+ at .*\r\n$gdb_prompt $" {
102 pass "set conditional fast tracepoint, done"
103 set run_ftrace 1
104 }
105 -re "May not have a fast tracepoint at .*\r\n$gdb_prompt $" {
106 pass "set conditional fast tracepoint, not allowed at line"
107 }
108 }
109
110 # If the fast tracepoint couldn't be set, don't bother with the run.
111 if { $run_ftrace == 1 } then {
112
113 # Begin the test.
114 run_trace_experiment
115 }
116 }
117
118 proc gdb_trace_collection_test {} {
119
120 prepare_for_trace_test
121
122 gdb_slow_trace_speed_test
123
124 gdb_fast_trace_speed_test
125 }
126
127 clean_restart $executable
128 runto_main
129
130 if { ![gdb_target_supports_trace] } then {
131 unsupported "Current target does not support trace"
132 return 1;
133 }
134
135 # Body of test encased in a proc so we can return prematurely.
136 gdb_trace_collection_test