]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/catch-signal-siginfo-cond.exp
Update copyright year range in all GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / catch-signal-siginfo-cond.exp
1 # Copyright 2015-2018 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
28 if [target_info exists gdb,nosignals] {
29 verbose "Skipping catch-signal-siginfo-cond.exp because of nosignals."
30 return -1
31 }
32
33 if { ![supports_get_siginfo_type] } {
34 verbose "Skipping catch-signal-siginfo-cond.exp because of lack of support."
35 return -1
36 }
37
38 standard_testfile
39
40 if { [prepare_for_testing "failed to prepare" "${testfile}" $srcfile {debug}] } {
41 return -1
42 }
43
44 if ![runto_main] then {
45 fail "can't run to main"
46 return -1
47 }
48
49 gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
50
51 gdb_test "catch signal"
52
53 # It's OK to refer to standard Unix signal numbers 1-15 by number.
54
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"
58
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"