aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2020-07-09 12:40:40 -0700
committerJohn Baldwin <jhb@FreeBSD.org>2020-07-09 12:40:40 -0700
commitf37e5866aa72e76f2199155fb838ffc25c78a26e (patch)
treec6a593841eb4baf31a4f2c8f7ff4375bca9f7365
parent39776b1117bdbdc34eb46151edc8e09eecce1530 (diff)
downloadbinutils-f37e5866aa72e76f2199155fb838ffc25c78a26e.zip
binutils-f37e5866aa72e76f2199155fb838ffc25c78a26e.tar.gz
binutils-f37e5866aa72e76f2199155fb838ffc25c78a26e.tar.bz2
Don't compare the pid returned from 'wait' against inferior_ptid.
'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. The multi-target changes cleared inferior_ptid to 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. Several tests started failing on FreeBSD after the multi-target changes and pass again after this change. gdb/ChangeLog: * inf-ptrace.c (inf_ptrace_target::wait): Don't compare against inferior_ptid.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/inf-ptrace.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 40e22ef..bdab91d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2020-07-09 John Baldwin <jhb@FreeBSD.org>
+ * inf-ptrace.c (inf_ptrace_target::wait): Don't compare against
+ inferior_ptid.
+
+2020-07-09 John Baldwin <jhb@FreeBSD.org>
+
* fbsd-tdep.c (fbsd_print_auxv_entry): Handle AT_FREEBSD_ARGC,
AT_FREEBSD_ARGV, AT_FREEBSD_ENVC, AT_FREEBSD_ENVV,
AT_FREEBSD_PS_STRINGS.
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index d25d226..ae0b0f7 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);