1 # Copyright 2011-2013 Free Software Foundation, Inc.
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.
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.
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/>.
15 load_lib "trace-support.exp"
17 standard_testfile actions.c
18 set executable $testfile
19 set expfile tstatus.exp
21 if [prepare_for_testing $expfile $executable $srcfile \
23 untested "failed to prepare for trace tests"
28 fail "Can't run to main to check for trace support"
32 if ![gdb_target_supports_trace] {
33 unsupported "target does not support trace"
37 proc run_trace_experiment {} {
41 # gdb_test_no_output "set debug remote 1" ""
44 ".*Breakpoint \[0-9\]+, begin .*" \
45 "advance to trace begin"
47 gdb_test_no_output "tstart my tracing note" "start trace experiment"
50 ".*Breakpoint \[0-9\]+, end .*" \
51 "advance through tracing"
53 # Now play with tstatus a bit.
55 # Since support for notes, user, stop reason, etc. is optional, we
56 # need to match both with and without cases.
58 set test "tstatus reports trace note"
59 gdb_test_multiple "tstatus" $test {
60 -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 $" {
63 -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*\r\n$gdb_prompt $" {
68 gdb_test "set trace-notes different note" "" "change tracing note"
70 set test "tstatus reports different trace note"
71 gdb_test_multiple "tstatus" $test {
72 -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 $" {
75 -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*\r\n$gdb_prompt $" {
80 gdb_test "set trace-user me me me" "" "change tracing user"
82 set test "tstatus reports trace user"
83 gdb_test_multiple "tstatus" $test {
84 -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 $" {
87 -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*\r\n$gdb_prompt $" {
92 gdb_test_no_output "tstop because I can" "trace stopped with note"
94 set test "tstatus reports trace stop reason"
95 gdb_test_multiple "tstatus" $test {
96 -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 $" {
99 -re "Trace stopped by a tstop command\..*\r\n$gdb_prompt $" {
104 set test "info trace reports tracepoint hit count and traceframe usage"
105 gdb_test_multiple "info trace" $test {
106 -re "actions\.c:\[0-9\]+\[\r\n\]+\[\t ]+tracepoint already hit 1 time\[\r\n\]+\[\t ]+trace buffer usage ${decimal} bytes\.\[\r\n\]+\[\t ]+collect parm.*\r\n$gdb_prompt $" {
109 -re "actions\.c:\[0-9\]+\[\r\n\]+\[\t ]+collect parm.*\r\n$gdb_prompt $" {
115 proc test_tracepoints {} {
118 gdb_test "break begin" ".*" ""
120 gdb_test "break end" ".*" ""
122 gdb_test "trace gdb_c_test" "Tracepoint .*" \
123 "tracepoint at gdb_c_test"
125 gdb_trace_setactions "collect at set_point: define actions" \