Re: Allow debuger to examine real parent

From: Pavel Machek (pavel@suse.cz)
Date: Wed Mar 08 2000 - 18:19:16 EST


Hi!

> > It doesn't. ps reports the tracing process as the parent, rather than
> > reporting the original parent as the parent. AFAIK, ps gets its info from
> > /proc, and you can verify that every occurrence of 'pptr' in the proc code is
> > 'p_pptr' (referring to the parent) rather than p_opptr (referring to the
> > original parent).
>
> Hmm.. That's probably a bug. It would probably be best to export the
> original parent in the /proc setup, and make the "debugging parent"
> possibly visible some way (but the original parent should be the normal
> one).

Ok, it is a bug and here is a fix:

--- clean/fs/proc/array.c Fri Feb 11 23:11:41 2000
+++ linux/fs/proc/array.c Thu Mar 9 00:11:08 2000
@@ -151,12 +151,13 @@
                 "State:\t%s\n"
                 "Pid:\t%d\n"
                 "PPid:\t%d\n"
+ "TracerPid:\t%d\n"
                 "Uid:\t%d\t%d\t%d\t%d\n"
                 "Gid:\t%d\t%d\t%d\t%d\n"
                 "FDSize:\t%d\n"
                 "Groups:\t",
                 get_task_state(p),
- p->pid, p->p_pptr->pid,
+ p->pid, p->p_opptr->pid, p->p_pptr->pid != p->p_opptr->pid ? p->p_opptr->pid : 0,
                 p->uid, p->euid, p->suid, p->fsuid,
                 p->gid, p->egid, p->sgid, p->fsgid,
                 p->files ? p->files->max_fds : 0);
@@ -327,7 +328,7 @@
                 task->pid,
                 task->comm,
                 state,
- task->p_pptr->pid,
+ task->p_opptr->pid,
                 task->pgrp,
                 task->session,
                 task->tty ? kdev_t_to_nr(task->tty->device) : 0,

                                                                Pavel

-- 
I'm pavel@ucw.cz. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents me at discuss@linmodems.org

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Mar 15 2000 - 21:00:15 EST