1283625Sdim# Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
2283625Sdim
3283625Sdim# This program is free software; you can redistribute it and/or modify
4283625Sdim# it under the terms of the GNU General Public License as published by
5283625Sdim# the Free Software Foundation; either version 3 of the License, or
6283625Sdim# (at your option) any later version.
7283625Sdim#
8283625Sdim# This program is distributed in the hope that it will be useful,
9283625Sdim# but WITHOUT ANY WARRANTY; without even the implied warranty of
10283625Sdim# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11283625Sdim# GNU General Public License for more details.
12283625Sdim#
13283625Sdim# You should have received a copy of the GNU General Public License
14283625Sdim# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15283625Sdim
16283625Sdim# Check that GDB isn't messing the SIGCHLD mask while creating an
17283625Sdim# inferior.
18283625Sdim
19283625Sdimif [target_info exists gdb,nosignals] {
20283625Sdim    verbose "Skipping sigchld.exp because of nosignals."
21283625Sdim    continue
22283625Sdim}
23283625Sdim
24283625Sdimset testfile "sigchld"
25283625Sdimset srcfile ${testfile}.c
26283625Sdimset binfile ${objdir}/${subdir}/${testfile}
27283625Sdim
28283625Sdimif {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
29283625Sdim    return -1
30283625Sdim}
31283625Sdim
32283625Sdimgdb_exit
33283625Sdimgdb_start
34283625Sdimgdb_reinitialize_dir $srcdir/$subdir
35283625Sdimgdb_load ${binfile}
36314564Sdim
37283625Sdimrunto_main
38283625Sdim
39283625Sdimgdb_test "b [gdb_get_line_number "good, not blocked"]" \
40283625Sdim         ".*Breakpoint .*sigchld.*" "set breakpoint at success exit"
41283625Sdim
42283625Sdimgdb_test "b [gdb_get_line_number "bad, blocked"]" \
43283625Sdim         ".*Breakpoint .*sigchld.*" "set breakpoint at failure exit"
44283625Sdim
45283625Sdimgdb_test "continue" ".*good, not blocked.*" "SIGCHLD blocked in inferior"
46283625Sdim