Re: core files

Michael Elizabeth Chastain (mec@shout.net)
Tue, 29 Dec 1998 13:53:18 -0600


You can implement smart core handling in user space.

You can write a wrapper program that uses PTRACE_CONT. If the child
gets a signal that it doesn't have a handler for, then the wrapper gains
control and does whatever you want.

To be correct, the wrapper needs to use PTRACE_SYSCALL instead,
and filter the syscall event stream for calls to signal(2) so that it
knows which signals the child is handling. There is enough information
available to do this conveniently.

Or you could hack the kernel to let the parent read the child's
sig->action array in some way, such as a PTRACE_GET_SIGACTION call.

You can even implement classical core dumps by reading /proc/$child/maps,
calling /proc/$child/mem, and then writing a file named "core".
Or "core-$ARGV[0]", or whatever you want.

I've written a lot of code like this. ptrace is a great tool.

Michael Elizabeth Chastain
<mailto:mec@shout.net>
"love without fear"

-
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/