From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28842 invoked by alias); 15 Feb 2010 09:11:22 -0000 Received: (qmail 28832 invoked by uid 22791); 15 Feb 2010 09:11:21 -0000 X-SWARE-Spam-Status: No, hits=-2.4 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; Mon, 15 Feb 2010 09:11:18 +0000 Received: (qmail 8103 invoked from network); 15 Feb 2010 09:11:16 -0000 Received: from unknown (HELO wind.localnet) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 15 Feb 2010 09:11:16 -0000 From: Vladimir Prus To: Pedro Alves , gdb-patches@sourceware.org Subject: Re: Fix a couple of multiexec races Date: Mon, 15 Feb 2010 09:11:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.31-14-generic-pae; KDE/4.3.2; i686; ; ) References: <201001131811.30403.vladimir@codesourcery.com> <201002081554.31654.pedro@codesourcery.com> In-Reply-To: <201002081554.31654.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201002151211.14059.vladimir@codesourcery.com> 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-02/txt/msg00357.txt.bz2 On Monday 08 February 2010 18:54:31 you wrote: > On Wednesday 13 January 2010 15:11:30, Vladimir Prus wrote: > > > > The attached patch fixes a couple of glitches preventing (upcoming) > > '-exec-run --all' from working. > > > > First, consider this code inside linux_nat_wait_1: > > > > if (lp > > && ptid_is_pid (ptid) > > && ptid_get_pid (lp->ptid) != ptid_get_pid (ptid)) > > { > > > > if (debug_linux_nat) > > fprintf (stderr, "LWP %ld got an event %06x, leaving pending.\n", > > ptid_get_lwp (lp->ptid), status); > > > > if (WIFSTOPPED (lp->status)) > > { > > if (WSTOPSIG (lp->status) != SIGSTOP) > > { > > stop_callback (lp, NULL); > > > > /* Resume in order to collect the sigstop. */ > > ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0); > > > > stop_wait_callback (lp, NULL); > > } > > > > Because lp->status is naturally not NULL when calling stop_callback, and because > > stop_callback has: > > > > gdb_assert (lp->status == 0); > > > > if we ever enter the inner "if", GDB will crash. Offlist, Pedro suggested the inner if be > > just removed. > > I thought about this some more, and I think this deserves more > extensive fixing. See patch (and comments in it) below, which > I've just applied. Thanks for taking care of this! -- Vladimir Prus CodeSourcery vladimir@codesourcery.com (650) 331-3385 x722