[PATCH] correctly handle "kill -TRAP $straced_programs_pid" and int3
dvlasenk at redhat.com
Mon Dec 22 19:17:45 UTC 2008
On Tue, 2008-12-16 at 21:25 +0100, Denys Vlasenko wrote:
> 2008-12-16 Denys Vlasenko <dvlasenk at redhat.com>
> * defs.h: Add new field "sigtrap80" to struct tcb.
> * strace.c (alloc_tcb): Initialize it.
> (detach, trace): Use it in place of constant SIGTRAP.
> (trace): Set PTRACE_O_TRACESYSGOOD and PTRACE_O_TRACEEXEC
> options on newly traced threads; detect these
> options if they are inherited across clone(); detect
> and handle execve's ptrace stop; add paranoia checks
> if real SIGTRAP is seen.
> Run tested on vanilla and utrace-based kernels.
> Tested with "kill -TRAP $pid":
> strace sleep N
> strace sh -c "trap 'echo Oi' TRAP; sleep 1; sleep 1; sleep 1; sleep 1"
> strace -f -oLOG firefox
> None of the above works correctly with unpatched strace,
> with patch SIGTRAP is visible in strace and acts
> as any other signal.
I committed this patch to cvs.
I put relevant code into #ifdef LINUX as I unsure that
corresponding PTRACE_xxx constants even exist on other OSes.
Still, yell at me if something broke as a result,
and I will revert or fix it.
More information about the Strace-devel