From owner-freebsd-current@FreeBSD.ORG Tue Feb 7 19:03:45 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C2931065687; Tue, 7 Feb 2012 19:03:45 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 03B748FC12; Tue, 7 Feb 2012 19:03:45 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id AA96B46B32; Tue, 7 Feb 2012 14:03:44 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 12A64B924; Tue, 7 Feb 2012 14:03:44 -0500 (EST) From: John Baldwin To: freebsd-current@freebsd.org, davidxu@freebsd.org Date: Tue, 7 Feb 2012 13:40:01 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <749E238A-A85F-4264-9DEB-BCE1BBD21C9D@juniper.net> <4F2094B4.70707@juniper.net> <4F30968B.5060101@gmail.com> In-Reply-To: <4F30968B.5060101@gmail.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201202071340.01126.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 07 Feb 2012 14:03:44 -0500 (EST) Cc: Subject: Re: [ptrace] please review follow fork/exec changes X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2012 19:03:45 -0000 On Monday, February 06, 2012 10:12:11 pm David Xu wrote: > On 2012/1/26 7:48, Dmitry Mikulin wrote: > > > > > The debugger needs to intercept fork() in both parent and child so it > > can detach from the old process and attach to the new one. Maybe it'll > > make more sense in the context of gdb changes. Should I send them too? > > Don't think Marcel included that patch... > > > >> > >> Does the orphan list change intended to not lost the child after fork ? > >> But the child shall be traced, so debugger would get the SIGTRAP on > >> the attach on fork returning to usermode. I remember that I explicitely > >> tested this when adding followfork changes. > > > > Yes, the debugger gets SIGTRAPs. The problem arises when the real > > parent of the forked process has the code to collect termination > > status. Since attaching to a process changes the parent/child > > relationships, we need to keep track of the children lost due to > > re-parenting so we can properly attribute their exit status to the > > "real" parent. > > > I recall that someone brought a topic in the list said that this should > be fixed, debugging a process should not change > parent-child relation, instead a new link list data structure should be > added to struct proc to trace debugged process, > this will make code clean with a small memory overhead. Yes, I have some old patches to start on this, but I hadn't really finished them, and it makes wait() a bit more complicated. It would be nice if ptrace() had its own pwait() or some such instead of overloading wait(). -- John Baldwin