From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11072 invoked by alias); 10 Apr 2008 23:13:12 -0000 Received: (qmail 11056 invoked by uid 22791); 10 Apr 2008 23:13:12 -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; Thu, 10 Apr 2008 23:12:50 +0000 Received: from OMTA12.emeryville.ca.mail.comcast.net ([76.96.30.44]) by QMTA08.emeryville.ca.mail.comcast.net with comcast id Bs6L1Z0070x6nqcA80MK00; Thu, 10 Apr 2008 23:11:34 +0000 Received: from gateway.sf.frob.com ([76.102.158.52]) by OMTA12.emeryville.ca.mail.comcast.net with comcast id BzCb1Z00N18718U8Y00000; Thu, 10 Apr 2008 23:12:36 +0000 X-Authority-Analysis: v=1.0 c=1 a=Mp8WEBwWbE8A:10 a=EkON7fw8eWMA:10 a=RYFLW6ebtpNBegQnzZ7X4w==:17 a=NgNQia-EQWk551qxU70A:9 a=g5FlREiIllox2E6VVwMA:7 a=UlEsLi_ZPR3nlxz8Rhe1PNqOGv0A: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 5B512357B; Thu, 10 Apr 2008 16:12:35 -0700 (PDT) Received: by magilla.localdomain (Postfix, from userid 5281) id 2DBFD26F992; Thu, 10 Apr 2008 16:12:05 -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 Thursday, 10 April 2008 17:48:39 +0200 <20080410154839.GA5375@host0.dyn.jankratochvil.net> References: <20080401223012.GA14076@host0.dyn.jankratochvil.net> <20080410153735.GD21662@caradoc.them.org> <20080410154839.GA5375@host0.dyn.jankratochvil.net> X-Zippy-Says: Laundry is the fifth dimension!! ...um...um... th' washing machine is a black hole and the pink socks are bus drivers who just fell in!! Message-Id: <20080410231205.2DBFD26F992@magilla.localdomain> Date: Fri, 11 Apr 2008 08:46: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/msg00212.txt.bz2 > As the shell already did WAITPID on the process and ate the SIGSTOP > notification so there is no other notification left there for GDB. > A process already stopped does not generate another SIGSTOP during > PTRACE_ATTACH as signals never count. To be pedantic about it: a SIGSTOP is generated, but causes no wakeup or delivery for ptrace to see (because it's already stopped). You can see the SIGSTOP pending in /proc/pid/status. Generating a SIGCONT clears any pending stop signals, so normally it's as if it never existed. But, I think if you were to do PTRACE_CONT,pid,0,0 you would make it wake up, dequeue the new SIGSTOP and then report to you for wait/SIGCHLD. And since PTRACE_CONT would give ESRCH if it weren't stopped yet, you might be able to do PTRACE_ATTACH;PTRACE_CONT;wait reliably. But don't hold me to it. Thanks, Roland