]>
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 | # Testing handle setup together with boundary violation signals. | |
19 | # | |
20 | # Some states are not allowed as reported on the manual, as noprint | |
21 | # implies nostop, but nostop might print. | |
22 | # | |
23 | # Caveat: Setting the handle to nopass, ends up in a endless loop. | |
24 | ||
c7ccb471 | 25 | require {is_any_target i?86-*-* x86_64-*-*} |
012b3a21 WT |
26 | |
27 | standard_testfile | |
28 | ||
73c06197 | 29 | require supports_mpx_check_pointer_bounds have_mpx |
3f94e588 | 30 | |
012b3a21 WT |
31 | set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat/" |
32 | ||
5b362f04 | 33 | if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ |
012b3a21 WT |
34 | [list debug nowarnings additional_flags=${comp_flags}]] } { |
35 | return -1 | |
36 | } | |
37 | ||
38 | if ![runto_main] { | |
012b3a21 WT |
39 | return -1 |
40 | } | |
41 | ||
012b3a21 WT |
42 | set violation [multi_line "Program received signal SIGSEGV, Segmentation fault" \ |
43 | "Upper bound violation while accessing address $hex" \ | |
44 | "Bounds: \\\[lower = $hex, upper = $hex\\\]"] | |
45 | ||
46 | set segv_with_exit "Program received signal SIGSEGV,\ | |
47 | Segmentation fault.*$inferior_exited_re.*" | |
48 | ||
49 | ||
50 | # Test handler for segmentation fault for: | |
51 | # print pass stop | |
52 | # | |
53 | set parameters "print pass stop" | |
54 | with_test_prefix "$parameters" { | |
55 | if ![runto_main] { | |
012b3a21 WT |
56 | return -1 |
57 | } | |
58 | ||
59 | gdb_test "handle SIGSEGV $parameters"\ | |
60 | ".*SIGSEGV.*Yes.*Yes.*Yes.*Segmentation fault.*"\ | |
61 | "set parameters" | |
62 | ||
cdc7edd7 | 63 | gdb_test "continue" ".*$violation.*" "display" |
012b3a21 WT |
64 | |
65 | gdb_test "where" ".*#0 $hex in upper.*"\ | |
66 | "should be in upper" | |
67 | } | |
68 | ||
69 | # Test handler for segmentation fault for: | |
70 | # print pass nostop | |
71 | # | |
72 | set parameters "print pass nostop" | |
73 | with_test_prefix "$parameters" { | |
74 | if ![runto_main] { | |
012b3a21 WT |
75 | return -1 |
76 | } | |
77 | ||
78 | gdb_test "handle SIGSEGV $parameters"\ | |
79 | ".*SIGSEGV.*No.*Yes.*Yes.*Segmentation fault.*"\ | |
80 | "set parameters" | |
81 | ||
cdc7edd7 | 82 | gdb_test "continue" ".*$segv_with_exit.*" "display" |
012b3a21 WT |
83 | |
84 | gdb_test "where" "No stack." "no inferior" | |
85 | } | |
86 | ||
87 | # Test handler for segmentation fault for: | |
88 | # print nopass stop | |
89 | # | |
90 | set parameters "print nopass stop" | |
91 | with_test_prefix "$parameters" { | |
92 | if ![runto_main] { | |
012b3a21 WT |
93 | return -1 |
94 | } | |
95 | ||
96 | gdb_test "handle SIGSEGV $parameters"\ | |
97 | ".*SIGSEGV.*Yes.*Yes.*No.*Segmentation fault.*"\ | |
98 | "set parameters" | |
99 | ||
cdc7edd7 | 100 | gdb_test "continue" ".*$violation.*" "display" |
012b3a21 WT |
101 | |
102 | gdb_test "where" ".*#0 $hex in upper.*"\ | |
103 | "should be in upper" | |
104 | } | |
105 | ||
106 | # Test handler for segmentation fault for: | |
107 | # print nopass stop | |
108 | # | |
109 | set parameters "noprint pass nostop" | |
110 | with_test_prefix "$parameters" { | |
111 | if ![runto_main] { | |
012b3a21 WT |
112 | return -1 |
113 | } | |
114 | ||
115 | gdb_test "handle SIGSEGV $parameters"\ | |
116 | ".*SIGSEGV.*No.*No.*Yes.*Segmentation fault.*"\ | |
117 | "set parameters" | |
118 | ||
119 | gdb_test "continue" "Continuing\..*$inferior_exited_re.*"\ | |
120 | "Display" | |
121 | ||
122 | gdb_test "where" "No stack." "no inferior" | |
123 | } | |
124 |