Automatic date update in version.in
[binutils-gdb.git] / gdb / testsuite / gdb.btrace / enable.exp
blob4e39c07472bfb4d9d796d968cb1ac55639b89a77
1 # This testcase is part of GDB, the GNU debugger.
3 # Copyright 2013-2024 Free Software Foundation, Inc.
5 # Contributed by Intel Corp. <christian.himpel@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 require allow_btrace_tests
22 # start fresh - without an executable
23 gdb_exit
24 gdb_start
26 # record cannot be stopped, if it was never active
27 gdb_test "record stop" "No recording is currently active\\..*" "record stop without target"
29 # btrace cannot be enabled without a running inferior
30 gdb_test "record btrace" "The program is not being run\\." "record btrace without running program"
32 # no function and no instruction history without btrace enabled
33 gdb_test "record function-call-history" "No recording is currently active\\..*" "record function-call-history without target"
34 gdb_test "record instruction-history" "No recording is currently active\\..*" "record instruction-history without target"
35 gdb_test "info record" "No recording is currently active\\." "info record without target"
37 standard_testfile
38 if [prepare_for_testing "failed to prepare" $testfile {} {debug}] {
39     return -1
42 if ![runto_main] {
43     return -1
46 # enable btrace
47 gdb_test_no_output "record btrace" "record btrace"
48 gdb_test "record function-call-history" "No trace\\." "record function-call-history without trace"
49 gdb_test "record instruction-history" "No trace\\." "record instruction-history without trace"
51 # btrace cannot be enabled twice
52 gdb_test "record btrace" "The process is already being recorded\\.  Use \"record stop\" to stop recording first\\." "record btrace the second time"
54 # full record cannot be activated as long as btrace is active
55 gdb_test "record full" "The process is already being recorded\\.  Use \"record stop\" to stop recording first\\." "record full cannot be enabled"
57 # no trace recorded yet
58 gdb_test "info record" "Active record target: record-btrace\r
59 .*\r
60 Recorded 0 instructions in 0 functions \\\(0 gaps\\\) for thread 1.*\\." "info record without trace"
62 # stop btrace record
63 gdb_test "record stop" "Process record is stopped and all execution logs are deleted\\."
64 gdb_test "record stop" "No recording is currently active\\..*" "record stop the second time"
66 # enable btrace again
67 gdb_test_no_output "record btrace" "record btrace re-enable"
68 gdb_test "record btrace" "The process is already being recorded\\.  Use \"record stop\" to stop recording first\\." "record btrace re-enable twice"
70 # continue to the end and make sure we don't die
71 gdb_test "continue" ".*Inferior.*exited.*" "continue to end"
73 # allow_gdbserver_tests requires GDB not running.
74 gdb_exit
76 # skip the rerun test when using gdbserver
77 # otherwise rerun twice, target should be automatically disabled
78 load_lib gdbserver-support.exp
79 require allow_gdbserver_tests
80 clean_restart $testfile
81 if ![runto_main] {
82     return -1
84 if ![runto_main] {
85     return -1
88 # make sure record-btrace can be enabled after re-run
89 clean_restart $testfile
90 if ![runto_main] {
91     return -1
93 gdb_test_no_output "record btrace" "enable after restart"
94 if ![runto_main] {
95     return -1
97 gdb_test_no_output "record btrace" "enable after re-run"