From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26198 invoked by alias); 26 May 2006 02:18:46 -0000 Received: (qmail 26190 invoked by uid 22791); 26 May 2006 02:18:45 -0000 X-Spam-Check-By: sourceware.org Received: from e3.ny.us.ibm.com (HELO e3.ny.us.ibm.com) (32.97.182.143) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 26 May 2006 02:18:38 +0000 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [9.190.250.241]) by e3.ny.us.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id k4Q2IYTF024715 for ; Thu, 25 May 2006 22:18:35 -0400 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.250.237]) by sd0208e0.au.ibm.com (8.12.10/NCO/VER6.8) with ESMTP id k4Q2Ls90165958 for ; Fri, 26 May 2006 12:21:54 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id k4Q2IXVZ018254 for ; Fri, 26 May 2006 12:18:33 +1000 Received: from [9.181.133.48] ([9.181.133.48]) by d23av04.au.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id k4Q2IV8I018114; Fri, 26 May 2006 12:18:32 +1000 Date: Fri, 26 May 2006 20:57:00 -0000 From: Wu Zhou To: Daniel Jacobowitz cc: Andreas Schwab , gdb@sourceware.org Subject: Re: expected behavior when a signal is sent to the ptraced child In-Reply-To: <20060525130605.GA29966@nevyn.them.org> Message-ID: References: <20060525130605.GA29966@nevyn.them.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00373.txt.bz2 On Thu, 25 May 2006, Daniel Jacobowitz wrote: > On Thu, May 25, 2006 at 11:06:43AM +0200, Andreas Schwab wrote: > > Wu Zhou writes: > > > > > What I expect is the parent will at least output: > > > > > > stopped by signal 5 > > > > > > What is the problem here? Did I make something wrong? > > > > You need to use waitpid/wait4 and add WUNTRACED to the options parameter. > > Without that you'll never receive notification of stopped processes. > > WUNTRACED shouldn't be necessary in this case because the child is > actually ptraced. I guess Daniel is right. the manual of wait/waitpid says this about WUNTRACED: also return if a child has stopped (but not traced via ptrace). Status for traced children which have stopped is provided even if this option is not specified. In the testcase, I use PTRACE_ATTACH to trace the child. So WUNTRACED is not needed here. Thank you anyway! At least I learned that there is a WUNTRACED option to change the behavior of the delivery of a signal. it lets the child stop without tracing it. A good feature indeed, right? Regards - Wu Zhou P.S: it seems that my mail agent have some problems when connecting from home. It sent a couple repeated message. Sorry for that!