1 # Copyright 2011-2012 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 set testfile "status-stop"
18 set executable $testfile
19 set srcfile ${testfile}.c
20 set binfile $objdir/$subdir/$testfile
21 set expfile $testfile.exp
24 if [prepare_for_testing $expfile $executable $srcfile \
26 untested "failed to prepare for trace tests"
31 fail "Can't run to main to check for trace support"
35 if ![gdb_target_supports_trace] {
36 unsupported "target does not support trace"
40 # Verify that the sequence of commands "tstart tstop tstart" works well.
42 proc test_tstart_tstop_tstart { } {
47 set old_pf_prefix $pf_prefix
48 set pf_prefix "$pf_prefix tstart_tstop_tstart:"
50 # Start with a fresh gdb.
51 clean_restart ${executable}
53 fail "Can't run to main"
54 set pf_prefix $old_pf_prefix
58 gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
59 gdb_test_no_output "tstart"
61 gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
62 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end"
64 gdb_test_no_output "tstop"
66 gdb_test_no_output "tstart"
68 set pf_prefix $old_pf_prefix
71 # Verify the sequence of commands "tstart tstart" works well.
73 proc test_tstart_tstart { } {
78 set old_pf_prefix $pf_prefix
79 set pf_prefix "$pf_prefix tstart_tstart:"
81 # Start with a fresh gdb.
82 clean_restart ${executable}
84 fail "Can't run to main"
85 set pf_prefix $old_pf_prefix
89 gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
90 gdb_test_no_output "tstart"
92 gdb_test "tstart" "" "tstart again" "A trace is running already. Start a new run\\? \\(y or n\\) " "y"
94 set pf_prefix $old_pf_prefix
97 # Verify that trace stops clearly when trace buffer is full.
99 proc test_buffer_full_tstart { } {
104 set old_pf_prefix $pf_prefix
105 set pf_prefix "$pf_prefix buffer_full_tstart:"
107 # Start with a fresh gdb.
108 clean_restart ${executable}
110 fail "Can't run to main"
111 set pf_prefix $old_pf_prefix
115 gdb_test "trace func2" "Tracepoint \[0-9\] at $hex: file.*"
116 gdb_trace_setactions "collect buf: define actions" \
120 gdb_test_no_output "tstart"
121 gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
122 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end"
124 gdb_test "tstatus" ".*buffer was full.*"
125 gdb_test_no_output "tstart"
127 set old_pf_prefix $pf_prefix
130 test_tstart_tstop_tstart
134 test_buffer_full_tstart