From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21347 invoked by alias); 12 Apr 2008 00:02:32 -0000 Received: (qmail 21339 invoked by uid 22791); 12 Apr 2008 00:02:32 -0000 X-Spam-Check-By: sourceware.org Received: from qmta08.emeryville.ca.mail.comcast.net (HELO QMTA08.emeryville.ca.mail.comcast.net) (76.96.30.80) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 12 Apr 2008 00:02:00 +0000 Received: from OMTA12.emeryville.ca.mail.comcast.net ([76.96.30.44]) by QMTA08.emeryville.ca.mail.comcast.net with comcast id CAtP1Z00B0x6nqcA80g500; Sat, 12 Apr 2008 00:00:42 +0000 Received: from gateway.sf.frob.com ([76.102.158.52]) by OMTA12.emeryville.ca.mail.comcast.net with comcast id CQ1w1Z00618718U8Y00000; Sat, 12 Apr 2008 00:01:58 +0000 X-Authority-Analysis: v=1.0 c=1 a=Mp8WEBwWbE8A:10 a=EkON7fw8eWMA:10 a=RYFLW6ebtpNBegQnzZ7X4w==:17 a=mKiiwd7IL65pL26CF3UA:9 a=TQEigbuKZkkS9kACOp1nRMHME98A:4 a=MxZ3bB5I4kYA:10 Received: from magilla.localdomain (magilla.sf.frob.com [198.49.250.228]) by gateway.sf.frob.com (Postfix) with ESMTP id C2684357B; Fri, 11 Apr 2008 17:01:55 -0700 (PDT) Received: by magilla.localdomain (Postfix, from userid 5281) id 7F07A26FA5E; Fri, 11 Apr 2008 17:01:55 -0700 (PDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Jan Kratochvil X-Fcc: ~/Mail/linus Cc: Daniel Jacobowitz , Doug Evans , GDB Patches , mark.kettenis@xs4all.nl Subject: Re: [patch] Fix Linux attach to signalled/stopped processes In-Reply-To: Jan Kratochvil's message of Friday, 11 April 2008 18:18:24 +0200 <20080411161824.GA4183@host0.dyn.jankratochvil.net> References: <20080401223012.GA14076@host0.dyn.jankratochvil.net> <20080410153735.GD21662@caradoc.them.org> <20080410154839.GA5375@host0.dyn.jankratochvil.net> <20080410231205.2DBFD26F992@magilla.localdomain> <20080411161824.GA4183@host0.dyn.jankratochvil.net> X-Windows: garbage at your fingertips. Message-Id: <20080412000155.7F07A26FA5E@magilla.localdomain> Date: Sat, 12 Apr 2008 07:58:00 -0000 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-04/txt/msg00233.txt.bz2 > There is a race if: > * inferior was not stopped (a regular running process) Ah, right. You can also do: PTRACE_ATTACH -> pending SIGSTOP ... if running -> stopped, no pending SIGSTOP ... if stopped -> still stopped, pending SIGSTOP tkill (SIGSTOP, tid) -> pending SIGSTOP PTRACE_CONT, tid, 0 -> if not stopped the first time yet, ESRCH -> if stopped, wakes up, dequeues SIGSTOP wait -> always see it stop You just don't know whether you'll see one more spurious SIGSTOP or not. (Once you've waited, you can synchronously check /proc, but that doesn't tell you whether it was your spurious one or just an outside one sent right now.) Thanks, Roland