From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24283 invoked by alias); 10 Jul 2008 18:01:43 -0000 Received: (qmail 24274 invoked by uid 22791); 10 Jul 2008 18:01:43 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 10 Jul 2008 18:01:25 +0000 Received: (qmail 4000 invoked from network); 10 Jul 2008 18:01:23 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 10 Jul 2008 18:01:23 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [non-stop] 08/10 linux native support Date: Thu, 10 Jul 2008 18:01:00 -0000 User-Agent: KMail/1.9.9 Cc: Daniel Jacobowitz References: <200806152205.49241.pedro@codesourcery.com> <200807101627.50156.pedro@codesourcery.com> <20080710171518.GA19554@caradoc.them.org> In-Reply-To: <20080710171518.GA19554@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200807101901.23598.pedro@codesourcery.com> 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: 2008-07/txt/msg00153.txt.bz2 On Thursday 10 July 2008 18:15:18, Daniel Jacobowitz wrote: > On Thu, Jul 10, 2008 at 04:27:49PM +0100, Pedro Alves wrote: > > > This (the thread_db_attach_lwp version) looks reasonable to me. Ugly, > > > but reasonable. Why do we need the parent's data? > > > > Due to this: > > > > (gdb) r& > > Starting program: /home/pedro/gdb/tests/threads32 > > (gdb) [Thread debugging using libthread_db enabled] > > [New Thread 0xf7df0b90 (LWP 24154)] > > [New Thread 0xf75efb90 (LWP 24155)] > > info threads > > 3 Thread 0xf75efb90 (LWP 24155) (running) > > 2 Thread 0xf7df0b90 (LWP 24154) (running) > > * 1 LWP 24151 (running) > > Why didn't this thread get identified at the shared library event, > when libthread_db was loaded? It already existed by then, being the > main thread. Because we hit this in find_new_threads_callback: if (ti.ti_tid == 0) { /* A thread ID of zero means that this is the main thread, but glibc has not yet initialized thread-local storage and the pthread library. We do not know what the thread's TID will be yet. Just enable event reporting and otherwise ignore it. */ #0 find_new_threads_callback (th_p=0xffb316c4, data=0x0) at ../../src/gdb/linux-thread-db.c:1011 #1 0xf7dfbb59 in ?? () from /lib32/libthread_db.so.1 #2 0xf7dfbc11 in td_ta_thr_iter () from /lib32/libthread_db.so.1 #3 0x080a8dec in thread_db_find_new_threads () at ../../src/gdb/linux-thread-db.c:1044 #4 0x080a8371 in check_for_thread_db () at ../../src/gdb/linux-thread-db.c:665 #5 0x080a83af in thread_db_new_objfile (objfile=0x84a6cf8) at ../../src/gdb/linux-thread-db.c:679 ... That's from here: 649 /* Now attempt to open a connection to the thread library. */ 650 err = td_ta_new_p (&proc_handle, &thread_agent); 651 switch (err) 652 { 653 case TD_NOLIBTHREAD: 654 /* No thread library was detected. */ 655 break; 656 657 case TD_OK: 658 printf_unfiltered (_("[Thread debugging using libthread_db enabled]\n")); 659 660 /* The thread library was detected. Activate the thread_db target. */ 661 push_target (&thread_db_ops); 662 using_thread_db = 1; 663 664 enable_thread_event_reporting (); 665 thread_db_find_new_threads (); 666 break; -- Pedro Alves