From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5281 invoked by alias); 24 Feb 2009 15:32:04 -0000 Received: (qmail 5269 invoked by uid 22791); 24 Feb 2009 15:32:03 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 Feb 2009 15:31:55 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 2A752105BB; Tue, 24 Feb 2009 15:31:54 +0000 (GMT) Received: from caradoc.them.org (209.195.188.212.nauticom.net [209.195.188.212]) by nan.false.org (Postfix) with ESMTP id 101E61018B; Tue, 24 Feb 2009 15:31:54 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1LbzGD-0002BW-GZ; Tue, 24 Feb 2009 10:31:53 -0500 Date: Tue, 24 Feb 2009 17:16:00 -0000 From: Daniel Jacobowitz To: Vinay Sridhar Cc: Pedro Alves , gdb-patches@sourceware.org, luisgpm@linux.vnet.ibm.com Subject: Re: [RFC][Patch] Fix gdb failure to access tls data for parent thread Message-ID: <20090224153153.GA7032@caradoc.them.org> Mail-Followup-To: Vinay Sridhar , Pedro Alves , gdb-patches@sourceware.org, luisgpm@linux.vnet.ibm.com References: <20090211155300.GA22689@caradoc.them.org> <1235379059.10038.12.camel@localhost.localdomain> <20090223140812.GA10946@caradoc.them.org> <200902232009.58960.pedro@codesourcery.com> <1235472610.4894.14.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1235472610.4894.14.camel@localhost.localdomain> User-Agent: Mutt/1.5.17 (2008-05-11) 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-02/txt/msg00467.txt.bz2 On Tue, Feb 24, 2009 at 04:20:10PM +0530, Vinay Sridhar wrote: > Please try this test and let me know if you're able to get a recreate: I can reproduce this. Here's where we ought to discover the thread: 1012 /* Iterate over all user-space threads to discover new threads. */ 1013 err = td_ta_thr_iter_p (thread_agent, find_new_threads_callback, NULL, 1014 TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY, 1015 TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS); The first two times this is called, ti_tid is 0 for the main thread, so we do nothing. The third time, find_new_threads_callback is never called! The thread library is claiming we have no threads. Repeating "info threads" again has the same effect: 5 Thread 0x7ffff5c5f950 (LWP 7440) 0x00007ffff7bde9c7 in ?? () from /usr/lib/libgomp.so.1 4 Thread 0x7ffff6460950 (LWP 7439) initTlsData () at omp-test.c:9 3 Thread 0x7ffff6c61950 (LWP 7438) 0x00007ffff7bdea1a in ?? () from /usr/lib/libgomp.so.1 2 Thread 0x7ffff7462950 (LWP 7418) 0x00007ffff7bdea1a in ?? () from /usr/lib/libgomp.so.1 * 1 LWP 7410 0x00007ffff7bdea1a in ?? () from /usr/lib/libgomp.so.1 Pedro, unfortunately this bug is related to non-stop :-( 81 /* Verify that this thread's pid field matches the child PID. 82 If its pid field is negative, it's about to do a fork or it 83 is the sole thread in a fork child. */ It's checking that the PID (not TID) matches proc_handle.pid. We need to find another way to read from a stopped thread, since if we put any other PID there, we get no threads. I would suggest expanding ps_prochandle to include a memory thread as ptid_t. We always try to read from the most recently added stopped thread, since the lwp_list gets additions at the front. -- Daniel Jacobowitz CodeSourcery