This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix fork-related regressions on GNU/Linux
- From: Pedro Alves <palves at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 5 Oct 2017 17:34:51 -0000
- Subject: [binutils-gdb] Fix fork-related regressions on GNU/Linux
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2fd9d7ca17539ce983862b25e0abc27cfb706189
commit 2fd9d7ca17539ce983862b25e0abc27cfb706189
Author: Pedro Alves <palves@redhat.com>
Date: Thu Oct 5 18:33:22 2017 +0100
Fix fork-related regressions on GNU/Linux
Commit 5cd63fda035d ("Fix "Remote 'g' packet reply is too long"
problems with multiple inferiors") caused a number of regressions on
native GNU/Linux, all related to follow-fork support. E.g.:
src/gdb/target.c:3141: internal-error: gdbarch* default_thread_architecture(target_ops*, ptid_t): Assertion `inf != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
Resyncing due to internal error.
FAIL: gdb.base/catch-signal-fork.exp: got SIGHUP after fork (GDB internal error)
This commit fixes it.
gdb/ChangeLog:
2017-10-05 Pedro Alves <palves@redhat.com>
* linux-nat.c (linux_child_follow_fork): When following the parent
and detaching the child, consult the parent thread's architecture
instead of the child's.
Diff:
---
gdb/ChangeLog | 6 ++++++
gdb/linux-nat.c | 5 ++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f70aa8a..59eb04a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2017-10-05 Pedro Alves <palves@redhat.com>
+
+ * linux-nat.c (linux_child_follow_fork): When following the parent
+ and detaching the child, consult the parent thread's architecture
+ instead of the child's.
+
2017-10-05 Ulrich Weigand <uweigand@de.ibm.com>
* ax.h: Do not include "doublest.h".
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 0f340ee..6080415 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -510,8 +510,11 @@ linux_child_follow_fork (struct target_ops *ops, int follow_child,
To work around this, single step the child process
once before detaching to clear the flags. */
+ /* Note that we consult the parent's architecture instead of
+ the child's because there's no inferior for the child at
+ this point. */
if (!gdbarch_software_single_step_p (target_thread_architecture
- (child_lp->ptid)))
+ (parent_ptid)))
{
linux_disable_event_reporting (child_pid);
if (ptrace (PTRACE_SINGLESTEP, child_pid, 0, 0) < 0)