From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17628 invoked by alias); 19 May 2009 06:26:16 -0000 Received: (qmail 17619 invoked by uid 22791); 19 May 2009 06:26:16 -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.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 May 2009 06:26:11 +0000 Received: from zps77.corp.google.com (zps77.corp.google.com [172.25.146.77]) by smtp-out.google.com with ESMTP id n4J6Q9UZ028841 for ; Mon, 18 May 2009 23:26:09 -0700 Received: from yw-out-2324.google.com (ywt2.prod.google.com [10.192.20.2]) by zps77.corp.google.com with ESMTP id n4J6Q7CK005279 for ; Mon, 18 May 2009 23:26:08 -0700 Received: by yw-out-2324.google.com with SMTP id 2so2182065ywt.47 for ; Mon, 18 May 2009 23:26:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.90.71.16 with SMTP id t16mr3779535aga.58.1242714367407; Mon, 18 May 2009 23:26:07 -0700 (PDT) In-Reply-To: <200905181813.48596.pedro@codesourcery.com> References: <200905181813.48596.pedro@codesourcery.com> Date: Tue, 19 May 2009 06:26: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/msg00392.txt.bz2 On Mon, May 18, 2009 at 10:13 AM, Pedro Alves wrot= e: > [...] > + =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).