gdb: move displaced stepping logic to gdbarch, allow starting concurrent displaced...
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.arch / riscv-bp-infcall.exp
1 # Copyright 2019-2020 Free Software Foundation, Inc.
2 #
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.
7 #
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.
12 #
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/>.
15
16 # Test GDB for RISC-V always uses an uncompressed breakpoint when
17 # setting up for an inferior call.
18
19 if {![istarget "riscv*-*-*"]} {
20 verbose "Skipping ${gdb_test_file_name}."
21 return
22 }
23
24 standard_testfile
25
26 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
27 return -1
28 }
29
30 if ![runto_main] then {
31 fail "can't run to main"
32 return 0
33 }
34
35 # Figure out where the breakpoint will be placed taking account for
36 # stack alignment, and allocation of the dummy code area.
37 set bp_addr [get_valueof "/x" "\$sp" 0]
38 set bp_addr [format 0x%x [expr ($bp_addr & ~0xf) - 0x20]]
39
40 # Fill the region we know will be used as the scratch area with the
41 # compressed nop instruction. If GDB fails to overwrite this with an
42 # uncompressed nop then a compressed breakpoint will be used in the
43 # following inferior call.
44 for {set i 0} {$i < 16} {incr i 2} {
45 gdb_test_no_output "set *((unsigned short *) (${bp_addr} + $i))=0x1" \
46 "place compressed nop in scratch area at offset $i"
47 }
48
49 # Make an inferior call. GDB should write an uncompressed nop into
50 # the scratch area and so force the use of an uncompressed breakpoint,
51 # however, if this mechanism fails and GDB uses a compressed
52 # breakpoint, and the target doesn't support compressed instructions,
53 # then we would expect weird things to happen here.
54 gdb_test_no_output "set debug riscv breakpoints 1"
55 gdb_test "call dummy_call ()" \
56 ".*Using EBREAK for breakpoint at $bp_addr \\(instruction length 4\\).*"
This page took 0.030847 seconds and 4 git commands to generate.