]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.btrace/stepi.exp
record btrace: add configuration struct
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.btrace / stepi.exp
CommitLineData
52834460
MM
1# This testcase is part of GDB, the GNU debugger.
2#
32d0add0 3# Copyright 2013-2015 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
20# check for btrace support
21if { [skip_btrace_tests] } { return -1 }
22
23# start inferior
24standard_testfile x86-record_goto.S
25if [prepare_for_testing stepi.exp $testfile $srcfile] {
26 return -1
27}
28
29global gdb_prompt
30
31if ![runto_main] {
32 return -1
33}
34
35proc check_replay_at { insn } {
36 gdb_test "info record" [join [list \
37 "Active record target: record-btrace" \
f4abbc16 38 "Recording format: .*" \
52834460
MM
39 "Recorded 40 instructions in 16 functions for .*" \
40 "Replay in progress\. At instruction $insn\." \
41 ] "\r\n"]
42}
43
44# trace the call to the test function
45gdb_test_no_output "record btrace"
46gdb_test "next"
47
48# we start with stepping to make sure that the trace is fetched automatically
49gdb_test "reverse-stepi" ".*fun4\.5.*"
50gdb_test "reverse-stepi" ".*fun4\.5.*"
51
52# let's check where we are in the trace
53with_test_prefix "reverse-stepi to 39" { check_replay_at 39 }
54
55# let's step forward and check again
56gdb_test "stepi" ".*fun4\.5.*"
57with_test_prefix "stepi to 40" { check_replay_at 40 }
58
59# with the next step, we stop replaying
60gdb_test "stepi" ".*main\.3.*"
61gdb_test "info record" [join [list \
62 "Active record target: record-btrace" \
f4abbc16 63 "Recording format: .*" \
52834460
MM
64 "Recorded 40 instructions in 16 functions for \[^\\\r\\\n\]*" \
65 ] "\r\n"] "stepi to live"
66
67# let's step from a goto position somewhere in the middle
68gdb_test "record goto 22" ".*fun3\.2.*"
69with_test_prefix "goto 22" { check_replay_at 22 }
70
71gdb_test "stepi" ".*fun1\.1.*"
72with_test_prefix "stepi to 23" { check_replay_at 23 }
73
74# and back again
75gdb_test "reverse-stepi" ".*fun3\.2.*"
76gdb_test "reverse-stepi" ".*fun3\.1.*"
77with_test_prefix "reverse-stepi to 21" { check_replay_at 21 }
78
79# let's try to step off the left end
80gdb_test "record goto begin" ".*main\.2.*"
81with_test_prefix "goto begin" { check_replay_at 1 }
82
83gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
84gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
85with_test_prefix "reverse-stepi at begin" { check_replay_at 1 }
86
87# we can step forward, though
88gdb_test "stepi" ".*fun4\.1.*"
89with_test_prefix "stepi to 2" { check_replay_at 2 }
90
91# let's try to step off the left end again
92gdb_test "reverse-stepi" ".*main\.2.*"
93gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
94gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
95with_test_prefix "reverse-stepi at begin" { check_replay_at 1 }