I'm trying to write a program to do ptrace(PTRACE_ATTACH, pid, nullptr, nullptr)
but it returns -1
and errno is 3
(No such process). The tracee are running and kicked off by me so I guess the tracer should have permission. What should I do then?
Also ptrace seems to be on per-thread basis. Is there easy way to get all the thread ids given a process id? Only way is to check /proc/{pid}/task/{tid}
? How to catch thread creation?