1 # This testcase is part of GDB, the GNU debugger.
3 # Copyright 2011-2024 Free Software Foundation, Inc.
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.
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.
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/>.
20 require {!target_info exists gdb,nosignals}
22 if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] {
30 # If we can examine what's at memory address 0, it is possible that we
31 # could also execute it. This could probably make us run away,
32 # executing random code, which could have all sorts of ill effects,
33 # especially on targets without an MMU. Don't run the tests in that
36 if { [is_address_zero_readable] } {
37 untested "memory at address 0 is possibly executable"
41 # Run until we hit the SIGSEGV (or SIGBUS on some platforms).
43 ".*Program received signal (SIGBUS|SIGSEGV).*bowler.*" \
46 # Insert conditional breakpoint at faulting instruction
47 gdb_test "break if 0" ".*" "set conditional breakpoint"
49 # Set SIGSEGV/SIGBUS to pass+nostop
50 gdb_test "handle SIGSEGV nostop print pass" ".*" "pass SIGSEGV"
51 gdb_test "handle SIGBUS nostop print pass" ".*" "pass SIGBUS"
53 # Step off the faulting instruction into the handler, triggering nested faults
55 ".*Program received signal (SIGBUS|SIGSEGV).*Program received signal (SIGBUS|SIGSEGV).*exited normally.*" \
56 "run through nested faults"