From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30456 invoked by alias); 28 May 2008 17:10:11 -0000 Received: (qmail 30409 invoked by uid 22791); 28 May 2008 17:10:11 -0000 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.31) with ESMTP; Wed, 28 May 2008 17:09:45 +0000 Received: from zps37.corp.google.com (zps37.corp.google.com [172.25.146.37]) by smtp-out.google.com with ESMTP id m4SH9fRa000474 for ; Wed, 28 May 2008 18:09:42 +0100 Received: from ti-out-0910.google.com (tiba1.prod.google.com [10.110.78.1]) by zps37.corp.google.com with ESMTP id m4SH9Vc0019808 for ; Wed, 28 May 2008 10:09:40 -0700 Received: by ti-out-0910.google.com with SMTP id a1so1997792tib.24 for ; Wed, 28 May 2008 10:09:40 -0700 (PDT) Received: by 10.150.82.27 with SMTP id f27mr2104886ybb.143.1211994580252; Wed, 28 May 2008 10:09:40 -0700 (PDT) Received: by 10.151.99.13 with HTTP; Wed, 28 May 2008 10:09:40 -0700 (PDT) Message-ID: <8ac60eac0805281009r29e394d2y2b285f31349b253f@mail.gmail.com> Date: Wed, 28 May 2008 21:34:00 -0000 From: "Paul Pluzhnikov" To: "Pedro Alves" Subject: Re: [new patch] Re: [RFC] Fix for gdb crash in "info thread" after exec(). Cc: gdb-patches@sourceware.org In-Reply-To: <200805281626.50992.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080527190702.6956D3A6952@localhost> <200805272106.16082.pedro@codesourcery.com> <8ac60eac0805271623g492ade49j4da414d3c757d846@mail.gmail.com> <200805281626.50992.pedro@codesourcery.com> 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: 2008-05/txt/msg00734.txt.bz2 On Wed, May 28, 2008 at 8:26 AM, Pedro Alves wrote: > A Wednesday 28 May 2008 00:23:25, Paul Pluzhnikov wrote: >> The 'ecs->new_thread_event' is set to 0 while handling >> TARGET_WAITKIND_EXECD, and add_thread() is not called for it. >> > > Hmmmm, then, how is a thread getting to the thread list, with > a ptid{pid,0,0} format? It should never happen in linux native. > > Hmmmm2, I just tried it, and it does happen to me: Sorry about it being dense. Yes, the exact same thing happens to me once I revert your patch: - return pid_to_ptid (GET_PID (ptid)); + return ptid; > Hope you don't mind, but I've extended your test to test that case; the > original bug is still covered, as I still get FAILures if > linux-thread-db.c isn't fixed. > > What do you think? Looks good to me, except the "second" parameter in the test is no longer necessary, and there is an off-by-three bug in the allocation of new_image: --- gdb/testsuite/gdb.threads/execl.c.orig 2008-05-28 09:55:29.000000000 -0700 +++ gdb/testsuite/gdb.threads/execl.c 2008-05-28 10:03:04.000000000 -0700 @@ -27,11 +27,11 @@ main (int argc, char* argv[]) pthread_create (&thread1, NULL, thread_function, NULL); pthread_create (&thread2, NULL, thread_function, NULL); - new_image = malloc (strlen (argv[0] + 1)); + new_image = malloc (strlen (argv[0]) + 2); strcpy (new_image, argv[0]); strcat (new_image, "1"); - if (execl (new_image, new_image, "second", NULL) == -1) /* set breakpoint here */ + if (execl (new_image, new_image, NULL) == -1) /* set breakpoint here */ return 1; return 0; Thanks, -- Paul Pluzhnikov