Commit | Line | Data |
---|---|---|
30852783 UW |
1 | # This testcase is part of GDB, the GNU debugger. |
2 | ||
b811d2c2 | 3 | # Copyright 2011-2020 Free Software Foundation, Inc. |
30852783 UW |
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 | ||
0ab77f5f | 18 | standard_testfile |
30852783 UW |
19 | |
20 | if [target_info exists gdb,nosignals] { | |
21 | verbose "Skipping ${testfile}.exp because of nosignals." | |
22 | return -1 | |
23 | } | |
24 | ||
5b362f04 | 25 | if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] { |
30852783 UW |
26 | return -1 |
27 | } | |
28 | ||
29 | if ![runto_main] then { | |
5b362f04 | 30 | untested "could not run to main" |
30852783 UW |
31 | return -1 |
32 | } | |
33 | ||
34 | # If we can examine what's at memory address 0, it is possible that we | |
35 | # could also execute it. This could probably make us run away, | |
36 | # executing random code, which could have all sorts of ill effects, | |
37 | # especially on targets without an MMU. Don't run the tests in that | |
38 | # case. | |
39 | ||
20c6f1e1 | 40 | if { [is_address_zero_readable] } { |
bc6c7af4 | 41 | untested "memory at address 0 is possibly executable" |
20c6f1e1 | 42 | return -1 |
30852783 UW |
43 | } |
44 | ||
45 | # Run until we hit the SIGSEGV (or SIGBUS on some platforms). | |
46 | gdb_test "continue" \ | |
47 | ".*Program received signal (SIGBUS|SIGSEGV).*bowler.*" \ | |
48 | "continue to fault" | |
49 | ||
50 | # Insert conditional breakpoint at faulting instruction | |
51 | gdb_test "break if 0" ".*" "set conditional breakpoint" | |
52 | ||
53 | # Set SIGSEGV/SIGBUS to pass+nostop | |
54 | gdb_test "handle SIGSEGV nostop print pass" ".*" "pass SIGSEGV" | |
55 | gdb_test "handle SIGBUS nostop print pass" ".*" "pass SIGBUS" | |
56 | ||
57 | # Step off the faulting instruction into the handler, triggering nested faults | |
58 | gdb_test "continue" \ | |
59 | ".*Program received signal (SIGBUS|SIGSEGV).*Program received signal (SIGBUS|SIGSEGV).*exited normally.*" \ | |
60 | "run through nested faults" | |
61 |