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