[PATCH] Don't compare the pid returned from wait() against inferior_ptid.
John Baldwin
jhb@FreeBSD.org
Wed Jul 8 00:46:05 GMT 2020
inf_ptrace::wait() needs to discard termination events reported by
detached child processes. Previously it compared the returned pid
against the pid in inferior_ptid to determine if a termination event
should be discarded or reported. inferior_ptid is now null_ptid in
wait() target methods, so this was always failing and never reporting
exit events. Instead, report termination events whose pid matches any
inferior belonging to the current target.
gdb/ChangeLog:
* inf-ptrace.c (inf_ptrace_target::wait): Don't compare against
inferior_ptid.
---
gdb/ChangeLog | 5 +++++
gdb/inf-ptrace.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c86d7e4647..d4cd0d014e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-07-07 John Baldwin <jhb@FreeBSD.org>
+
+ * inf-ptrace.c (inf_ptrace_target::wait): Don't compare against
+ inferior_ptid.
+
2020-07-06 Andrew Burgess <andrew.burgess@embecosm.com>
PR python/22748
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index d25d226abb..ae0b0f7ff0 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -347,7 +347,7 @@ inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
}
/* Ignore terminated detached child processes. */
- if (!WIFSTOPPED (status) && pid != inferior_ptid.pid ())
+ if (!WIFSTOPPED (status) && find_inferior_pid (this, pid) == nullptr)
pid = -1;
}
while (pid == -1);
--
2.25.1
More information about the Gdb-patches
mailing list