1# Copyright 2015-2023 Free Software Foundation, Inc. 2 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; either version 3 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16# Regression test for PR19388. Make sure we can access $_siginfo in a 17# "catch signal" condition. A buggy GDB would fail with: 18# 19# (gdb) continue 20# Continuing. 21# Error in testing breakpoint condition: 22# Selected thread is running. 23# 24# Catchpoint 3 (signal SIGUSR1), 0x0000003615e35877 in __GI_raise (sig=10) at raise.c:56 25# 56 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig); 26# (gdb) FAIL: gdb.base/catch-signal-siginfo-cond.exp: continue 27 28if [target_info exists gdb,nosignals] { 29 verbose "Skipping catch-signal-siginfo-cond.exp because of nosignals." 30 return -1 31} 32 33if { ![supports_get_siginfo_type] } { 34 verbose "Skipping catch-signal-siginfo-cond.exp because of lack of support." 35 return -1 36} 37 38standard_testfile 39 40if { [prepare_for_testing "failed to prepare" "${testfile}" $srcfile {debug}] } { 41 return -1 42} 43 44if {![runto_main]} { 45 return -1 46} 47 48gdb_breakpoint [gdb_get_line_number "set breakpoint here"] 49 50gdb_test "catch signal" 51 52# It's OK to refer to standard Unix signal numbers 1-15 by number. 53 54# SIGUSR1 == 10. The catchpoint should not cause a stop. 55gdb_test "condition \$bpnum \$_siginfo.si_signo == 11" 56gdb_test "continue" "set breakpoint here.*" "continue: catchpoint does not trigger" 57 58# This time the catchpoint should cause a stop. 59gdb_test "condition \$bpnum \$_siginfo.si_signo == 10" 60gdb_test "continue" "Catchpoint .*signal SIGUSR1.*" "continue: catchpoint triggers" 61