Index: test/sanitizer_common/TestCases/Linux/ptrace.c =================================================================== --- test/sanitizer_common/TestCases/Linux/ptrace.c +++ test/sanitizer_common/TestCases/Linux/ptrace.c @@ -1,4 +1,4 @@ -// RUN: %clangxx -O0 %s -o %t && %run %t +// RUN: %clang -O0 %s -o %t && %run %t // XFAIL: arm-linux-gnueabi // XFAIL: armv7l-unknown-linux-gnueabihf @@ -19,8 +19,10 @@ execl("/bin/true", "true", NULL); } else { wait(NULL); - user_regs_struct regs; int res; + +#if __x86_64__ + user_regs_struct regs; res = ptrace(PTRACE_GETREGS, pid, NULL, ®s); assert(!res); if (regs.rip) @@ -31,6 +33,21 @@ assert(!res); if (fpregs.mxcsr) printf("%x\n", fpregs.mxcsr); +#endif + +#if __powerpc64__ + struct pt_regs regs; + res = ptrace(PTRACE_GETREGS, pid, NULL, ®s); + assert(!res); + if (regs.nip) + printf("%lx\n", regs.nip); + + elf_fpregset_t fpregs; + res = ptrace(PTRACE_GETFPREGS, pid, NULL, &fpregs); + assert(!res); + if ((elf_greg_t)fpregs[32]) // fpscr + printf("%lx\n", (elf_greg_t)fpregs[32]); +#endif siginfo_t siginfo; res = ptrace(PTRACE_GETSIGINFO, pid, NULL, &siginfo); Index: test/sanitizer_common/TestCases/Linux/ptrace.cc =================================================================== --- test/sanitizer_common/TestCases/Linux/ptrace.cc +++ test/sanitizer_common/TestCases/Linux/ptrace.cc @@ -1,45 +0,0 @@ -// RUN: %clangxx -O0 %s -o %t && %run %t -// XFAIL: arm-linux-gnueabi -// XFAIL: armv7l-unknown-linux-gnueabihf - -#include -#include -#include -#include -#include -#include -#include -#include - -int main(void) { - pid_t pid; - pid = fork(); - if (pid == 0) { // child - ptrace(PTRACE_TRACEME, 0, NULL, NULL); - execl("/bin/true", "true", NULL); - } else { - wait(NULL); - user_regs_struct regs; - int res; - res = ptrace(PTRACE_GETREGS, pid, NULL, ®s); - assert(!res); - if (regs.rip) - printf("%zx\n", regs.rip); - - user_fpregs_struct fpregs; - res = ptrace(PTRACE_GETFPREGS, pid, NULL, &fpregs); - assert(!res); - if (fpregs.mxcsr) - printf("%x\n", fpregs.mxcsr); - - siginfo_t siginfo; - res = ptrace(PTRACE_GETSIGINFO, pid, NULL, &siginfo); - assert(!res); - assert(siginfo.si_pid == pid); - - ptrace(PTRACE_CONT, pid, NULL, NULL); - - wait(NULL); - } - return 0; -}