|
|
861f93 |
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.base/tracefork-zombie.exp gdb-6.3/gdb/testsuite/gdb.base/tracefork-zombie.exp
|
|
|
861f93 |
--- gdb-6.3-unpatched/gdb/testsuite/gdb.base/tracefork-zombie.exp 1969-12-31 19:00:00.000000000 -0500
|
|
|
861f93 |
+++ gdb-6.3/gdb/testsuite/gdb.base/tracefork-zombie.exp 2007-07-31 13:04:12.000000000 -0400
|
|
|
861f93 |
@@ -0,0 +1,75 @@
|
|
|
861f93 |
+# Copyright 2007 Free Software Foundation, Inc.
|
|
|
861f93 |
+
|
|
|
861f93 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
861f93 |
+# it under the terms of the GNU General Public License as published by
|
|
|
861f93 |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
861f93 |
+# (at your option) any later version.
|
|
|
861f93 |
+#
|
|
|
861f93 |
+# This program is distributed in the hope that it will be useful,
|
|
|
861f93 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
861f93 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
861f93 |
+# GNU General Public License for more details.
|
|
|
861f93 |
+#
|
|
|
861f93 |
+# You should have received a copy of the GNU General Public License
|
|
|
861f93 |
+# along with this program; if not, write to the Free Software
|
|
|
861f93 |
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
861f93 |
+
|
|
|
861f93 |
+# are we on a target board
|
|
|
861f93 |
+if [is_remote target] then {
|
|
|
861f93 |
+ return 0
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+# Start the program running and then wait for a bit, to be sure
|
|
|
861f93 |
+# that it can be attached to.
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_exit
|
|
|
861f93 |
+gdb_start
|
|
|
861f93 |
+gdb_load sleep
|
|
|
861f93 |
+
|
|
|
861f93 |
+set gdb_pid [exp_pid -i [board_info host fileid]]
|
|
|
861f93 |
+set test "identified the child GDB"
|
|
|
861f93 |
+if {$gdb_pid != "" && $gdb_pid > 0} {
|
|
|
861f93 |
+ pass $test
|
|
|
861f93 |
+ verbose -log "Child GDB PID $gdb_pid"
|
|
|
861f93 |
+} else {
|
|
|
861f93 |
+ fail $test
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+set testpid [eval exec sleep 10 &]
|
|
|
861f93 |
+exec sleep 2
|
|
|
861f93 |
+
|
|
|
861f93 |
+set test "attach"
|
|
|
861f93 |
+gdb_test_multiple "attach $testpid" "$test" {
|
|
|
861f93 |
+ -re "Attaching to program.*`?.*'?, process $testpid..*$gdb_prompt $" {
|
|
|
861f93 |
+ pass "$test"
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+ -re "Attaching to program.*`?.*\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" {
|
|
|
861f93 |
+ # Response expected on Cygwin
|
|
|
861f93 |
+ pass "$test"
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+# Some time to let GDB spawn its testing child.
|
|
|
861f93 |
+exec sleep 2
|
|
|
861f93 |
+
|
|
|
861f93 |
+set found none
|
|
|
861f93 |
+foreach procpid [glob -directory /proc -type d {[0-9]*}] {
|
|
|
861f93 |
+ if {[catch {open $procpid/status} statusfi]} {
|
|
|
861f93 |
+ continue
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+ set status [read $statusfi]
|
|
|
861f93 |
+ close $statusfi
|
|
|
861f93 |
+ if {1
|
|
|
861f93 |
+ && [regexp -line {^Name:\tgdb$} $status]
|
|
|
861f93 |
+ && [regexp -line {^PPid:\t1$} $status]
|
|
|
861f93 |
+ && [regexp -line "^TracerPid:\t$gdb_pid$" $status]} {
|
|
|
861f93 |
+ set found $procpid
|
|
|
861f93 |
+ verbose -log "Found linux_test_for_tracefork zombie PID $procpid"
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+}
|
|
|
861f93 |
+set test "linux_test_for_tracefork leaves no zombie"
|
|
|
861f93 |
+if {$found eq {none}} {
|
|
|
861f93 |
+ pass $test
|
|
|
861f93 |
+} else {
|
|
|
861f93 |
+ fail $test
|
|
|
861f93 |
+}
|