1 # Copyright (C) 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/>.
16 # This test verifies that threads created by the child fork are
17 # properly handled. Specifically, GDB used to have a bug where it
18 # would leave child fork threads stuck stopped, even though "info
19 # threads" would show them running.
21 # See https://sourceware.org/bugzilla/show_bug.cgi?id=18600
25 proc do_test { detach_on_fork } {
27 global srcfile testfile
30 set saved_gdbflags $GDBFLAGS
31 set GDBFLAGS [concat $GDBFLAGS " -ex \"set non-stop on\""]
33 if {[prepare_for_testing "failed to prepare" \
34 $testfile $srcfile {debug pthreads}] == -1} {
35 set GDBFLAGS $saved_gdbflags
39 set GDBFLAGS $saved_gdbflags
41 if ![runto_main] then {
42 fail "Can't run to main"
46 gdb_test_no_output "set detach-on-fork $detach_on_fork"
48 gdb_test_multiple $test $test {
54 set test "inferior 1 exited"
55 gdb_test_multiple "" $test {
56 -re "Inferior 1 \(\[^\r\n\]+\) exited normally" {
61 gdb_test "info threads" "No threads\." \
65 foreach detach_on_fork {"on" "off"} {
66 with_test_prefix "detach-on-fork=$detach_on_fork" {
67 do_test $detach_on_fork