]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.btrace/reconnect.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.btrace / reconnect.exp
CommitLineData
c0272db5
TW
1# This testcase is part of GDB, the GNU debugger.
2#
1d506c26 3# Copyright 2016-2024 Free Software Foundation, Inc.
c0272db5
TW
4#
5# Contributed by Intel Corp. <tim.wiederhake@intel.com>
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20load_lib gdbserver-support.exp
21
1ed844ca 22require allow_btrace_tests
cadfc59b 23require allow_gdbserver_tests
c0272db5
TW
24
25standard_testfile
5b362f04 26if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
c0272db5
TW
27 return -1
28}
29
f1e5a2b4
TV
30set target_binfile [gdb_remote_download target $binfile]
31
c0272db5
TW
32# Make sure we're disconnected and no recording is active, in case
33# we're testing with an extended-remote board, therefore already
34# connected.
35with_test_prefix "preparation" {
36 gdb_test "record stop" ".*"
37 gdb_test "disconnect" ".*"
38}
39
40# Start fresh gdbserver.
41set gdbserver_reconnect_p 1
f1e5a2b4 42set res [gdbserver_start "" $target_binfile]
c0272db5
TW
43set gdbserver_protocol [lindex $res 0]
44set gdbserver_gdbport [lindex $res 1]
45gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
46
47# Create a record, check, reconnect
48with_test_prefix "first" {
49 gdb_test_no_output "record btrace" "record btrace enable"
9d8f3022 50 gdb_test "stepi 19" ".*"
c0272db5
TW
51
52 gdb_test "info record" [multi_line \
53 "Active record target: .*" \
54 "Recorded 19 instructions in .+ functions \\(. gaps\\) for thread 1 \\(Thread .*\\)."
55 ]
56
57 gdb_test "disconnect" "Ending remote debugging."
58 gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
59}
60
61# Test if we can access the recorded data from first connect.
62# Note: BTS loses the first function call entry with its associated
63# instructions for technical reasons. This is why we test for
64# "a number between 10 and 19", so we catch at least the case where
65# there are 0 instructions in the record.
66with_test_prefix "second" {
67 gdb_test "info record" [multi_line \
68 "Active record target: .*" \
69 "Recorded 1. instructions in .+ functions \\(. gaps\\) for thread 1 \\(Thread .*\\)."
70 ]
71
72 gdb_test "record stop" "Process record is stopped and all execution logs are deleted."
73
74 gdb_test "disconnect" "Ending remote debugging."
75 gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
76}
77
78# Test that recording is now off.
79with_test_prefix "third" {
98d837f0 80 gdb_test "info record" "No recording is currently active."
c0272db5 81}