Fix: Null pointer dereference in ldlex.l
[binutils-gdb.git] / gdb / testsuite / gdb.trace / status-stop.exp
blob0ef7d5ed4e2095a2271b758061634e9f58149dcd
1 # Copyright 2011-2023 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 standard_testfile
18 set executable $testfile
19 set expfile $testfile.exp
22 if [prepare_for_testing "failed to prepare" $executable $srcfile \
23 {debug nowarnings}] {
24 return -1
27 if ![runto_main] {
28 return -1
31 if ![gdb_target_supports_trace] {
32 unsupported "target does not support trace"
33 return -1
36 # Verify that the sequence of commands "tstart tstop tstart" works well.
38 proc test_tstart_tstop_tstart { } {
39 with_test_prefix "tstart_tstop_tstart" {
40 global executable
41 global hex
43 # Start with a fresh gdb.
44 clean_restart ${executable}
45 if ![runto_main] {
46 return -1
49 gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
50 gdb_test_no_output "tstart"
52 gdb_breakpoint "end" qualified
53 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
54 "continue to end"
56 gdb_test_no_output "tstop"
58 gdb_test_no_output "tstart"
62 # Verify the sequence of commands "tstart tstart" works well.
64 proc test_tstart_tstart { } {
65 with_test_prefix "tstart_tstart" {
66 global executable
67 global hex
69 # Start with a fresh gdb.
70 clean_restart ${executable}
71 if ![runto_main] {
72 return -1
75 gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
76 gdb_test_no_output "tstart"
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
88 # Verify that trace stops clearly when trace buffer is full.
90 proc test_buffer_full_tstart { } {
91 with_test_prefix "buffer_full_tstart" {
92 global executable
93 global hex
95 # Start with a fresh gdb.
96 clean_restart ${executable}
97 if ![runto_main] {
98 return -1
101 gdb_test "trace func2" "Tracepoint \[0-9\] at $hex: file.*"
102 gdb_trace_setactions "collect buf: define actions" \
103 "" \
104 "collect buf" "^$"
106 gdb_test_no_output "tstart"
107 gdb_breakpoint "end" qualified
108 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end"
110 gdb_test "tstatus" ".*buffer was full.*"
111 gdb_test_no_output "tstart"
115 test_tstart_tstop_tstart
117 test_tstart_tstart
119 test_buffer_full_tstart