From owner-freebsd-hackers Sat Feb 9 11:59:19 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from bingnet2.cc.binghamton.edu (bingnet2.cc.binghamton.edu [128.226.1.18]) by hub.freebsd.org (Postfix) with ESMTP id CB59537B43F for ; Sat, 9 Feb 2002 11:59:03 -0800 (PST) Received: from opal (cs.binghamton.edu [128.226.123.101]) by bingnet2.cc.binghamton.edu (8.11.6/8.11.6) with ESMTP id g19JwuQ21614; Sat, 9 Feb 2002 14:58:56 -0500 (EST) Date: Sat, 9 Feb 2002 14:58:52 -0500 (EST) From: Zhihui Zhang X-Sender: zzhang@opal To: Dag-Erling Smorgrav Cc: freebsd-hackers@freebsd.org Subject: Re: Ptrace and SIGTRAP problem In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I have tested four cases: - PT_CONTINUE + waitpid() works fine, the trace program prints out values. - PT_CONTINUE alone does not work but no core-dump caused by SIGTRAP - PT_DETACH + waitpid() does not work and core-dump - PT_DETACH alone does not work and core-dump. Who is sending the SIGRAP (5) signal? The same program works fine on SunOS. Maybe there is a bug in the kernel. I have looked into sys_process.c and still have no idea. -Zhihui On 9 Feb 2002, Dag-Erling Smorgrav wrote: > Zhihui Zhang writes: > > The following small program demonstrates that a parent process can write > > into the data space of its child by ptrace(). If the parent waits for the > > child to exit, there is no problem. However, if the parent does not do so, > > the child will get a SIGTRAP signal and core dumps. Can anyone give me a > > clue how this is the case? Thanks! > > The parent must either detach from the child, or wait for it to > terminate. See ptrace(2). > > DES > -- > Dag-Erling Smorgrav - des@ofug.org > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message