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