1 // RUN: %clangxx_msan -m64 -O0 %s -o %t && %t
2
3 #include <assert.h>
4 #include <stdio.h>
5 #include <sys/ptrace.h>
6 #include <sys/types.h>
7 #include <sys/user.h>
8 #include <sys/wait.h>
9 #include <unistd.h>
10
main(void)11 int main(void) {
12 pid_t pid;
13 pid = fork();
14 if (pid == 0) { // child
15 ptrace(PTRACE_TRACEME, 0, NULL, NULL);
16 execl("/bin/true", "true", NULL);
17 } else {
18 wait(NULL);
19 user_regs_struct regs;
20 int res;
21 res = ptrace(PTRACE_GETREGS, pid, NULL, ®s);
22 assert(!res);
23 if (regs.rip)
24 printf("%zx\n", regs.rip);
25
26 user_fpregs_struct fpregs;
27 res = ptrace(PTRACE_GETFPREGS, pid, NULL, &fpregs);
28 assert(!res);
29 if (fpregs.mxcsr)
30 printf("%x\n", fpregs.mxcsr);
31
32 ptrace(PTRACE_CONT, pid, NULL, NULL);
33 wait(NULL);
34 }
35 return 0;
36 }
37