]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.trace/status-stop.exp
Automatic Copyright Year update after running gdb/copyright.py
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.trace / status-stop.exp
CommitLineData
4a94e368 1# Copyright 2011-2022 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] {
ff7d1690
YQ
28 return -1
29}
30
31if ![gdb_target_supports_trace] {
32 unsupported "target does not support trace"
4ec70201 33 return -1
ff7d1690
YQ
34}
35
4511b1ba
YQ
36# Verify that the sequence of commands "tstart tstop tstart" works well.
37
0a251e08
YQ
38proc test_tstart_tstop_tstart { } {
39 with_test_prefix "tstart_tstop_tstart" {
40 global executable
41 global hex
4511b1ba 42
0a251e08
YQ
43 # Start with a fresh gdb.
44 clean_restart ${executable}
45 if ![runto_main] {
0a251e08
YQ
46 return -1
47 }
4511b1ba 48
0a251e08
YQ
49 gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
50 gdb_test_no_output "tstart"
4511b1ba 51
194ed413 52 gdb_breakpoint "end" qualified
0a251e08
YQ
53 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
54 "continue to end"
4511b1ba 55
0a251e08 56 gdb_test_no_output "tstop"
4511b1ba 57
0a251e08 58 gdb_test_no_output "tstart"
4511b1ba 59 }
0a251e08 60}
4511b1ba 61
0a251e08 62# Verify the sequence of commands "tstart tstart" works well.
4511b1ba 63
0a251e08
YQ
64proc test_tstart_tstart { } {
65 with_test_prefix "tstart_tstart" {
66 global executable
67 global hex
4511b1ba 68
0a251e08
YQ
69 # Start with a fresh gdb.
70 clean_restart ${executable}
71 if ![runto_main] {
0a251e08
YQ
72 return -1
73 }
4511b1ba 74
0a251e08
YQ
75 gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
76 gdb_test_no_output "tstart"
4511b1ba 77
1ebff1fd
HAQ
78 set test "tstart again"
79 gdb_test_multiple "tstart" $test {
80 -re "A trace is running already. Start a new run.*y or n.*" {
81 # Send 'y' and make sure that we don't get any error.
82 gdb_test_no_output "y" $test
83 }
84 }
4511b1ba 85 }
0a251e08 86}
4511b1ba 87
0a251e08 88# Verify that trace stops clearly when trace buffer is full.
4511b1ba 89
0a251e08
YQ
90proc test_buffer_full_tstart { } {
91 with_test_prefix "buffer_full_tstart" {
92 global executable
93 global hex
94
95 # Start with a fresh gdb.
96 clean_restart ${executable}
97 if ![runto_main] {
0a251e08
YQ
98 return -1
99 }
100
101 gdb_test "trace func2" "Tracepoint \[0-9\] at $hex: file.*"
102 gdb_trace_setactions "collect buf: define actions" \
103 "" \
104 "collect buf" "^$"
105
106 gdb_test_no_output "tstart"
194ed413 107 gdb_breakpoint "end" qualified
0a251e08
YQ
108 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end"
109
110 gdb_test "tstatus" ".*buffer was full.*"
111 gdb_test_no_output "tstart"
112 }
113}
4511b1ba
YQ
114
115test_tstart_tstop_tstart
116
117test_tstart_tstart
118
6a5870ce 119test_buffer_full_tstart