Hello

Im having a little problem using ptrace on my system.
If I use ptrace to attach to another process the child process
segfaults once I detach.
For example using this simple program.

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/wait.h>

int main(int argc, char *argv[])
{
        int pid = atoi(argv[1]);
        ptrace(PT_ATTACH, pid, 0, 0);
        wait(NULL);
        ptrace(PT_DETACH, pid, 0, 0);
        return 0;
}

Am I using ptrace incorrectly or is there perhaps a bug in ptrace that
causes the child to always segfault ?

With Regards

Gunnar

FreeBSD knut 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #0: Tue Apr 27
04:36:16 UTC 2010     gun...@knut:/usr/obj/usr/src/sys/GENERIC  amd64
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to