Patch for kernel 2.0.3x to fix debugger reparenting problem

Philip Gladstone (philip@raptor.com)
Mon, 14 Jul 1997 19:13:31 -0400


After a grand total of 1 (one) person encouraged me, I
put together the following patch (which turned out to be
much easier than I had thought!)

Philip

--- kernel/exit.c.parent Mon Jul 14 18:17:07 1997
+++ kernel/exit.c Mon Jul 14 18:28:30 1997
@@ -532,11 +532,20 @@
while ((p = current->p_cptr) != NULL) {
current->p_cptr = p->p_osptr;
p->p_ysptr = NULL;
- p->flags &= ~(PF_PTRACED|PF_TRACESYS);
- if (task[smp_num_cpus] && task[smp_num_cpus] != current)
/* init */
- p->p_pptr = task[smp_num_cpus];
- else
- p->p_pptr = task[0];
+ if (p->flags & (PF_PTRACED | PF_TRACESYS)) {
+ /* If we are tracing, then the parent pointer
(which is the debugger)
+ * should be switched back to the original
parent (if it still
+ * exists). Happily 'forget_original_parent'
will zap the p_opptr
+ * field if the original parent has died, and
switch it to 'init'
+ */
+ p->flags &= ~(PF_PTRACED|PF_TRACESYS);
+ p->p_pptr = p->p_opptr;
+ } else {
+ if (task[smp_num_cpus] && task[smp_num_cpus] !=
current) /* init */
+ p->p_pptr = task[smp_num_cpus];
+ else
+ p->p_pptr = task[0];
+ }
p->p_osptr = p->p_pptr->p_cptr;
p->p_osptr->p_ysptr = p;
p->p_pptr->p_cptr = p;

-- 
Philip Gladstone                           +1 617 487 7700
Raptor Systems, Waltham, MA         http://www.raptor.com/