From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29504 invoked by alias); 6 Jan 2010 16:32:09 -0000 Received: (qmail 29495 invoked by uid 22791); 6 Jan 2010 16:32:07 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS 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; Wed, 06 Jan 2010 16:32:04 +0000 Received: (qmail 2741 invoked from network); 6 Jan 2010 16:32:02 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 6 Jan 2010 16:32:02 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: RFC: fix race in multiexec case Date: Wed, 06 Jan 2010 16:32:00 -0000 User-Agent: KMail/1.9.10 Cc: Vladimir Prus References: <201001051126.58970.vladimir@codesourcery.com> In-Reply-To: <201001051126.58970.vladimir@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201001061631.59732.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-01/txt/msg00114.txt.bz2 On Tuesday 05 January 2010 08:26:58, Vladimir Prus wrote: > However, find_lwp_pid returns NULL for null_ptid, and this code segfaults. > I attach a minimal patch that appears to fix this, but I feel uneasy about it. Ah, this bit runs before the almighty context_switch line. Your fix is correct. > Maybe, inferior_ptid should be reset much earlier? Yes, at some point, we should clean this all up and context switch as soon as we see an event, like in non-stop (fetch_inferior_event). Not much point in not doing so, now that the globals that formed the supposed "context" are gone. > diff --git a/gdb/infrun.c b/gdb/infrun.c > index d8ca40d..300af62 100644 > --- a/gdb/infrun.c > +++ b/gdb/infrun.c > @@ -3232,7 +3232,8 @@ targets should add new threads to the thread list themselves in non-stop mode.") > if (ecs->event_thread->stop_signal == TARGET_SIGNAL_TRAP) > { > int thread_hop_needed = 0; > - struct address_space *aspace = get_regcache_aspace (get_current_regcache ()); > + struct address_space *aspace = > + get_regcache_aspace (get_thread_regcache (ecs->ptid)); > > /* Check if a regular breakpoint has been hit before checking > for a potential single step breakpoint. Otherwise, GDB will > This is OK. -- Pedro Alves