I know the behavior about tracee call ptrace(TRACEME) . but how about TRACE_ATTACH behavior ? here is my guess:
- tracer send SIGSTOP to tracee, the tracee SIGSTOP-handler function mark self as TRACED(but how? why it knows being traced) then send SIGTRAP to itself , the SIGTRAP-handler send SIGCHLD to tracer then pause itself. OR
- tracer send SIGSTOP to tracee, the tracee SIGSTOP-handler function mark self as TRACED(also how?) then send SIGCHLD to tracer and pause itsefl.