[PATCH v2 06/13] inf-ptrace: Raise an internal_error if waitpid() fails.

John Baldwin jhb@FreeBSD.org
Tue Aug 3 18:49:53 GMT 2021


Previously this returned a TARGET_WAITKIND_SIGNALLED event for
inferior_ptid.  Since the multi-target changes, inferior_ptid is now
invalid during ::wait() methods, so this triggered an assertion
further up the stack.
---
 gdb/inf-ptrace.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index afa38de6ef7..1f8e72d1aca 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -319,14 +319,9 @@ inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
 
       if (pid == -1)
 	{
-	  fprintf_unfiltered (gdb_stderr,
-			      _("Child process unexpectedly missing: %s.\n"),
-			      safe_strerror (save_errno));
-
-	  /* Claim it exited with unknown signal.  */
-	  ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
-	  ourstatus->value.sig = GDB_SIGNAL_UNKNOWN;
-	  return inferior_ptid;
+	  internal_error (__FILE__, __LINE__,
+			  _("Child process unexpectedly missing: %s.\n"),
+			  safe_strerror (save_errno));
 	}
 
       /* Ignore terminated detached child processes.  */
-- 
2.31.1



More information about the Gdb-patches mailing list