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