[PATCH 7/57][Arm][GAS] Add support for MVE instructions: vstr/vldr
[binutils-gdb.git] / gdb / testsuite / gdb.reverse / consecutive-reverse.exp
blob9b1f273097297b4c9b33984925216767e9366055
1 #   Copyright 2008-2019 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 # This file is part of the GDB testsuite.  It tests stepping over
17 # consecutive instructions in reverse.
19 if ![supports_reverse] {
20     return
23 standard_testfile
25 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
26     return -1
29 runto main
31 if [supports_process_record] {
32     # Activate process record/replay
33     gdb_test_no_output "record" "turn on process record"
36 gdb_breakpoint foo
37 gdb_test "continue" "Breakpoint $decimal, foo .*" \
38         "continue to breakpoint in foo"
40 set foo1_addr 0
41 set foo2_addr 0
42 set stop_addr 0
44 gdb_test_multiple "x /2i \$pc" "get breakpoint address for foo" {
45     global hex
46     global foo1_addr
47     global foo2_addr
48     global gdb_prompt
50     -re "=> ($hex).*\[\r\n\]+   ($hex).*$gdb_prompt $" {
51         set foo1_addr $expect_out(1,string)
52         set foo2_addr $expect_out(2,string)
53         pass "get breakpoint address for foo"
54     }
57 gdb_test "break \*$foo2_addr" "Breakpoint $decimal at $foo2_addr: file .*" \
58         "set bp, 2nd instr"
60 set testmsg "stopped at bp, 2nd instr"
61 gdb_test_multiple "step" $testmsg {
62     -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
63         set stop_addr $expect_out(1,string)
64         if [eval expr "$foo2_addr == $stop_addr"] then {
65             pass "stopped at bp, 2nd instr"
66         } else {
67             fail "stopped at bp, 2nd instr (wrong address)"
68         }
69     }
72 ###
73 ###
74 ###
76 # Set reverse execution direction
78 gdb_test_no_output "set exec-dir reverse" "set reverse execution"
80 # Now step backward and hope to hit the first breakpoint.
82 set test_msg "stopped at bp in reverse, 1st instr"
83 gdb_test_multiple "step" "$test_msg" {
84     -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
85         set stop_addr $expect_out(1,string)
86         if [eval expr "$foo1_addr == $stop_addr"] then {
87             pass "$test_msg"
88         } else {
89             fail "$test_msg (wrong address)"
90         }
91     }
92     -re "Breakpoint $decimal, foo.*$gdb_prompt $" {
93         gdb_test "print \$pc == $foo1_addr" \
94             "$decimal = 1" \
95             "$test_msg"
96     }