]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.arch/i386-mpx-sigsegv.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-mpx-sigsegv.exp
1 # Copyright (C) 2015-2023 Free Software Foundation, Inc.
2 #
3 # Contributed by Intel Corp. <walfred.tedeschi@intel.com>
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18
19 if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
20 verbose "Skipping x86 MPX tests."
21 return
22 }
23
24 standard_testfile
25
26 if { ![supports_mpx_check_pointer_bounds] } {
27 return -1
28 }
29
30 if { ![have_mpx] } {
31 unsupported "processor does not support MPX"
32 return -1
33 }
34
35 set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat/"
36
37 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
38 [list debug nowarnings additional_flags=${comp_flags}]] } {
39 return -1
40 }
41
42 if ![runto_main] {
43 return -1
44 }
45
46 set u_fault [multi_line "Program received signal SIGSEGV, Segmentation fault" \
47 "Upper bound violation while accessing address $hex" \
48 "Bounds: \\\[lower = $hex, upper = $hex\\\]"]
49
50 set l_fault [multi_line "Program received signal SIGSEGV, Segmentation fault" \
51 "Lower bound violation while accessing address $hex" \
52 "Bounds: \\\[lower = $hex, upper = $hex\\\]"]
53
54 for {set i 0} {$i < 15} {incr i} {
55 set message "MPX signal segv Upper: ${i}"
56
57 if {[gdb_test "continue" "$u_fault.*" $message] != 0} {
58 break
59 }
60
61 gdb_test "where" ".*#0 $hex in upper.*"\
62 "$message: should be in upper"
63 }
64
65 for {set i 0} {$i < 15} {incr i} {
66 set message "MPX signal segv Lower: ${i}"
67
68 if {[gdb_test "continue" "$l_fault.*" $message] != 0} {
69 break
70 }
71
72 gdb_test "where" ".*#0 $hex in lower.*"\
73 "$message: should be in lower"
74 }