1 # Copyright (C) 2014-2016 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/>. */
16 if [target_info exists gdb,nosignals] {
17 verbose "Skipping ${testfile}.exp because of nosignals."
23 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
24 executable { debug }] != "" } {
28 # Run test proper. COMMAND indicates whether to resume the inferior
29 # with "signal 0" or "continue".
31 proc test { command } {
32 global srcfile binfile
34 with_test_prefix "$command" {
35 clean_restart ${binfile}
37 if ![runto_main] then {
38 fail "Can't run to main"
42 gdb_test "handle SIGUSR1 stop print pass"
44 gdb_test "continue" "Thread 2 .*received signal SIGUSR1.*" "stop with SIGUSR1"
46 set pattern "\\\* 2\[ \t\]+Thread.*"
48 gdb_test "info threads" $pattern "thread 2 intercepted signal"
50 gdb_test "break handler" "Breakpoint .* at .*$srcfile.*"
52 gdb_test "thread 1" "Switching to thread 1.*"
54 if { $command == "continue" } {
55 gdb_test "continue" "handler .*"
56 } elseif { $command == "signal 0" } {
58 set test "signal 0 queries"
59 gdb_test_multiple "signal 0" $test {
60 -re "stopped with.*stopped with.*Continue anyway.*y or n. $" {
61 fail "$test (multiple threads noted)"
64 -re "stopped with signal SIGUSR1.*\r\nContinuing .*still deliver .*Continue anyway.*y or n. $" {
68 -re "Continue anyway.*y or n. $" {
69 fail "$test (no threads noted)"
75 gdb_test "y" "handler .*" "signal is delivered"
79 gdb_test "info threads" $pattern "thread 2 got the signal"
83 foreach command {"continue" "signal 0"} {