1 // RUN: %clangxx -O0 %s -o %t && %run %t
6 #include <sys/ptrace.h>
15 if (pid
== 0) { // child
16 ptrace(PTRACE_TRACEME
, 0, NULL
, NULL
);
17 execl("/bin/true", "true", NULL
);
20 user_regs_struct regs
;
22 res
= ptrace(PTRACE_GETREGS
, pid
, NULL
, ®s
);
25 printf("%zx\n", regs
.rip
);
27 user_fpregs_struct fpregs
;
28 res
= ptrace(PTRACE_GETFPREGS
, pid
, NULL
, &fpregs
);
31 printf("%x\n", fpregs
.mxcsr
);
34 res
= ptrace(PTRACE_GETSIGINFO
, pid
, NULL
, &siginfo
);
36 assert(siginfo
.si_pid
== pid
);
38 ptrace(PTRACE_CONT
, pid
, NULL
, NULL
);