]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/disp-step-insn-reloc.exp
Automatic date update in version.in
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / disp-step-insn-reloc.exp
CommitLineData
1d506c26 1# Copyright 2015-2024 Free Software Foundation, Inc.
0fd8ac1c
YQ
2# This program is free software; you can redistribute it and/or modify
3# it under the terms of the GNU General Public License as published by
4# the Free Software Foundation; either version 3 of the License, or
5# (at your option) any later version.
6#
7# This program is distributed in the hope that it will be useful,
8# but WITHOUT ANY WARRANTY; without even the implied warranty of
9# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10# GNU General Public License for more details.
11#
12# You should have received a copy of the GNU General Public License
13# along with this program. If not, see <http://www.gnu.org/licenses/>.
14
15standard_testfile insn-reloc.c
16set executable $testfile
17set expfile $testfile.exp
18
0a7043e0 19require support_displaced_stepping
0fd8ac1c
YQ
20
21# Some targets have leading underscores on assembly symbols.
22set additional_flags [gdb_target_symbol_prefix_flags]
23
5b362f04 24if [prepare_for_testing "failed to prepare" $executable $srcfile \
0fd8ac1c 25 [list debug $additional_flags]] {
0fd8ac1c
YQ
26 return -1
27}
28
29if ![runto_main] {
0fd8ac1c
YQ
30 return -1
31}
32
33# Read function name from testcases[N].
34
35proc read_testcase { n } {
36 global gdb_prompt
37
38 set result -1
39 gdb_test_multiple "print testcases\[${n}\]" "read name of test case ${n}" {
40 -re "\[$\].*= .*<(.*)>.*$gdb_prompt $" {
41 set result $expect_out(1,string)
42 }
43 -re "$gdb_prompt $" { }
44 }
45
46 return $result
47}
48
49set n_testcases [get_integer_valueof "n_testcases" 0]
50if { ${n_testcases} == 0 } {
bc6c7af4 51 untested "no instruction relocation to test"
0fd8ac1c
YQ
52 return 1
53}
54
55# Set a fast tracepoint on each set_point${i} symbol. There is one for
56# each testcase.
57for { set i 0 } { ${i} < ${n_testcases} } { incr i } {
58 set testcase [read_testcase $i]
59
60 gdb_test "break *set_point$i" "Breakpoint .*" "breakpoint on ${testcase}"
61}
62
63gdb_test "break pass" ".*" ""
64gdb_test "break fail" ".*" ""
65
66gdb_test_no_output "set displaced-stepping on"
67
68# Make sure we have hit the pass breakpoint for each testcase.
69for { set i 0 } { ${i} < ${n_testcases} } { incr i } {
70 set testcase [read_testcase $i]
71
72 with_test_prefix "${testcase}" {
73 gdb_test "continue" ".*Breakpoint \[0-9\]+, .*" \
74 "go to breakpoint $i"
75
76 gdb_test "continue" ".*Breakpoint \[0-9\]+, pass \(\).*" \
77 "relocated instruction"
78 }
79}