Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Fix for internal-error: linux_nat_post_attach_wait: Assertion `pid == new_pid && WIFSTOPPED (status)' failed.
@ 2009-10-13 18:41 Paul Pluzhnikov
  2009-10-13 20:53 ` Pedro Alves
  0 siblings, 1 reply; 10+ messages in thread
From: Paul Pluzhnikov @ 2009-10-13 18:41 UTC (permalink / raw)
  To: gdb-patches; +Cc: ppluzhnikov, Pedro Alves

Greetings,

Using test case from http://sourceware.org/bugzilla/show_bug.cgi?id=10757,
Pedro noticed, and I reproduced (this happens rarely):

warning: Can't attach LWP 15338: No such process
../../src/gdb/linux-nat.c:1341: internal-error: linux_nat_post_attach_wait: Assertion `pid == new_pid && WIFSTOPPED (status)' failed.

When assertion fails, status == 0.

Here is a proposed fix.

Thanks,
--
Paul Pluzhnikov

2009-10-13  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* linux-nat.c (linux_nat_post_attach_wait): Adjust assert.

Index: linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.c,v
retrieving revision 1.151
diff -u -p -u -r1.151 linux-nat.c
--- linux-nat.c	9 Oct 2009 01:57:12 -0000	1.151
+++ linux-nat.c	13 Oct 2009 18:18:37 -0000
@@ -1338,16 +1338,22 @@ linux_nat_post_attach_wait (ptid_t ptid,
       *cloned = 1;
     }
 
-  gdb_assert (pid == new_pid && WIFSTOPPED (status));
+  gdb_assert (pid == new_pid);
 
-  if (WSTOPSIG (status) != SIGSTOP)
+  if (WIFSTOPPED (status))
     {
-      *signalled = 1;
-      if (debug_linux_nat)
-	fprintf_unfiltered (gdb_stdlog,
-			    "LNPAW: Received %s after attaching\n",
-			    status_to_str (status));
+      if (WSTOPSIG (status) != SIGSTOP)
+	{
+	  *signalled = 1;
+	  if (debug_linux_nat)
+	    fprintf_unfiltered (gdb_stdlog,
+				"LNPAW: Received %s after attaching\n",
+				status_to_str (status));
+	}
     }
+  else
+    /* We could have been notified about LWP exit.  */
+    gdb_assert (*cloned);
 
   return status;
 }


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-10-15 18:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-13 18:41 [patch] Fix for internal-error: linux_nat_post_attach_wait: Assertion `pid == new_pid && WIFSTOPPED (status)' failed Paul Pluzhnikov
2009-10-13 20:53 ` Pedro Alves
2009-10-14 18:21   ` Paul Pluzhnikov
2009-10-14 19:08     ` Pedro Alves
2009-10-14 21:01       ` Paul Pluzhnikov
2009-10-14 21:16         ` Pedro Alves
2009-10-14 21:28           ` Paul Pluzhnikov
2009-10-14 22:29             ` Pedro Alves
2009-10-15  2:17               ` Doug Evans
2009-10-15 18:10               ` Paul Pluzhnikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox