[asan] Revert r201402, r201404.
[blocksruntime.git] / lib / msan / lit_tests / ptrace.cc
blobd0e83eabd6a4e22a96a7a2e5afe4f351aef1e8f0
1 // RUN: %clangxx_msan -m64 -O0 %s -o %t && %t
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>
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, &regs);
22 assert(!res);
23 if (regs.rip)
24 printf("%zx\n", regs.rip);
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);
32 ptrace(PTRACE_CONT, pid, NULL, NULL);
33 wait(NULL);
35 return 0;