[compiler-rt] r221337 - Get the Linux ptrace test working on PowerPC64
Jay Foad
jay.foad at gmail.com
Wed Nov 5 00:42:48 PST 2014
Author: foad
Date: Wed Nov 5 02:42:48 2014
New Revision: 221337
URL: http://llvm.org/viewvc/llvm-project?rev=221337&view=rev
Log:
Get the Linux ptrace test working on PowerPC64
The test refers to user_regs_struct.rip so it can only ever have worked
on x86-64. Put this code inside an appropriate #if, and add a similar
case for PowerPC64. (If we do likewise for ARM we can probably remove
the XFAILs, but I have no way of testing that.)
Those changes are enough to get the test working for me on big-endian
PowerPC64 Fedora 19.
Differential Revision: http://reviews.llvm.org/D6108
Modified:
compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/ptrace.cc
Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/ptrace.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/ptrace.cc?rev=221337&r1=221336&r2=221337&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/ptrace.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/ptrace.cc Wed Nov 5 02:42:48 2014
@@ -19,8 +19,10 @@ int main(void) {
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 @@ int main(void) {
assert(!res);
if (fpregs.mxcsr)
printf("%x\n", fpregs.mxcsr);
+#endif // __x86_64__
+
+#if __powerpc64__
+ struct pt_regs regs;
+ res = ptrace((enum __ptrace_request)PTRACE_GETREGS, pid, NULL, ®s);
+ assert(!res);
+ if (regs.nip)
+ printf("%lx\n", regs.nip);
+
+ elf_fpregset_t fpregs;
+ res = ptrace((enum __ptrace_request)PTRACE_GETFPREGS, pid, NULL, &fpregs);
+ assert(!res);
+ if ((elf_greg_t)fpregs[32]) // fpscr
+ printf("%lx\n", (elf_greg_t)fpregs[32]);
+#endif // __powerpc64__
siginfo_t siginfo;
res = ptrace(PTRACE_GETSIGINFO, pid, NULL, &siginfo);
More information about the llvm-commits
mailing list