Update copyright year range in header of all files managed by GDB
[binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-prologue-skip-cf-protection.exp
blob3d12c2086f5255f10ee2434e001a398e1564946c
1 # Copyright 2020-2023 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 # Test skipping a prologue that was generated with gcc's -fcf-protection=full
17 # (control flow protection) option.
19 # This option places an `endbr32`/`endbr64` instruction at the start of
20 # all functions, which can interfere with prologue analysis.
22 standard_testfile .c
23 set binfile ${binfile}
25 if { ![istarget x86_64-*-*] && ![istarget i?86-*-*] } {
26     verbose "Skipping ${testfile}."
27     return
30 if { ![supports_fcf_protection] } {
31     untested "-fcf-protection not supported"
32     return
35 set opts {debug additional_flags=-fcf-protection=full}
37 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $opts] != "" } {
38     untested "failed to compile"
39     return
42 clean_restart ${binfile}
44 # Get start address of function main.
45 set main_addr [get_integer_valueof &main -1]
46 gdb_assert {$main_addr != -1}
48 set bp_addr -1
50 # Put breakpoint on main, get the address where the breakpoint was installed.
51 gdb_test_multiple "break -q main" "break on main, get address" {
52     -re -wrap "Breakpoint $decimal at ($hex).*" {
53         set bp_addr $expect_out(1,string)
55         # Convert to decimal.
56         set bp_addr [expr $bp_addr]
58         pass $gdb_test_name
59     }
62 if { $bp_addr != -1 } {
63     # Make sure some prologue was skipped.
64     gdb_assert {$bp_addr > $main_addr}