gdb, record: rephrase the 'not recording' error message
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.btrace / stepi.exp
CommitLineData
52834460
MM
1# This testcase is part of GDB, the GNU debugger.
2#
b811d2c2 3# Copyright 2013-2020 Free Software Foundation, Inc.
52834460
MM
4#
5# Contributed by Intel Corp. <markus.t.metzger@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
20if { [skip_btrace_tests] } {
21 unsupported "target does not support record-btrace"
22 return -1
23}
52834460 24
66849923
MM
25# This test is stepping on instruction level. To guarantee that we always
26# get the same execution trace, we use an assembly source file.
27#
28# We use different assembly sources based on the target architecture.
29#
30# Luckily, they are similar enough that a single test script can handle
31# both.
e0461dbb
MM
32if [info exists COMPILE] {
33 # make check RUNTESTFLAGS="gdb.btrace/stepi.exp COMPILE=1"
34 standard_testfile record_goto.c
35 lappend opts debug
36} elseif {[istarget "i?86-*-*"] || [istarget "x86_64-*-*"]} {
37 if {[is_amd64_regs_target]} {
38 standard_testfile x86_64-record_goto.S
39 } else {
40 standard_testfile i686-record_goto.S
41 }
66849923 42} else {
b5ac99b0 43 unsupported "target architecture not supported"
e0461dbb 44 return -1
66849923
MM
45}
46
5b362f04 47if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
52834460
MM
48 return -1
49}
50
52834460 51if ![runto_main] {
b5ac99b0 52 untested "failed to run to main"
52834460
MM
53 return -1
54}
55
b5ac99b0
MM
56global gdb_prompt
57
52834460 58proc check_replay_at { insn } {
3c724c8c 59 gdb_test "info record" [multi_line \
52834460 60 "Active record target: record-btrace" \
66849923 61 ".*" \
31fd9caa 62 "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for .*" \
52834460 63 "Replay in progress\. At instruction $insn\." \
3c724c8c 64 ]
52834460
MM
65}
66
67# trace the call to the test function
68gdb_test_no_output "record btrace"
69gdb_test "next"
70
71# we start with stepping to make sure that the trace is fetched automatically
72gdb_test "reverse-stepi" ".*fun4\.5.*"
73gdb_test "reverse-stepi" ".*fun4\.5.*"
74
75# let's check where we are in the trace
76with_test_prefix "reverse-stepi to 39" { check_replay_at 39 }
77
78# let's step forward and check again
79gdb_test "stepi" ".*fun4\.5.*"
80with_test_prefix "stepi to 40" { check_replay_at 40 }
81
82# with the next step, we stop replaying
83gdb_test "stepi" ".*main\.3.*"
3c724c8c 84gdb_test "info record" [multi_line \
52834460 85 "Active record target: record-btrace" \
66849923 86 ".*" \
31fd9caa 87 "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \
3c724c8c 88 ] "stepi to live"
52834460 89
66849923
MM
90# let's try nexti
91gdb_test "reverse-nexti" ".*main\.2.*"
92with_test_prefix "reverse-nexti - 1" { check_replay_at 1 }
93
94# we can't reverse-nexti any further
95gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*"
96with_test_prefix "reverse-nexti - 1" { check_replay_at 1 }
97
98# but we can step back again
99gdb_test "nexti" ".*main\.3.*" "next, 1.5"
3c724c8c 100gdb_test "info record" [multi_line \
66849923
MM
101 "Active record target: record-btrace" \
102 ".*" \
103 "Recorded 40 instructions in 16 functions \\\(0 gaps\\\) for \[^\\\r\\\n\]*" \
3c724c8c 104 ] "nexti back"
66849923 105
52834460
MM
106# let's step from a goto position somewhere in the middle
107gdb_test "record goto 22" ".*fun3\.2.*"
108with_test_prefix "goto 22" { check_replay_at 22 }
109
110gdb_test "stepi" ".*fun1\.1.*"
111with_test_prefix "stepi to 23" { check_replay_at 23 }
112
52834460 113gdb_test "reverse-stepi" ".*fun3\.2.*"
66849923
MM
114with_test_prefix "reverse-stepi to 22" { check_replay_at 22 }
115
116gdb_test "nexti" ".*fun3\.3.*"
117with_test_prefix "nexti to 27" { check_replay_at 27 }
118
119gdb_test "reverse-nexti" ".*fun3\.2.*"
120with_test_prefix "reverse-nexti to 22" { check_replay_at 22 }
52834460
MM
121
122# let's try to step off the left end
123gdb_test "record goto begin" ".*main\.2.*"
124with_test_prefix "goto begin" { check_replay_at 1 }
125
126gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
127gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
128with_test_prefix "reverse-stepi at begin" { check_replay_at 1 }
129
66849923
MM
130gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*"
131gdb_test "reverse-nexti" "No more reverse-execution history\.\r\n.*main\.2.*"
132with_test_prefix "reverse-nexti at begin" { check_replay_at 1 }
133
52834460
MM
134# we can step forward, though
135gdb_test "stepi" ".*fun4\.1.*"
136with_test_prefix "stepi to 2" { check_replay_at 2 }
137
138# let's try to step off the left end again
139gdb_test "reverse-stepi" ".*main\.2.*"
140gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
141gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
142with_test_prefix "reverse-stepi at begin" { check_replay_at 1 }
This page took 0.794508 seconds and 4 git commands to generate.