Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: ppluzhnikov@google.com (Paul Pluzhnikov)
To: gdb-patches@sourceware.org
Cc: ppluzhnikov@google.com, "Pedro Alves" <pedro@codesourcery.com>
Subject: [patch] Fix for internal-error: linux_nat_post_attach_wait: Assertion `pid == new_pid && WIFSTOPPED (status)' failed.
Date: Tue, 13 Oct 2009 18:41:00 -0000	[thread overview]
Message-ID: <20091013184120.30A5776761@ppluzhnikov.mtv.corp.google.com> (raw)

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;
 }


             reply	other threads:[~2009-10-13 18:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-13 18:41 Paul Pluzhnikov [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091013184120.30A5776761@ppluzhnikov.mtv.corp.google.com \
    --to=ppluzhnikov@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox