[compiler-rt] r230002 - [TSan][MIPS64] Fix few more test cases for MIPS64

Mohit K. Bhakkad mohit.bhakkad at imgtec.com
Fri Feb 20 01:32:46 PST 2015


Author: mohit.bhakkad
Date: Fri Feb 20 03:32:45 2015
New Revision: 230002

URL: http://llvm.org/viewvc/llvm-project?rev=230002&view=rev
Log:
[TSan][MIPS64] Fix few more test cases for MIPS64
Patch by Sagar Thakur

Reviewers: dvyukov, samsonov, kcc.

Subscribers:  dsanders, mohit.bhakkad, Anand.Takale, llvm-commits.

Differential Revision: http://reviews.llvm.org/D7290

Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
    compiler-rt/trunk/test/tsan/global_race.cc
    compiler-rt/trunk/test/tsan/global_race2.cc
    compiler-rt/trunk/test/tsan/global_race3.cc
    compiler-rt/trunk/test/tsan/map32bit.cc
    compiler-rt/trunk/test/tsan/mmap_large.cc
    compiler-rt/trunk/test/tsan/test.h

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=230002&r1=230001&r2=230002&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Fri Feb 20 03:32:45 2015
@@ -1926,9 +1926,9 @@ static void CallUserSignalHandler(Thread
   // signal; and it looks too fragile to intercept all ways to reraise a signal.
   if (flags()->report_bugs && !sync && sig != SIGTERM && errno != 99) {
     VarSizeStackTrace stack;
-    // Add 1 to pc because return address is expected,
-    // OutputReport() will undo this.
-    ObtainCurrentStack(thr, pc + 1, &stack);
+    // StackTrace::GetNestInstructionPc(pc) is used because return address is
+    // expected, OutputReport() will undo this.
+    ObtainCurrentStack(thr, StackTrace::GetNextInstructionPc(pc), &stack);
     ThreadRegistryLock l(ctx->thread_registry);
     ScopedReport rep(ReportTypeErrnoInSignal);
     if (!IsFiredSuppression(ctx, rep, stack)) {

Modified: compiler-rt/trunk/test/tsan/global_race.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/global_race.cc?rev=230002&r1=230001&r2=230002&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/global_race.cc (original)
+++ compiler-rt/trunk/test/tsan/global_race.cc Fri Feb 20 03:32:45 2015
@@ -11,9 +11,9 @@ void *Thread(void *a) {
 
 int main() {
   barrier_init(&barrier, 2);
-  // On FreeBSD, the %p conversion specifier works as 0x%x and thus does not
-  // match to the format used in the diagnotic message.
-  fprintf(stderr, "addr=0x%012lx\n", (unsigned long) GlobalData);
+  fprintf(stderr, "addr=");
+  print_address(GlobalData);
+  fprintf(stderr, "\n");
   pthread_t t;
   pthread_create(&t, 0, Thread, 0);
   GlobalData[2] = 43;

Modified: compiler-rt/trunk/test/tsan/global_race2.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/global_race2.cc?rev=230002&r1=230001&r2=230002&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/global_race2.cc (original)
+++ compiler-rt/trunk/test/tsan/global_race2.cc Fri Feb 20 03:32:45 2015
@@ -11,9 +11,9 @@ void *Thread(void *a) {
 
 int main() {
   barrier_init(&barrier, 2);
-  // On FreeBSD, the %p conversion specifier works as 0x%x and thus does not
-  // match to the format used in the diagnotic message.
-  fprintf(stderr, "addr2=0x%012lx\n", (unsigned long) &x);
+  fprintf(stderr, "addr2=");
+  print_address(&x);
+  fprintf(stderr, "\n");
   pthread_t t;
   pthread_create(&t, 0, Thread, 0);
   x = 0;

Modified: compiler-rt/trunk/test/tsan/global_race3.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/global_race3.cc?rev=230002&r1=230001&r2=230002&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/global_race3.cc (original)
+++ compiler-rt/trunk/test/tsan/global_race3.cc Fri Feb 20 03:32:45 2015
@@ -16,9 +16,9 @@ void *Thread(void *a) {
 
 int main() {
   barrier_init(&barrier, 2);
-  // On FreeBSD, the %p conversion specifier works as 0x%x and thus does not
-  // match to the format used in the diagnotic message.
-  fprintf(stderr, "addr3=0x%012lx\n", (unsigned long) XXX::YYY::ZZZ);
+  fprintf(stderr, "addr3=");
+  print_address(XXX::YYY::ZZZ);
+  fprintf(stderr, "\n");
   pthread_t t;
   pthread_create(&t, 0, Thread, 0);
   XXX::YYY::ZZZ[0] = 0;

Modified: compiler-rt/trunk/test/tsan/map32bit.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/map32bit.cc?rev=230002&r1=230001&r2=230002&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/map32bit.cc (original)
+++ compiler-rt/trunk/test/tsan/map32bit.cc Fri Feb 20 03:32:45 2015
@@ -7,6 +7,9 @@
 // Test for issue:
 // https://code.google.com/p/thread-sanitizer/issues/detail?id=5
 
+// MAP_32BIT flag for mmap is supported only for x86_64.
+// XFAIL: mips64
+
 void *Thread(void *ptr) {
   *(int*)ptr = 42;
   barrier_wait(&barrier);

Modified: compiler-rt/trunk/test/tsan/mmap_large.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/mmap_large.cc?rev=230002&r1=230001&r2=230002&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/mmap_large.cc (original)
+++ compiler-rt/trunk/test/tsan/mmap_large.cc Fri Feb 20 03:32:45 2015
@@ -5,7 +5,11 @@
 #include <sys/mman.h>
 
 int main() {
+#ifdef __x86_64__
   const size_t kLog2Size = 39;
+#elif defined(__mips64)
+  const size_t kLog2Size = 32;
+#endif
   const uintptr_t kLocation = 0x40ULL << kLog2Size;
   void *p = mmap(
       reinterpret_cast<void*>(kLocation),

Modified: compiler-rt/trunk/test/tsan/test.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/test.h?rev=230002&r1=230001&r2=230002&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/test.h (original)
+++ compiler-rt/trunk/test/tsan/test.h Fri Feb 20 03:32:45 2015
@@ -29,3 +29,12 @@ void barrier_init(pthread_barrier_t *bar
 // Default instance of the barrier, but a test can declare more manually.
 pthread_barrier_t barrier;
 
+void print_address(void *address) {
+// On FreeBSD, the %p conversion specifier works as 0x%x and thus does not match
+// to the format used in the diagnotic message.
+#ifdef __x86_64__
+  fprintf(stderr, "0x%012lx", (unsigned long) address);
+#elif defined(__mips64)
+  fprintf(stderr, "0x%010lx", (unsigned long) address);
+#endif
+}





More information about the llvm-commits mailing list