]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.trace/tstatus.exp
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.trace / tstatus.exp
CommitLineData
8acc9f48 1# Copyright 2011-2013 Free Software Foundation, Inc.
f196051f
SS
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
4# the Free Software Foundation; either version 3 of the License, or
5# (at your option) any later version.
6#
7# This program is distributed in the hope that it will be useful,
8# but WITHOUT ANY WARRANTY; without even the implied warranty of
9# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10# GNU General Public License for more details.
11#
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/>.
14
15load_lib "trace-support.exp"
16
497a5eb0 17standard_testfile actions.c
f196051f 18set executable $testfile
f196051f
SS
19set expfile tstatus.exp
20
21if [prepare_for_testing $expfile $executable $srcfile \
22 [list debug]] {
23 untested "failed to prepare for trace tests"
24 return -1
25}
26
27if ![runto_main] {
28 fail "Can't run to main to check for trace support"
29 return -1
30}
31
32if ![gdb_target_supports_trace] {
33 unsupported "target does not support trace"
34 return -1
35}
36
c0d4d1c0 37set libipa [get_in_proc_agent]
f196051f
SS
38gdb_load_shlibs $libipa
39
40# Can't use prepare_for_testing, because that splits compiling into
41# building objects and then linking, and we'd fail with "linker input
42# file unused because linking not done" when building the object.
43
44if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
45 executable [list debug shlib=$libipa] ] != "" } {
46 untested "failed to compile ftrace tests"
47 return -1
48}
49clean_restart ${executable}
50
51if ![runto_main] {
52 fail "Can't run to main for ftrace tests"
53 return 0
54}
55
56proc run_trace_experiment {} {
968643aa 57 global gdb_prompt
f196051f
SS
58
59# gdb_test_no_output "set debug remote 1" ""
60
61 gdb_test "continue" \
62 ".*Breakpoint \[0-9\]+, begin .*" \
63 "advance to trace begin"
64
65 gdb_test_no_output "tstart my tracing note" "start trace experiment"
66
67 gdb_test "continue" \
68 ".*Breakpoint \[0-9\]+, end .*" \
69 "advance through tracing"
70
71 # Now play with tstatus a bit.
72 # Since note support is optional, we need to match both with and without
73 # cases.
74
75 gdb_test_multiple "tstatus" "check on trace status" {
968643aa 76 -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Trace notes: my tracing note\.\[\r\n\]+Not looking at any trace frame\..*\r\n$gdb_prompt $" {
f196051f
SS
77 pass "tstatus reports trace note"
78 }
968643aa 79 -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*\r\n$gdb_prompt $" {
f196051f
SS
80 pass "tstatus does not report any trace note"
81 }
82 }
83
84 gdb_test "set trace-notes different note" "" "change tracing note"
85
86 gdb_test_multiple "tstatus" "check on trace status with diff note" {
968643aa 87 -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Trace notes: different note\.\[\r\n\]+Not looking at any trace frame\..*\r\n$gdb_prompt $" {
f196051f
SS
88 pass "tstatus reports different trace note"
89 }
968643aa 90 -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*\r\n$gdb_prompt $" {
f196051f
SS
91 pass "tstatus does not report any different trace note"
92 }
93 }
94
95 gdb_test "set trace-user me me me" "" "change tracing user"
96
97 gdb_test_multiple "tstatus" "check on trace status with diff note" {
968643aa 98 -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Trace user is me me me\.\[\r\n\]+Trace notes: different note\.\[\r\n\]+Not looking at any trace frame\..*\r\n$gdb_prompt $" {
f196051f
SS
99 pass "tstatus reports trace user"
100 }
968643aa 101 -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*\r\n$gdb_prompt $" {
f196051f
SS
102 pass "tstatus does not report trace user"
103 }
104 }
105
106 gdb_test_no_output "tstop because I can" "trace stopped with note"
107
108 gdb_test_multiple "tstatus" "check on trace status after stop" {
968643aa 109 -re "Trace stopped by a tstop command (because I can)\..*Trace will stop if GDB disconnects\.\[\r\n\]+Trace user is me me me\.\[\r\n\]+Trace notes: different note\.\[\r\n\]+Not looking at any trace frame\..*\r\n$gdb_prompt $" {
f196051f
SS
110 pass "tstatus reports trace stop reason"
111 }
968643aa 112 -re "Trace stopped by a tstop command\..*\r\n$gdb_prompt $" {
f196051f
SS
113 pass "tstatus does not report trace stop reason"
114 }
115 }
116
117 # Tracepoint hit count is optional, so pass it either way.
118
119 gdb_test_multiple "info trace" "show tracepoint state" {
968643aa 120 -re "actions\.c:\[0-9\]+\[\r\n\]+\[\t ]+tracepoint already hit 1 time\[\r\n\]+\[\t ]+collect parm.*\r\n$gdb_prompt $" {
f196051f
SS
121 pass "info trace reports tracepoint hit count"
122 }
968643aa 123 -re "actions\.c:\[0-9\]+\[\r\n\]+\[\t ]+collect parm.*\r\n$gdb_prompt $" {
f196051f
SS
124 pass "info trace does not report tracepoint hit count"
125 }
126 }
127}
128
129proc test_tracepoints {} {
968643aa 130 global gdb_prompt
f196051f
SS
131
132 gdb_test "break begin" ".*" ""
133
134 gdb_test "break end" ".*" ""
135
136 gdb_test "trace gdb_c_test" "Tracepoint .*" \
137 "tracepoint at gdb_c_test"
138
139 gdb_trace_setactions "collect at set_point: define actions" \
140 "" \
141 "collect parm" "^$"
142 set fastgood 0
143
144 gdb_test_multiple "ftrace gdb_recursion_test" "set fast tracepoint" {
968643aa 145 -re "May not have a fast tracepoint at .*\r\n$gdb_prompt $" {
f196051f
SS
146 pass "4-byte fast tracepoint could not be set"
147 }
968643aa 148 -re "Fast tracepoint .*\r\n$gdb_prompt $" {
f196051f
SS
149 pass "4-byte fast tracepoint is set"
150 set fastgood 1
151 }
152 }
153
154 if { $fastgood } {
155
156 gdb_trace_setactions "collect at four_byter: define actions" \
157 "" \
158 "collect globvar, anarg" "^$"
159 }
160
161 run_trace_experiment
162
163}
164
165gdb_reinitialize_dir $srcdir/$subdir
166
c0d4d1c0 167if { [gdb_test "info sharedlibrary" ".*${libipa}.*" "IPA loaded"] != 0 } {
f196051f
SS
168 untested "Could not find IPA lib loaded"
169 return 1
170}
171
172test_tracepoints