Hope your program not named "./test"  ??
        I changed it to /bin/sh and it works just fine.
        It was hard to debug due to my own proggie bug :)
        bb.


#include <unistd.h>
#include <sys/types.h>
#include <sys/ptrace.h>

int main()
{
     pid_t pid;
     
     if(!(pid=fork())) {
         /* child */
         ptrace(PT_TRACE_ME, 0, 0, 0);
         puts("child speaking");
         execve("./test", NULL, NULL);          <---------- ??
     } else {
         wait(0);
         ptrace(PT_DETACH, pid, (caddr_t)1, 0); <---------- also
         exit(0);
     }
}





On Wed, 30 May 2001, Jiangyi Liu wrote:

> 
> > 
> > If i understand ptrace(2) manual page correctly,
> > you should use 
> > ptrace(PT_DETACH,pid,(caddr_t)1,0)
> > instead of 
> > ptrace(PT_DETACH,pid,0,0) .
> > 
> 
> If you read my first post again, you will know that indeed I've tried to use 
>(caddr_t)1 but failed too.
> 
> > BTW you code is *very hard to debug* on my 4.1.1 :)
> > What your uname -a tells you?
> 
> Why? My box is 4.3-STABLE.
> 
> Jiangyi
> 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to