From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9220 invoked by alias); 19 May 2009 14:28:18 -0000 Received: (qmail 9208 invoked by uid 22791); 19 May 2009 14:28:18 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 May 2009 14:28:13 +0000 Received: from spaceape7.eur.corp.google.com (spaceape7.eur.corp.google.com [172.28.16.141]) by smtp-out.google.com with ESMTP id n4JESAs2010491 for ; Tue, 19 May 2009 15:28:10 +0100 Received: from an-out-0708.google.com (andd40.prod.google.com [10.100.30.40]) by spaceape7.eur.corp.google.com with ESMTP id n4JES84M024576 for ; Tue, 19 May 2009 07:28:08 -0700 Received: by an-out-0708.google.com with SMTP id d40so12134547and.1 for ; Tue, 19 May 2009 07:28:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.215.12 with SMTP id n12mr163471ang.154.1242743287144; Tue, 19 May 2009 07:28:07 -0700 (PDT) In-Reply-To: References: <200905181813.48596.pedro@codesourcery.com> Date: Tue, 19 May 2009 14:28:00 -0000 Message-ID: Subject: Re: Workaround for glibc/BZ5983: following a child fork shows stale parent threads in the child. From: Doug Evans To: Pedro Alves Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true 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-05/txt/msg00398.txt.bz2 On Mon, May 18, 2009 at 11:26 PM, Doug Evans wrote: > On Mon, May 18, 2009 at 10:13 AM, Pedro Alves wr= ote: >> [...] >> + =A0 =A0 =A0while (fgets (buf, sizeof (buf), status_file)) >> + =A0 =A0 =A0 { >> + =A0 =A0 =A0 =A0 if (strncmp (buf, "Tgid:", 5) =3D=3D 0) >> + =A0 =A0 =A0 =A0 =A0 { >> + =A0 =A0 =A0 =A0 =A0 =A0 tgid =3D strtoul (buf + strlen ("Tgid:"), NULL= , 10); >> + =A0 =A0 =A0 =A0 =A0 =A0 break; >> + =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 } > > This works, but only because of an assumption of the strlen including > the trailing NUL in "Tgid:" consuming the TAB between "Tgid:" and the > number. > We should probably document that (or make the parsing more robust). > Well, that's messed up (in at least two ways!). [he says after jumping to the terminal after waking up with a sick feeling in his stomach ...]