From owner-freebsd-current@FreeBSD.ORG Tue Feb 7 03:12:14 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 DD7871065675 for ; Tue, 7 Feb 2012 03:12:14 +0000 (UTC) (envelope-from listlog2011@gmail.com) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C77508FC0A for ; Tue, 7 Feb 2012 03:12:14 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q173CDJw010478 for ; Tue, 7 Feb 2012 03:12:14 GMT (envelope-from listlog2011@gmail.com) Message-ID: <4F30968B.5060101@gmail.com> Date: Tue, 07 Feb 2012 11:12:11 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0) Gecko/20120129 Thunderbird/10.0 MIME-Version: 1.0 To: freebsd-current@freebsd.org References: <749E238A-A85F-4264-9DEB-BCE1BBD21C9D@juniper.net> <20120125074824.GD2726@deviant.kiev.zoral.com.ua> <4F2094B4.70707@juniper.net> In-Reply-To: <4F2094B4.70707@juniper.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [ptrace] please review follow fork/exec changes X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: davidxu@freebsd.org 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 03:12:14 -0000 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. Regards, David Xu