]>
Commit | Line | Data |
---|---|---|
3a58abaf AM |
1 | diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.base/tracefork-zombie.exp gdb-6.3/gdb/testsuite/gdb.base/tracefork-zombie.exp |
2 | --- gdb-6.3-unpatched/gdb/testsuite/gdb.base/tracefork-zombie.exp 1969-12-31 19:00:00.000000000 -0500 | |
3 | +++ gdb-6.3/gdb/testsuite/gdb.base/tracefork-zombie.exp 2007-07-31 13:04:12.000000000 -0400 | |
4 | @@ -0,0 +1,82 @@ | |
5 | +# Copyright 2007 Free Software Foundation, Inc. | |
6 | + | |
7 | +# This program is free software; you can redistribute it and/or modify | |
8 | +# it under the terms of the GNU General Public License as published by | |
9 | +# the Free Software Foundation; either version 2 of the License, or | |
10 | +# (at your option) any later version. | |
11 | +# | |
12 | +# This program is distributed in the hope that it will be useful, | |
13 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | +# GNU General Public License for more details. | |
16 | +# | |
17 | +# You should have received a copy of the GNU General Public License | |
18 | +# along with this program; if not, write to the Free Software | |
19 | +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
20 | + | |
21 | +if $tracelevel then { | |
22 | + strace $tracelevel | |
23 | +} | |
24 | + | |
25 | +set prms_id 0 | |
26 | +set bug_id 0 | |
27 | + | |
28 | +# are we on a target board | |
29 | +if [is_remote target] then { | |
30 | + return 0 | |
31 | +} | |
32 | + | |
33 | +# Start the program running and then wait for a bit, to be sure | |
34 | +# that it can be attached to. | |
35 | + | |
36 | +gdb_exit | |
37 | +gdb_start | |
38 | +gdb_load sleep | |
39 | + | |
40 | +set gdb_pid [exp_pid -i [board_info host fileid]] | |
41 | +set test "identified the child GDB" | |
42 | +if {$gdb_pid != "" && $gdb_pid > 0} { | |
43 | + pass $test | |
44 | + verbose -log "Child GDB PID $gdb_pid" | |
45 | +} else { | |
46 | + fail $test | |
47 | +} | |
48 | + | |
49 | +set testpid [eval exec sleep 10 &] | |
50 | +exec sleep 2 | |
51 | + | |
52 | +set test "attach" | |
53 | +gdb_test_multiple "attach $testpid" "$test" { | |
54 | + -re "Attaching to program.*`?.*'?, process $testpid..*$gdb_prompt $" { | |
55 | + pass "$test" | |
56 | + } | |
57 | + -re "Attaching to program.*`?.*\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" { | |
58 | + # Response expected on Cygwin | |
59 | + pass "$test" | |
60 | + } | |
61 | +} | |
62 | + | |
63 | +# Some time to let GDB spawn its testing child. | |
64 | +exec sleep 2 | |
65 | + | |
66 | +set found none | |
67 | +foreach procpid [glob -directory /proc -type d {[0-9]*}] { | |
68 | + if {[catch {open $procpid/status} statusfi]} { | |
69 | + continue | |
70 | + } | |
71 | + set status [read $statusfi] | |
72 | + close $statusfi | |
73 | + if {1 | |
74 | + && [regexp -line {^Name:\tgdb$} $status] | |
75 | + && [regexp -line {^PPid:\t1$} $status] | |
76 | + && [regexp -line "^TracerPid:\t$gdb_pid$" $status]} { | |
77 | + set found $procpid | |
78 | + verbose -log "Found linux_test_for_tracefork zombie PID $procpid" | |
79 | + } | |
80 | +} | |
81 | +set test "linux_test_for_tracefork leaves no zombie" | |
82 | +if {$found eq {none}} { | |
83 | + pass $test | |
84 | +} else { | |
85 | + fail $test | |
86 | +} |