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