For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > January 2008 > Re: How to trace a process with ptrace when it forks a new process









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: How to trace a process with ptrace when it forks a new process
Chris Friesen

2008-01-22, 7:27 pm

Zheng Da wrote:
> Hello,
>
> I'm programming in the Linux.
> Basically, what I want to do is:
> to trace a process,
> to trace its child too, if the process forks a child,
> and so on.


Why not use strace to watch itself trace another app to see how it does it?

Chris
Zheng Da

2008-01-22, 7:27 pm

Chris Friesen wrote:
> Zheng Da wrote:
>
> Why not use strace to watch itself trace another app to see how it does it?
>
> Chris


Actually I don't want to do it as strace does.
I only want to trace the fork(),
but as my understanding, strace traces every system call.
That's why I asked how to use PTRACE_O_TRACEFORK option in my case.
I set PTRACE_O_TRACEEXIT to trace the exit of the process. I imagine
that PTRACE_O_TRACEFORK option should work in the similar way.
But I didn't succeed.
And I searched everywhere, and didn't find any examples to show me to
use PTRACE_O_TRACEFORK option.

Zheng Da

--
Posted via a free Usenet account from http://www.teranews.com

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com