]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.trace/status-stop.exp
Update copyright year range in all GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.trace / status-stop.exp
CommitLineData
3666a048 1# Copyright 2011-2021 Free Software Foundation, Inc.
4511b1ba
YQ
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
4ec70201 15load_lib "trace-support.exp"
4511b1ba 16
497a5eb0 17standard_testfile
4511b1ba 18set executable $testfile
4511b1ba
YQ
19set expfile $testfile.exp
20
21
5b362f04 22if [prepare_for_testing "failed to prepare" $executable $srcfile \
4511b1ba 23 {debug nowarnings}] {
4511b1ba
YQ
24 return -1
25}
26
ff7d1690 27if ![runto_main] {
bc6c7af4 28 fail "can't run to main to check for trace support"
ff7d1690
YQ
29 return -1
30}
31
32if ![gdb_target_supports_trace] {
33 unsupported "target does not support trace"
4ec70201 34 return -1
ff7d1690
YQ
35}
36
4511b1ba
YQ
37# Verify that the sequence of commands "tstart tstop tstart" works well.
38
0a251e08
YQ
39proc test_tstart_tstop_tstart { } {
40 with_test_prefix "tstart_tstop_tstart" {
41 global executable
42 global hex
4511b1ba 43
0a251e08
YQ
44 # Start with a fresh gdb.
45 clean_restart ${executable}
46 if ![runto_main] {
bc6c7af4 47 fail "can't run to main"
0a251e08
YQ
48 return -1
49 }
4511b1ba 50
0a251e08
YQ
51 gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
52 gdb_test_no_output "tstart"
4511b1ba 53
194ed413 54 gdb_breakpoint "end" qualified
0a251e08
YQ
55 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
56 "continue to end"
4511b1ba 57
0a251e08 58 gdb_test_no_output "tstop"
4511b1ba 59
0a251e08 60 gdb_test_no_output "tstart"
4511b1ba 61 }
0a251e08 62}
4511b1ba 63
0a251e08 64# Verify the sequence of commands "tstart tstart" works well.
4511b1ba 65
0a251e08
YQ
66proc test_tstart_tstart { } {
67 with_test_prefix "tstart_tstart" {
68 global executable
69 global hex
4511b1ba 70
0a251e08
YQ
71 # Start with a fresh gdb.
72 clean_restart ${executable}
73 if ![runto_main] {
bc6c7af4 74 fail "can't run to main"
0a251e08
YQ
75 return -1
76 }
4511b1ba 77
0a251e08
YQ
78 gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
79 gdb_test_no_output "tstart"
4511b1ba 80
1ebff1fd
HAQ
81 set test "tstart again"
82 gdb_test_multiple "tstart" $test {
83 -re "A trace is running already. Start a new run.*y or n.*" {
84 # Send 'y' and make sure that we don't get any error.
85 gdb_test_no_output "y" $test
86 }
87 }
4511b1ba 88 }
0a251e08 89}
4511b1ba 90
0a251e08 91# Verify that trace stops clearly when trace buffer is full.
4511b1ba 92
0a251e08
YQ
93proc test_buffer_full_tstart { } {
94 with_test_prefix "buffer_full_tstart" {
95 global executable
96 global hex
97
98 # Start with a fresh gdb.
99 clean_restart ${executable}
100 if ![runto_main] {
bc6c7af4 101 fail "can't run to main"
0a251e08
YQ
102 return -1
103 }
104
105 gdb_test "trace func2" "Tracepoint \[0-9\] at $hex: file.*"
106 gdb_trace_setactions "collect buf: define actions" \
107 "" \
108 "collect buf" "^$"
109
110 gdb_test_no_output "tstart"
194ed413 111 gdb_breakpoint "end" qualified
0a251e08
YQ
112 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end"
113
114 gdb_test "tstatus" ".*buffer was full.*"
115 gdb_test_no_output "tstart"
116 }
117}
4511b1ba
YQ
118
119test_tstart_tstop_tstart
120
121test_tstart_tstart
122
6a5870ce 123test_buffer_full_tstart