From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29877 invoked by alias); 13 Oct 2009 18:41:35 -0000 Received: (qmail 29867 invoked by uid 22791); 13 Oct 2009 18:41:34 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Oct 2009 18:41:29 +0000 Received: from zps38.corp.google.com (zps38.corp.google.com [172.25.146.38]) by smtp-out.google.com with ESMTP id n9DIfNNP012613; Tue, 13 Oct 2009 11:41:23 -0700 Received: from ppluzhnikov.mtv.corp.google.com (ppluzhnikov.mtv.corp.google.com [172.18.118.92]) by zps38.corp.google.com with ESMTP id n9DIfKJu016341; Tue, 13 Oct 2009 11:41:20 -0700 Received: by ppluzhnikov.mtv.corp.google.com (Postfix, from userid 74925) id 30A5776761; Tue, 13 Oct 2009 11:41:20 -0700 (PDT) To: gdb-patches@sourceware.org Cc: ppluzhnikov@google.com, "Pedro Alves" Subject: [patch] Fix for internal-error: linux_nat_post_attach_wait: Assertion `pid == new_pid && WIFSTOPPED (status)' failed. Message-Id: <20091013184120.30A5776761@ppluzhnikov.mtv.corp.google.com> Date: Tue, 13 Oct 2009 18:41:00 -0000 From: ppluzhnikov@google.com (Paul Pluzhnikov) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-10/txt/msg00283.txt.bz2 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 * 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; }