Date: Tue, 21 Nov 2006 09:57:53 +0100 From: des@des.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) To: Jeremie Le Hen <jeremie@le-hen.org> Cc: trowa-4 <trowa-4@yahoo.com.tw>, freebsd-hackers@freebsd.org Subject: Re: Process Debugging questions Message-ID: <86d57hjhwu.fsf@dwp.des.no> In-Reply-To: <20061120221026.GC20405@obiwan.tataz.chchile.org> (Jeremie Le Hen's message of "Mon, 20 Nov 2006 23:10:26 %2B0100") References: <571883.4868.qm@web72011.mail.tp2.yahoo.com> <86irhlfvg2.fsf@dwp.des.no> <20061120221026.GC20405@obiwan.tataz.chchile.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Jeremie Le Hen <jeremie@le-hen.org> writes: > Dag-Erling Sm=F8rgrav <des@des.no> writes: > > They both suck, for different reasons. In theory, ptrace sucks less > > than proc, but it lacks some of proc's functionality, and fixing that > > is very hard. > Would you take a little time to tell what ptrace lacks and possibly > why it is so hard, please ? The way ptrace works, you set debugging conditions using the ptrace(2) syscall and then use waitpid(2) and friends to wait for them to occur. For this to work, the traced process must be reparented to the debugger. If the traced process's real parent is waiting for its child, it will become very confused when waitpid(2) returns -1 because the child has vanished into thin air. For precisely the same reason, you can't follow forks with ptrace(). The only way I can see to solve this without modifying the ptrace API is to introduce a separate process hierarchy for traced processes. This is hard to do because you basically have to rewrite kern_wait() from scratch. The best solution would be to design a new debugging API from scratch. This is far from trivial, however, and should be done by (or in close cooperation with) someone intimately familiar with gdb(1) and similar tools. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86d57hjhwu.fsf>