]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.reverse / step-indirect-call-thunk.exp
CommitLineData
1d506c26 1# Copyright 2018-2024 Free Software Foundation, Inc.
1d509aa6
MM
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
5954db83 16require supports_reverse
1d509aa6 17
2ef339e3
TV
18require {istarget "x86*"}
19
1d509aa6
MM
20standard_testfile
21
d6246a87
TV
22set cflags {}
23lappend cflags debug
24lappend cflags additional_flags=-mindirect-branch=thunk
25lappend cflags additional_flags=-mfunction-return=thunk
26
27set fcf_protection_none additional_flags=-fcf-protection=none
28if { [gdb_can_simple_compile fcf-protection-none {int main () { return 0; }} \
29 executable $fcf_protection_none] } {
30 lappend cflags $fcf_protection_none
31}
32
33if { [prepare_for_testing "failed to prepare" $testfile $srcfile $cflags] } {
1d509aa6
MM
34 return -1
35}
36
37if { ![runto_main] } {
1d509aa6
MM
38 return -1
39}
40
1d509aa6
MM
41gdb_test_no_output "record"
42gdb_test "next" ".*" "record trace"
43
44# Normal stepping steps through all thunks.
45gdb_test "reverse-step" "apply\.3.*" "reverse-step into apply"
46gdb_test "reverse-step" "inc\.3.*" "reverse-step into inc"
47gdb_test "reverse-step" "inc\.2.*" "reverse-step inside inc"
48gdb_test "reverse-step" "apply\.2.*" \
4d421147 49 "reverse-step through call thunk into apply, first time"
1d509aa6
MM
50gdb_test "reverse-step" "main\.2.*" "reverse-step into main"
51gdb_test "step" "apply\.2.*" "step into apply"
52gdb_test "step" "inc\.2.*" "step through call thunk into inc"
53gdb_test "reverse-step" "apply\.2.*" \
4d421147 54 "reverse-step through call thunk into apply, second time"
1d509aa6
MM
55gdb_test "next" "apply\.3.*" "step through thunks and over inc"
56gdb_test "reverse-next" "apply\.2.*" \
57 "reverse-step through thunks and over inc"
58
59# We can use instruction stepping to step into thunks.
334d405c
CL
60repeat_cmd_until "stepi" "apply\.2" "indirect_thunk" "stepi into call thunk"
61repeat_cmd_until "stepi" "indirect_thunk" "inc" \
1d509aa6 62 "stepi out of call thunk into inc"
c47860a4
TV
63set alphanum_re "\[a-zA-Z0-9\]"
64set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)"
334d405c
CL
65repeat_cmd_until "stepi" "(inc|$pic_thunk_re)" "return_thunk" "stepi into return thunk"
66repeat_cmd_until "stepi" "return_thunk" "apply" \
1d509aa6
MM
67 "stepi out of return thunk back into apply"
68
334d405c 69repeat_cmd_until "reverse-stepi" "apply" "return_thunk" \
1d509aa6 70 "reverse-stepi into return thunk"
334d405c 71repeat_cmd_until "reverse-stepi" "return_thunk" "inc" \
1d509aa6 72 "reverse-stepi out of return thunk into inc"
334d405c 73repeat_cmd_until "reverse-stepi" "(inc|$pic_thunk_re)" "indirect_thunk" \
1d509aa6 74 "reverse-stepi into call thunk"
334d405c 75repeat_cmd_until "reverse-stepi" "indirect_thunk" "apply" \
1d509aa6 76 "reverse-stepi out of call thunk into apply"