]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/catch-gdb-caused-signals.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / catch-gdb-caused-signals.exp
CommitLineData
c9587f88
AT
1# This testcase is part of GDB, the GNU debugger.
2
1d506c26 3# Copyright 2015-2024 Free Software Foundation, Inc.
c9587f88
AT
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# Test that checks if we handle a SIGSEGV,SIGILL caused by gdb in the inferior
19# even if we have noprint,nostop options set in handle SIGSEV,SIGILL
20# See PR breakpoints/16812
21
22standard_testfile
23
24# Some targets can't call functions, so don't even bother with this
25# test.
450d26c8 26require {!target_info exists gdb,cannot_call_functions}
c9587f88
AT
27
28set dp_location [gdb_get_line_number "set dprintf here"]
29set bp_location [gdb_get_line_number "set breakpoint here"]
30
d1de9f5c
TV
31set flags {}
32lappend flags debug
33lappend_include_file flags $srcdir/lib/unbuffer_output.c
34
35if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} {
c9587f88
AT
36 return -1
37}
38
39if ![runto_main] {
c9587f88
AT
40 return -1
41}
42
43gdb_test "handle SIGSEGV nostop noprint" \
44 "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\nSIGSEGV\[ \t\]+No\[ \t\]+No\[ \t\]+Yes\[ \t\].*"
45gdb_test "handle SIGILL nostop noprint" \
46 "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\nSIGILL\[ \t\]+No\[ \t\]+No\[ \t\]+Yes\[ \t\].*"
47
48gdb_test "print return_one()" " = 1"
49
50if ![target_info exists gdb,noinferiorio] {
51
52 # Clean up the breakpoint state.
53 delete_breakpoints
54
55 gdb_breakpoint $bp_location
56
57 gdb_test_no_output "set dprintf-style call"
58
59 # Also test with dprintf since the original bug was noticed using dprintf.
60 gdb_test "dprintf $dp_location,\"testdprintf\\n\"" "Dprintf .*"
61
2051d61f 62 gdb_test_stdio "continue" "testdprintf"
c9587f88 63}