]>
Commit | Line | Data |
---|---|---|
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 | |
21 | if { [skip_btrace_tests] } { return -1 } | |
22 | ||
23 | # start inferior | |
24 | standard_testfile x86-record_goto.S | |
25 | if [prepare_for_testing stepi.exp $testfile $srcfile] { | |
26 | return -1 | |
27 | } | |
28 | ||
29 | global gdb_prompt | |
30 | ||
31 | if ![runto_main] { | |
32 | return -1 | |
33 | } | |
34 | ||
35 | proc 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 | |
45 | gdb_test_no_output "record btrace" | |
46 | gdb_test "next" | |
47 | ||
48 | # we start with stepping to make sure that the trace is fetched automatically | |
49 | gdb_test "reverse-stepi" ".*fun4\.5.*" | |
50 | gdb_test "reverse-stepi" ".*fun4\.5.*" | |
51 | ||
52 | # let's check where we are in the trace | |
53 | with_test_prefix "reverse-stepi to 39" { check_replay_at 39 } | |
54 | ||
55 | # let's step forward and check again | |
56 | gdb_test "stepi" ".*fun4\.5.*" | |
57 | with_test_prefix "stepi to 40" { check_replay_at 40 } | |
58 | ||
59 | # with the next step, we stop replaying | |
60 | gdb_test "stepi" ".*main\.3.*" | |
61 | gdb_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 | |
68 | gdb_test "record goto 22" ".*fun3\.2.*" | |
69 | with_test_prefix "goto 22" { check_replay_at 22 } | |
70 | ||
71 | gdb_test "stepi" ".*fun1\.1.*" | |
72 | with_test_prefix "stepi to 23" { check_replay_at 23 } | |
73 | ||
74 | # and back again | |
75 | gdb_test "reverse-stepi" ".*fun3\.2.*" | |
76 | gdb_test "reverse-stepi" ".*fun3\.1.*" | |
77 | with_test_prefix "reverse-stepi to 21" { check_replay_at 21 } | |
78 | ||
79 | # let's try to step off the left end | |
80 | gdb_test "record goto begin" ".*main\.2.*" | |
81 | with_test_prefix "goto begin" { check_replay_at 1 } | |
82 | ||
83 | gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*" | |
84 | gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*" | |
85 | with_test_prefix "reverse-stepi at begin" { check_replay_at 1 } | |
86 | ||
87 | # we can step forward, though | |
88 | gdb_test "stepi" ".*fun4\.1.*" | |
89 | with_test_prefix "stepi to 2" { check_replay_at 2 } | |
90 | ||
91 | # let's try to step off the left end again | |
92 | gdb_test "reverse-stepi" ".*main\.2.*" | |
93 | gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*" | |
94 | gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*" | |
95 | with_test_prefix "reverse-stepi at begin" { check_replay_at 1 } |