]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright (C) 2015-2024 Free Software Foundation, Inc. |
012b3a21 WT |
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 | ||
c7ccb471 | 19 | require {is_any_target "i?86-*-*" "x86_64-*-*"} |
012b3a21 WT |
20 | |
21 | standard_testfile | |
22 | ||
73c06197 | 23 | require supports_mpx_check_pointer_bounds have_mpx |
3f94e588 | 24 | |
012b3a21 WT |
25 | set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat/" |
26 | ||
5b362f04 | 27 | if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ |
012b3a21 WT |
28 | [list debug nowarnings additional_flags=${comp_flags}]] } { |
29 | return -1 | |
30 | } | |
31 | ||
32 | if ![runto_main] { | |
012b3a21 WT |
33 | return -1 |
34 | } | |
35 | ||
012b3a21 WT |
36 | set u_fault [multi_line "Program received signal SIGSEGV, Segmentation fault" \ |
37 | "Upper bound violation while accessing address $hex" \ | |
38 | "Bounds: \\\[lower = $hex, upper = $hex\\\]"] | |
39 | ||
40 | set l_fault [multi_line "Program received signal SIGSEGV, Segmentation fault" \ | |
41 | "Lower bound violation while accessing address $hex" \ | |
42 | "Bounds: \\\[lower = $hex, upper = $hex\\\]"] | |
43 | ||
44 | for {set i 0} {$i < 15} {incr i} { | |
45 | set message "MPX signal segv Upper: ${i}" | |
46 | ||
47 | if {[gdb_test "continue" "$u_fault.*" $message] != 0} { | |
48 | break | |
49 | } | |
50 | ||
51 | gdb_test "where" ".*#0 $hex in upper.*"\ | |
52 | "$message: should be in upper" | |
53 | } | |
54 | ||
55 | for {set i 0} {$i < 15} {incr i} { | |
56 | set message "MPX signal segv Lower: ${i}" | |
57 | ||
58 | if {[gdb_test "continue" "$l_fault.*" $message] != 0} { | |
59 | break | |
60 | } | |
61 | ||
62 | gdb_test "where" ".*#0 $hex in lower.*"\ | |
63 | "$message: should be in lower" | |
64 | } |