From 35744c4753d0b9b02eedbd89fffa240e1d0adaf0 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Thu, 8 May 2014 22:11:20 +0000 Subject: [PATCH] Fixup for r208066. Properly get values of PTRACE_GETREGSET/PTRACE_SETREGSET. llvm-svn: 208363 --- .../sanitizer_common/sanitizer_platform_limits_posix.cc | 3 ++- compiler-rt/test/msan/ptrace.cc | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc index cd1b189a9cb7..fdc400d0ca02 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -289,7 +289,8 @@ namespace __sanitizer { int ptrace_setfpregs = PTRACE_SETFPREGS; int ptrace_getfpxregs = PTRACE_GETFPXREGS; int ptrace_setfpxregs = PTRACE_SETFPXREGS; -#if defined(PTRACE_GETSIGINFO) && defined(PTRACE_SETSIGINFO) +#if (defined(PTRACE_GETSIGINFO) && defined(PTRACE_SETSIGINFO)) || \ + (defined(PT_GETSIGINFO) && defined(PT_SETSIGINFO)) int ptrace_getsiginfo = PTRACE_GETSIGINFO; int ptrace_setsiginfo = PTRACE_SETSIGINFO; #else diff --git a/compiler-rt/test/msan/ptrace.cc b/compiler-rt/test/msan/ptrace.cc index 1dd4fae2970d..36cd03f7bb11 100644 --- a/compiler-rt/test/msan/ptrace.cc +++ b/compiler-rt/test/msan/ptrace.cc @@ -1,6 +1,7 @@ // RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t #include +#include #include #include #include @@ -29,7 +30,13 @@ int main(void) { 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;