Implement pahole-like 'ptype /o' option
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / catch-signal-siginfo-cond.exp
CommitLineData
61baf725 1# Copyright 2015-2017 Free Software Foundation, Inc.
a911d87a
PA
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] then {
bc6c7af4 45 fail "can't run to main"
a911d87a
PA
46 return -1
47}
48
49gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
50
51gdb_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.
56gdb_test "condition \$bpnum \$_siginfo.si_signo == 11"
57gdb_test "continue" "set breakpoint here.*" "continue: catchpoint does not trigger"
58
59# This time the catchpoint should cause a stop.
60gdb_test "condition \$bpnum \$_siginfo.si_signo == 10"
61gdb_test "continue" "Catchpoint .*signal SIGUSR1.*" "continue: catchpoint triggers"
This page took 0.238188 seconds and 4 git commands to generate.