|
|
a8223e |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
a8223e |
From: Fedora GDB patches <invalid@email.com>
|
|
|
a8223e |
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
a8223e |
Subject: gdb-6.5-bz243845-stale-testing-zombie-test.patch
|
|
|
a8223e |
|
|
|
a8223e |
;; Test leftover zombie process (BZ 243845).
|
|
|
a8223e |
;;=fedoratest
|
|
|
a8223e |
|
|
|
a8223e |
diff --git a/gdb/testsuite/gdb.base/tracefork-zombie.exp b/gdb/testsuite/gdb.base/tracefork-zombie.exp
|
|
|
a8223e |
new file mode 100644
|
|
|
a8223e |
--- /dev/null
|
|
|
a8223e |
+++ b/gdb/testsuite/gdb.base/tracefork-zombie.exp
|
|
|
a8223e |
@@ -0,0 +1,76 @@
|
|
|
a8223e |
+# Copyright 2007 Free Software Foundation, Inc.
|
|
|
a8223e |
+
|
|
|
a8223e |
+# This program is free software; you can redistribute it and/or modify
|
|
|
a8223e |
+# it under the terms of the GNU General Public License as published by
|
|
|
a8223e |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
a8223e |
+# (at your option) any later version.
|
|
|
a8223e |
+#
|
|
|
a8223e |
+# This program is distributed in the hope that it will be useful,
|
|
|
a8223e |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
a8223e |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
a8223e |
+# GNU General Public License for more details.
|
|
|
a8223e |
+#
|
|
|
a8223e |
+# You should have received a copy of the GNU General Public License
|
|
|
a8223e |
+# along with this program; if not, write to the Free Software
|
|
|
a8223e |
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
a8223e |
+
|
|
|
a8223e |
+# are we on a target board
|
|
|
a8223e |
+if {[use_gdb_stub]} {
|
|
|
a8223e |
+ untested "skipping test because of use_gdb_stub"
|
|
|
a8223e |
+ return -1
|
|
|
a8223e |
+}
|
|
|
a8223e |
+
|
|
|
a8223e |
+# Start the program running and then wait for a bit, to be sure
|
|
|
a8223e |
+# that it can be attached to.
|
|
|
a8223e |
+
|
|
|
a8223e |
+gdb_exit
|
|
|
a8223e |
+gdb_start
|
|
|
a8223e |
+gdb_load sleep
|
|
|
a8223e |
+
|
|
|
a8223e |
+set gdb_pid [exp_pid -i [board_info host fileid]]
|
|
|
a8223e |
+set test "identified the child GDB"
|
|
|
a8223e |
+if {$gdb_pid != "" && $gdb_pid > 0} {
|
|
|
a8223e |
+ pass $test
|
|
|
a8223e |
+ verbose -log "Child GDB PID $gdb_pid"
|
|
|
a8223e |
+} else {
|
|
|
a8223e |
+ fail $test
|
|
|
a8223e |
+}
|
|
|
a8223e |
+
|
|
|
a8223e |
+set testpid [eval exec sleep 10 &]
|
|
|
a8223e |
+exec sleep 2
|
|
|
a8223e |
+
|
|
|
a8223e |
+set test "attach"
|
|
|
a8223e |
+gdb_test_multiple "attach $testpid" "$test" {
|
|
|
a8223e |
+ -re "Attaching to program.*`?.*'?, process $testpid..*$gdb_prompt $" {
|
|
|
a8223e |
+ pass "$test"
|
|
|
a8223e |
+ }
|
|
|
a8223e |
+ -re "Attaching to program.*`?.*\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" {
|
|
|
a8223e |
+ # Response expected on Cygwin
|
|
|
a8223e |
+ pass "$test"
|
|
|
a8223e |
+ }
|
|
|
a8223e |
+}
|
|
|
a8223e |
+
|
|
|
a8223e |
+# Some time to let GDB spawn its testing child.
|
|
|
a8223e |
+exec sleep 2
|
|
|
a8223e |
+
|
|
|
a8223e |
+set found none
|
|
|
a8223e |
+foreach procpid [glob -directory /proc -type d {[0-9]*}] {
|
|
|
a8223e |
+ if {[catch {open $procpid/status} statusfi]} {
|
|
|
a8223e |
+ continue
|
|
|
a8223e |
+ }
|
|
|
a8223e |
+ set status [read $statusfi]
|
|
|
a8223e |
+ close $statusfi
|
|
|
a8223e |
+ if {1
|
|
|
a8223e |
+ && [regexp -line {^Name:\tgdb$} $status]
|
|
|
a8223e |
+ && [regexp -line {^PPid:\t1$} $status]
|
|
|
a8223e |
+ && [regexp -line "^TracerPid:\t$gdb_pid$" $status]} {
|
|
|
a8223e |
+ set found $procpid
|
|
|
a8223e |
+ verbose -log "Found linux_test_for_tracefork zombie PID $procpid"
|
|
|
a8223e |
+ }
|
|
|
a8223e |
+}
|
|
|
a8223e |
+set test "linux_test_for_tracefork leaves no zombie"
|
|
|
a8223e |
+if {$found eq {none}} {
|
|
|
a8223e |
+ pass $test
|
|
|
a8223e |
+} else {
|
|
|
a8223e |
+ fail $test
|
|
|
a8223e |
+}
|