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