Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Mar 2009 18:46:32 +0300
From:      pluknet <pluknet@gmail.com>
To:        Gema niskazhu <gemochka@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Trying to use ptrace under FBSD
Message-ID:  <a31046fc0903170846m2b812e96l74a59d989aa55fd1@mail.gmail.com>
In-Reply-To: <84133fac0903170818j422891b2ibd0951fcced3368e@mail.gmail.com>
References:  <84133fac0903170818j422891b2ibd0951fcced3368e@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

2009/3/17 Gema niskazhu <gemochka@gmail.com>:
> Hi all!
>
> First of all sorry for my bad english.
>
> I am using Free BSD CURRENT x86_64.
>
> I am trying to  use ptrace under free bsd
>
> simply to test that it works
>
> Here is my code:
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <signal.h>
> #include <sys/ptrace.h>
> #include <sys/types.h>

There is at least an incorrect include order.
sys/types.h is a prerequisite for sys/ptrace.h

> #include <sys/wait.h>
> #include <unistd.h>
> #include <errno.h>
>
>
> main()
> {
>  int pid;
>  int wait_val;
>  long long counter = 1;
>
>  switch(pid = fork() )
>  {
>  case 0:
>
>
>  ptrace(PT_TRACE_ME, 0, 0);
>
>
>
>  execl("/bin/ls","ls",0);
>  break;
>
>  default:
>
>
>  wait(&wait_val);
>
>  while(WIFSTOPED(wait_val))
>  {
>  if (ptrace(PT_STEP, pid, *(caddr_t)1)) break;
>
>  wait(&wait_val);
>
>  counter++;
>  }
>
>
>  }
>
>  printf("==%lld\n", counter);
>
>
> }
>
> But on compilation i get smth like
>
> /usr/include/sys/ptrace.h:90: error: expected specifier-qualifier-list
> before 'lwpid_t'
> /usr/include/sys/ptrace.h:158: error: expected declaration specifiers or
> '...' before 'caddr_t'
>
> I've googled a lot but cant understand whats wrong...
>
> Any suggestions?
>
> Thanks in advance
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
>



-- 
wbr,
pluknet



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a31046fc0903170846m2b812e96l74a59d989aa55fd1>