Re: strace only one child process
- From: "Kaz Kylheku" <kkylheku@xxxxxxxxx>
- Date: 21 Oct 2006 23:01:04 -0700
tmp123 wrote:
Hello,
Thanks for your time.
In the sytem I'm working, one server process creates one child process
for each client request. I like to strace one of these child process.
strace without specific options only traces the parent, and with the
"-f" option traces all childs, overloading the system.
Knows someone any trick to trace only one (or a few ones) childs.
I wonder whether the ptrace request PTRACE_TRACEME can be used to wait
for a tracing program that is not the parent of a process, but just any
random process doing a PTRACE_ATTACH.
If that's the case you could implement a little hack whereby one of the
children simply arranges to be traced, right after it is forked. That
is to say, it forks off an strace job, passing its own pid in the
command line, and then calls ptrace with PTRACE_TRACEME to wait for
strace to attach.
Such a thing, if possible, could be abstracted into a debugging
function:
void traceme(const char *cmd_fmt, ...);
Then in any process you want, just call
traceme("strace -o trace_file -p %d", (int) getpid());
and after this point you are sure that everything is traced, provided
that strace was launched successfully. Just a hypothetical idea.
Or you could get the strace code, and hack it into having the filtering
functionality that you want.
.
- References:
- strace only one child process
- From: tmp123
- strace only one child process
- Prev by Date: Re: Writing a Linux installer?
- Next by Date: Opening a /dev file from Kernel space
- Previous by thread: Re: strace only one child process
- Next by thread: Writing a Linux installer?
- Index(es):
Relevant Pages
|