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 { } { with_test_prefix " tstart_tstop_tstart:" {
46 # Start with a fresh gdb.
47 clean_restart ${executable}
49 fail "Can't run to main"
53 gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
54 gdb_test_no_output "tstart"
56 gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
57 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end"
59 gdb_test_no_output "tstop"
61 gdb_test_no_output "tstart"
64 # Verify the sequence of commands "tstart tstart" works well.
66 proc test_tstart_tstart { } { with_test_prefix " tstart_tstart:" {
70 # Start with a fresh gdb.
71 clean_restart ${executable}
73 fail "Can't run to main"
77 gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
78 gdb_test_no_output "tstart"
80 gdb_test "tstart" "" "tstart again" "A trace is running already. Start a new run\\? \\(y or n\\) " "y"
83 # Verify that trace stops clearly when trace buffer is full.
85 proc test_buffer_full_tstart { } { with_test_prefix " buffer_full_tstart:" {
89 # Start with a fresh gdb.
90 clean_restart ${executable}
92 fail "Can't run to main"
96 gdb_test "trace func2" "Tracepoint \[0-9\] at $hex: file.*"
97 gdb_trace_setactions "collect buf: define actions" \
101 gdb_test_no_output "tstart"
102 gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
103 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end"
105 gdb_test "tstatus" ".*buffer was full.*"
106 gdb_test_no_output "tstart"
109 test_tstart_tstop_tstart
113 test_buffer_full_tstart