1 # Copyright 2010-2015 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/>.
17 set executable ${testfile}
19 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" \
22 [list debug additional_flags=-lrt]] != "" } {
26 clean_restart $testfile
32 # `nostop noprint pass' could in some cases report false PASS due to
33 # the (preempt 'handle') code path in linux-nat.c.
35 gdb_test "handle SIGUSR1 stop print pass" \
36 "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\nSIGUSR1\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*"
37 gdb_test "handle SIGUSR2 stop print pass" \
38 "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\nSIGUSR2\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*"
40 gdb_breakpoint [gdb_get_line_number "break-at-exit"]
43 gdb_test_multiple "p getpid ()" $test {
44 -re " = (\[0-9\]+)\r\n$gdb_prompt $" {
45 set pid $expect_out(1,string)
50 for {set sigcount 0} {$sigcount < 4} {incr sigcount} {
51 set test "catch signal $sigcount"
53 gdb_test_multiple "continue" $test {
54 -re "Program received signal SIGUSR(\[12\]), User defined signal \[12\]\\.\r\n.*\r\n$gdb_prompt $" {
55 set sigusr $expect_out(1,string)
63 set test "signal $sigcount si_signo"
69 gdb_test_multiple {p $_siginfo.si_signo} $test {
70 -re " = $signo\r\n$gdb_prompt $" {
73 -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
78 set test "signal $sigcount si_code is SI_TKILL"
79 gdb_test_multiple {p $_siginfo.si_code} $test {
80 -re " = -6\r\n$gdb_prompt $" {
83 -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
88 set test "signal $sigcount si_pid"
89 gdb_test_multiple {p $_siginfo._sifields._kill.si_pid} $test {
90 -re " = $pid\r\n$gdb_prompt $" {
93 -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
99 gdb_continue_to_breakpoint break-at-exit ".*break-at-exit.*"