test: cover subranges with present DW_AT_count attribute
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.btrace / stepi.exp
1 # This testcase is part of GDB, the GNU debugger.
2 #
3 # Copyright 2013 Free Software Foundation, Inc.
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" \
38 "Recorded 40 instructions in 16 functions for .*" \
39 "Replay in progress\. At instruction $insn\." \
40 ] "\r\n"]
41 }
42
43 # trace the call to the test function
44 gdb_test_no_output "record btrace"
45 gdb_test "next"
46
47 # we start with stepping to make sure that the trace is fetched automatically
48 gdb_test "reverse-stepi" ".*fun4\.5.*"
49 gdb_test "reverse-stepi" ".*fun4\.5.*"
50
51 # let's check where we are in the trace
52 with_test_prefix "reverse-stepi to 39" { check_replay_at 39 }
53
54 # let's step forward and check again
55 gdb_test "stepi" ".*fun4\.5.*"
56 with_test_prefix "stepi to 40" { check_replay_at 40 }
57
58 # with the next step, we stop replaying
59 gdb_test "stepi" ".*main\.3.*"
60 gdb_test "info record" [join [list \
61 "Active record target: record-btrace" \
62 "Recorded 40 instructions in 16 functions for \[^\\\r\\\n\]*" \
63 ] "\r\n"] "stepi to live"
64
65 # let's step from a goto position somewhere in the middle
66 gdb_test "record goto 22" ".*fun3\.2.*"
67 with_test_prefix "goto 22" { check_replay_at 22 }
68
69 gdb_test "stepi" ".*fun1\.1.*"
70 with_test_prefix "stepi to 23" { check_replay_at 23 }
71
72 # and back again
73 gdb_test "reverse-stepi" ".*fun3\.2.*"
74 gdb_test "reverse-stepi" ".*fun3\.1.*"
75 with_test_prefix "reverse-stepi to 21" { check_replay_at 21 }
76
77 # let's try to step off the left end
78 gdb_test "record goto begin" ".*main\.2.*"
79 with_test_prefix "goto begin" { check_replay_at 1 }
80
81 gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
82 gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
83 with_test_prefix "reverse-stepi at begin" { check_replay_at 1 }
84
85 # we can step forward, though
86 gdb_test "stepi" ".*fun4\.1.*"
87 with_test_prefix "stepi to 2" { check_replay_at 2 }
88
89 # let's try to step off the left end again
90 gdb_test "reverse-stepi" ".*main\.2.*"
91 gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
92 gdb_test "reverse-stepi" "No more reverse-execution history\.\r\n.*main\.2.*"
93 with_test_prefix "reverse-stepi at begin" { check_replay_at 1 }
This page took 0.030863 seconds and 4 git commands to generate.