]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.btrace/enable.exp
record btrace: add configuration struct
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.btrace / enable.exp
CommitLineData
2f1d9bdd
MM
1# This testcase is part of GDB, the GNU debugger.
2#
32d0add0 3# Copyright 2013-2015 Free Software Foundation, Inc.
2f1d9bdd
MM
4#
5# Contributed by Intel Corp. <christian.himpel@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
20# check for btrace support
21if { [skip_btrace_tests] } { return -1 }
22
23# start fresh - without an executable
24gdb_exit
25gdb_start
26
27# record cannot be stopped, if it was never active
28gdb_test "record stop" "No record target is currently active\\..*" "record stop without target"
29
30# btrace cannot be enabled without a running inferior
31gdb_test "record btrace" "The program is not being run\\." "record btrace without running program"
32
33# no function and no instruction history without btrace enabled
34gdb_test "record function-call-history" "No record target is currently active\\..*" "record function-call-history without target"
35gdb_test "record instruction-history" "No record target is currently active\\..*" "record instruction-history without target"
36gdb_test "info record" "No record target is currently active\\." "info record without target"
37
38# start inferior
39standard_testfile
40if [prepare_for_testing $testfile.exp $testfile {} {debug}] {
41 return -1
42}
43if ![runto_main] {
44 return -1
45}
46
47# enable btrace
48gdb_test_no_output "record btrace" "record btrace"
49gdb_test "record function-call-history" "No trace\\." "record function-call-history without trace"
50gdb_test "record instruction-history" "No trace\\." "record instruction-history without trace"
51
52# btrace cannot be enabled twice
6d78d93b 53gdb_test "record btrace" "The process is already being recorded\\. Use \"record stop\" to stop recording first\\." "record btrace the second time"
2f1d9bdd
MM
54
55# full record cannot be activated as long as btrace is active
6d78d93b 56gdb_test "record full" "The process is already being recorded\\. Use \"record stop\" to stop recording first\\." "record full cannot be enabled"
2f1d9bdd
MM
57
58# no trace recorded yet
f4abbc16
MM
59gdb_test "info record" "Active record target: record-btrace\r
60.*\r
61Recorded 0 instructions in 0 functions for thread 1.*\\." "info record without trace"
2f1d9bdd
MM
62
63# stop btrace record
64gdb_test "record stop" "Process record is stopped and all execution logs are deleted\\." "record stop"
65gdb_test "record stop" "No record target is currently active\\..*" "record stop the second time"
66
67# enable btrace again
68gdb_test_no_output "record btrace" "record btrace re-enable"
6d78d93b 69gdb_test "record btrace" "The process is already being recorded\\. Use \"record stop\" to stop recording first\\." "record btrace re-enable twice"
2f1d9bdd
MM
70
71# continue to the end and make sure we don't die
72gdb_test "continue" ".*Inferior.*exited.*" "continue to end"
73
74# skip the rerun test when using gdbserver
75# otherwise rerun twice, target should be automatically disabled
76load_lib gdbserver-support.exp
77if [skip_gdbserver_tests] {
78 return 0
79}
80clean_restart $testfile
81if ![runto_main] {
82 return -1
83}
84if ![runto_main] {
85 return -1
86}
99c819ee
MM
87
88# make sure record-btrace can be enabled after re-run
89clean_restart $testfile
90if ![runto_main] {
91 return -1
92}
93gdb_test_no_output "record btrace"
94if ![runto_main] {
95 return -1
96}
97gdb_test_no_output "record btrace" "enable after re-run"