]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/catch-signal-siginfo-cond.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / catch-signal-siginfo-cond.exp
1 # Copyright 2015-2024 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 condition for breakpoint NUM:
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 require {!target_info exists gdb,nosignals}
29
30 require supports_get_siginfo_type
31
32 standard_testfile
33
34 if { [prepare_for_testing "failed to prepare" "${testfile}" $srcfile {debug}] } {
35 return -1
36 }
37
38 if {![runto_main]} {
39 return -1
40 }
41
42 gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
43
44 gdb_test "catch signal"
45
46 # It's OK to refer to standard Unix signal numbers 1-15 by number.
47
48 # SIGUSR1 == 10. The catchpoint should not cause a stop.
49 gdb_test "condition \$bpnum \$_siginfo.si_signo == 11"
50 gdb_test "continue" "set breakpoint here.*" "continue: catchpoint does not trigger"
51
52 # This time the catchpoint should cause a stop.
53 gdb_test "condition \$bpnum \$_siginfo.si_signo == 10"
54 gdb_test "continue" "Catchpoint .*signal SIGUSR1.*" "continue: catchpoint triggers"