1 # This testcase is part of GDB, the GNU debugger.
3 # Copyright 2016-2017 Free Software Foundation, Inc.
5 # Contributed by Intel Corp. <tim.wiederhake@intel.com>
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.
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.
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/>.
20 load_lib gdbserver-support.exp
22 if { [skip_btrace_tests] } {
23 unsupported "target does not support record-btrace"
26 if { [skip_gdbserver_tests] } {
27 unsupported "target does not support gdbserver"
32 if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
36 # Make sure we're disconnected and no recording is active, in case
37 # we're testing with an extended-remote board, therefore already
39 with_test_prefix "preparation" {
40 gdb_test "record stop" ".*"
41 gdb_test "disconnect" ".*"
44 # Start fresh gdbserver.
45 set gdbserver_reconnect_p 1
46 set res [gdbserver_start "" $binfile]
47 set gdbserver_protocol [lindex $res 0]
48 set gdbserver_gdbport [lindex $res 1]
49 gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
51 # Create a record, check, reconnect
52 with_test_prefix "first" {
53 gdb_test_no_output "record btrace" "record btrace enable"
54 gdb_test "stepi 19" "0x.* in .* from target.*"
56 gdb_test "info record" [multi_line \
57 "Active record target: .*" \
58 "Recorded 19 instructions in .+ functions \\(. gaps\\) for thread 1 \\(Thread .*\\)."
61 gdb_test "disconnect" "Ending remote debugging."
62 gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
65 # Test if we can access the recorded data from first connect.
66 # Note: BTS loses the first function call entry with its associated
67 # instructions for technical reasons. This is why we test for
68 # "a number between 10 and 19", so we catch at least the case where
69 # there are 0 instructions in the record.
70 with_test_prefix "second" {
71 gdb_test "info record" [multi_line \
72 "Active record target: .*" \
73 "Recorded 1. instructions in .+ functions \\(. gaps\\) for thread 1 \\(Thread .*\\)."
76 gdb_test "record stop" "Process record is stopped and all execution logs are deleted."
78 gdb_test "disconnect" "Ending remote debugging."
79 gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
82 # Test that recording is now off.
83 with_test_prefix "third" {
84 gdb_test "info record" "No record target is currently active."