From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2119 invoked by alias); 6 Aug 2010 20:06:03 -0000 Received: (qmail 1933 invoked by uid 22791); 6 Aug 2010 20:06:02 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Aug 2010 20:05:57 +0000 Received: (qmail 5675 invoked from network); 6 Aug 2010 20:05:55 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 6 Aug 2010 20:05:55 -0000 From: Pedro Alves To: gdb-patches@sourceware.org, "Maciej W. Rozycki" Subject: Re: [RFA]corelow.c: Add tid to add_to_thread_list Date: Fri, 06 Aug 2010 20:06:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.31-11-rt; KDE/4.4.2; x86_64; ; ) Cc: Hui Zhu References: <201008061817.49329.pedro@codesourcery.com> In-Reply-To: <201008061817.49329.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201008062105.52968.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: 2010-08/txt/msg00085.txt.bz2 On Friday 06 August 2010 18:17:48, Pedro Alves wrote: > On Friday 06 August 2010 17:47:53, Hui Zhu wrote: > > struct thread_info * > > add_thread_silent (ptid_t ptid) > > { > > If this function hit an internal error in this scenario, then > it has a bug. I think Maciej wrote a patch to fix it in our > internal tree. I'll try to look for it. Note that with this > fixed, gdb would still discard all idle threads but one, > and, when accessing the registers of the one that stays, we'd > be accessing the wrong .reg section. Here's the patch. (Making Maciej's words mine, and tweaking for context, ) this assertion: .../gdb/thread.c:880: internal-error: switch_to_thread: Assertion `inf != NULL' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) is related to this change: 2009-05-24 Pedro Alves * thread.c (new_thread): New function. (add_thread_silent): Use it. which removed a piece of code that actually added minus_one_ptid to the list of threads. The current state of switch_to_thread doesn't allow minus_one_ptid in this context, but null_ptid can be safely used instead to the same effect. The change was bogus --- the intent was to use new_thread (minus_one_ptid), not new_thread (ptid). Maciej's patch fixes this just as well (or perhaps better), so I've applied to mainline, and the 7.2 and 7.1 branches. -- Pedro Alves 2010-08-06 Maciej W. Rozycki gdb/ * thread.c (add_thread_silent): Use null_ptid instead of minus_one_ptid while getting rid of stale inferior_ptid. Index: gdb/thread.c =================================================================== --- gdb/thread.c (revision 283123) +++ gdb/thread.c (working copy) @@ -187,11 +187,11 @@ add_thread_silent (ptid_t ptid) if (ptid_equal (inferior_ptid, ptid)) { - tp = new_thread (ptid); + tp = new_thread (null_ptid); /* Make switch_to_thread not read from the thread. */ tp->state_ = THREAD_EXITED; - switch_to_thread (minus_one_ptid); + switch_to_thread (null_ptid); /* Now we can delete it. */ delete_thread (ptid);