[compiler-rt] r263946 - [tsan] Adding a test case for r263939 ("Add some NULL pointer checks into the debugging API")

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 09:05:43 PDT 2016


Author: kuba.brecka
Date: Mon Mar 21 11:05:42 2016
New Revision: 263946

URL: http://llvm.org/viewvc/llvm-project?rev=263946&view=rev
Log:
[tsan] Adding a test case for r263939 ("Add some NULL pointer checks into the debugging API")


Modified:
    compiler-rt/trunk/test/tsan/debugging.cc

Modified: compiler-rt/trunk/test/tsan/debugging.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/debugging.cc?rev=263946&r1=263945&r2=263946&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/debugging.cc (original)
+++ compiler-rt/trunk/test/tsan/debugging.cc Mon Mar 21 11:05:42 2016
@@ -19,6 +19,10 @@ int __tsan_get_report_data(void *report,
 int __tsan_get_report_mop(void *report, unsigned long idx, int *tid,
                           void **addr, int *size, int *write, int *atomic,
                           void **trace, unsigned long trace_size);
+int __tsan_get_report_thread(void *report, unsigned long idx, int *tid,
+                             unsigned long *pid, int *running,
+                             const char **name, int *parent_tid, void **trace,
+                             unsigned long trace_size);
 }
 
 long my_global;
@@ -82,6 +86,22 @@ void __tsan_on_report(void *report) {
   // CHECK: tid = 0, addr = [[GLOBAL]], size = 8, write = 1, atomic = 0
   fprintf(stderr, "trace[0] = %p, trace[1] = %p\n", trace[0], trace[1]);
   // CHECK: trace[0] = 0x{{[0-9a-f]+}}, trace[1] = {{0x0|\(nil\)|\(null\)}}
+
+  fprintf(stderr, "thread_count = %d\n", thread_count);
+  // CHECK: thread_count = 2
+
+  unsigned long pid;
+  int running;
+  const char *name;
+  int parent_tid;
+
+  __tsan_get_report_thread(report, 0, &tid, &pid, &running, &name, &parent_tid, trace, 16);
+  fprintf(stderr, "tid = %d\n", tid);
+  // CHECK: tid = 1
+
+  __tsan_get_report_thread(report, 1, &tid, &pid, &running, &name, &parent_tid, trace, 16);
+  fprintf(stderr, "tid = %d\n", tid);
+  // CHECK: tid = 0
 }
 
 // CHECK: Done.




More information about the llvm-commits mailing list