I wrote a sample exercise about ptrace on how to use ptrace, but I encountered some strange problems
this is my test program:
int main(int argc, char *argv[])
{
pid_t pid = 22092;
if (ptrace(PTRACE_SEIZE, pid, NULL, NULL) == -1) {
perror("PTRACE_SEIZE");
return 1;
}
if (ptrace(PTRACE_INTERRUPT, pid, NULL, NULL) == -1) {
perror("PTRACE_CONT");
return 1;
}
return 0;
}
After the execution, my program is still executing without interruption.
I have also read the manual page, after PTRACE_SEIZE, you can use PTRACE_INTERRUPT to suspend the program. I don’t know if anyone can help me.