| OLD | NEW |
| 1 # Copyright (C) 2008-2012 Free Software Foundation, Inc. | 1 # Copyright (C) 2008-2012 Free Software Foundation, Inc. |
| 2 | 2 |
| 3 # This program is free software; you can redistribute it and/or modify | 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 | 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 | 5 # the Free Software Foundation; either version 3 of the License, or |
| 6 # (at your option) any later version. | 6 # (at your option) any later version. |
| 7 # | 7 # |
| 8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
| 12 # | 12 # |
| 13 # You should have received a copy of the GNU General Public License | 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/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | 15 |
| 16 # Only GNU/Linux is known to support `set follow-fork-mode child'. | 16 # Only GNU/Linux is known to support `set follow-fork-mode child'. |
| 17 if { ! [istarget "*-*-linux*"] } { | 17 if { ! [istarget "*-*-linux*"] } { |
| 18 return 0 | 18 return 0 |
| 19 } | 19 } |
| 20 | 20 |
| 21 if { [is_remote target] || ![isnative] } then { | 21 if { [is_remote target] || ![isnative] } then { |
| 22 return 0 | 22 return 0 |
| 23 } | 23 } |
| 24 | 24 |
| 25 set testfile fork-child-threads | 25 standard_testfile |
| 26 set srcfile ${testfile}.c | |
| 27 set binfile ${objdir}/${subdir}/${testfile} | |
| 28 | 26 |
| 29 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
le {debug}] != "" } { | 27 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
le {debug}] != "" } { |
| 30 return -1 | 28 return -1 |
| 31 } | 29 } |
| 32 | 30 |
| 33 gdb_exit | 31 clean_restart ${binfile} |
| 34 gdb_start | |
| 35 gdb_reinitialize_dir $srcdir/$subdir | |
| 36 | 32 |
| 37 gdb_load ${binfile} | |
| 38 if ![runto_main] then { | 33 if ![runto_main] then { |
| 39 fail "Can't run to main" | 34 fail "Can't run to main" |
| 40 return 0 | 35 return 0 |
| 41 } | 36 } |
| 42 | 37 |
| 43 gdb_test "set follow-fork-mode child" | 38 gdb_test "set follow-fork-mode child" |
| 44 gdb_breakpoint "start" | 39 gdb_breakpoint "start" |
| 45 | 40 |
| 46 # Make sure we can step over fork without losing our breakpoint. | 41 # Make sure we can step over fork without losing our breakpoint. |
| 47 gdb_test "next" ".*pthread_create \\(&thread, NULL, start, NULL\\);.*" "next ove
r fork" | 42 gdb_test "next" ".*pthread_create \\(&thread, NULL, start, NULL\\);.*" "next ove
r fork" |
| 48 | 43 |
| 49 gdb_test "continue" "Breakpoint 2, start.*" "get to the spawned thread" | 44 gdb_test "continue" "Breakpoint 2, start.*" "get to the spawned thread" |
| 50 | 45 |
| 51 # Wrong: | 46 # Wrong: |
| 52 # * 2 LWP 4466 start (arg=0x0) at fork-child-threads.c:28 | 47 # * 2 LWP 4466 start (arg=0x0) at fork-child-threads.c:28 |
| 53 # Correct: | 48 # Correct: |
| 54 # * 3 Thread 0x40a00950 (LWP 5553) start (arg=0x0) at ../.././gdb/testsuite/gdb
.threads/fork-child-threads.c:28 | 49 # * 3 Thread 0x40a00950 (LWP 5553) start (arg=0x0) at ../.././gdb/testsuite/gdb
.threads/fork-child-threads.c:28 |
| 55 # 2 Thread 0x2aaaaaac3000 (LWP 5552) 0x00000031674076dd in pthread_join (thre
adid=<optimized out>, thread_return=<optimized out>) at pthread_join.c:89 | 50 # 2 Thread 0x2aaaaaac3000 (LWP 5552) 0x00000031674076dd in pthread_join (thre
adid=<optimized out>, thread_return=<optimized out>) at pthread_join.c:89 |
| 56 | 51 |
| 57 gdb_test "info threads" " Thread .* Thread .*" "two threads found" | 52 gdb_test "info threads" " Thread .* Thread .*" "two threads found" |
| OLD | NEW |