From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26724 invoked by alias); 11 Aug 2008 14:12:36 -0000 Received: (qmail 26567 invoked by uid 22791); 11 Aug 2008 14:12:35 -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; Mon, 11 Aug 2008 14:11:37 +0000 Received: (qmail 9632 invoked from network); 11 Aug 2008 14:11:35 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 11 Aug 2008 14:11:35 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: bsd-uthread, claim the core target's main thread Date: Mon, 11 Aug 2008 14:12:00 -0000 User-Agent: KMail/1.9.9 References: <200808111505.12693.pedro@codesourcery.com> In-Reply-To: <200808111505.12693.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_eiEoI2fRpPmA7Gj" Message-Id: <200808111511.42414.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-08/txt/msg00298.txt.bz2 --Boundary-00=_eiEoI2fRpPmA7Gj Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 1252 Err, ENOPATCH. I also forgot to mention that this also makes the case of going from: - -pthread or -c_r symbols not loaded to: - -pthread or -c_r symbols loaded when the inferior is already being debugged, behave properly. Not a usual use case, but previously, we were updating inferior_ptid in bsd_uthreads_wait, but not here. On Monday 11 August 2008 15:05:12, Pedro Alves wrote: > Finally, > > Since the core_stratum layer is now registering a thread, layers above > should claim it. This fixes the bsd-uthread target. > > It is meanto to be applies on top of this one, > http://sourceware.org/ml/gdb-patches/2008-08/msg00295.html > > , although it also applies cleanly on top of the patch to make the > bsd-uthread target always register a main thread. > > AIX is still needing update or just some checking, to make it always > register a thread. The thread syncing in aix-thread.c and its use of > ptid_cmp still looks a bit of a mistery to me to propose a fix. :-( > The "failure" mode would be that you'd get two entries for the > same thread, with different ptids. > > There's isn't any other target that can layer a thread_stratum > target over a core_statum. > > OK, when the dependencies are in? Here it is. -- Pedro Alves --Boundary-00=_eiEoI2fRpPmA7Gj Content-Type: text/x-diff; charset="utf-8"; name="bsd-uthread_claim_main_thread.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bsd-uthread_claim_main_thread.diff" Content-length: 1002 2008-08-11 Pedro Alves * bsd-uthread.c (bsd_uthread_find_new_threads): Claim a main thread. --- gdb/bsd-uthread.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) Index: src/gdb/bsd-uthread.c =================================================================== --- src.orig/gdb/bsd-uthread.c 2008-08-11 13:23:53.000000000 +0100 +++ src/gdb/bsd-uthread.c 2008-08-11 13:25:14.000000000 +0100 @@ -422,7 +422,15 @@ bsd_uthread_find_new_threads (void) ptid_t ptid = ptid_build (pid, 0, addr); if (!in_thread_list (ptid) || is_exited (ptid)) - add_thread (ptid); + { + /* If INFERIOR_PTID doesn't have a tid member yet, then ptid + is still the initial thread of the process. Notify GDB + core about it. */ + if (ptid_get_tid (inferior_ptid) == 0) + thread_change_ptid (inferior_ptid, ptid); + else + add_thread (ptid); + } addr = read_memory_typed_address (addr + offset, builtin_type_void_data_ptr); --Boundary-00=_eiEoI2fRpPmA7Gj--