Following is the source code what i am trying but it is not working.

#include
#include
#include
#include
int main()
{
int pid;
struct user_regs_struct regs,r;

if((pid=fork())==0)
{
ptrace(PTRACE_TRACEME,0,0,0);
execlp("./child","./child",NULL);
}
else
{
wait(0);
ptrace(PTRACE_GETREGS,pid,NULL,&regs);
ptrace(PTRACE_SETREGS,pid,NULL,regs);
ptrace(PTRACE_CONT,pid,0,0);
wait(0);
}
}
if i comment two ptrace call after first wait in parent the program works file
following is the system configuration
Linux 2.6.9-5.ELsmp #1 SMP Wed Jan 5 19:30:39 EST 2005 i686
i686 i386 GNU/Linux
Here child executable simply contain two printf statement.