1 # Copyright 2015-2019 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Regression test for PR19388. Make sure we can access $_siginfo in a
17 # "catch signal" condition. A buggy GDB would fail with:
21 # Error in testing breakpoint condition:
22 # Selected thread is running.
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
28 if [target_info exists gdb,nosignals] {
29 verbose "Skipping catch-signal-siginfo-cond.exp because of nosignals."
33 if { ![supports_get_siginfo_type] } {
34 verbose "Skipping catch-signal-siginfo-cond.exp because of lack of support."
40 if { [prepare_for_testing "failed to prepare" "${testfile}" $srcfile {debug}] } {
44 if ![runto_main] then {
45 fail "can't run to main"
49 gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
51 gdb_test "catch signal"
53 # It's OK to refer to standard Unix signal numbers 1-15 by number.
55 # SIGUSR1 == 10. The catchpoint should not cause a stop.
56 gdb_test "condition \$bpnum \$_siginfo.si_signo == 11"
57 gdb_test "continue" "set breakpoint here.*" "continue: catchpoint does not trigger"
59 # This time the catchpoint should cause a stop.
60 gdb_test "condition \$bpnum \$_siginfo.si_signo == 10"
61 gdb_test "continue" "Catchpoint .*signal SIGUSR1.*" "continue: catchpoint triggers"