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