[compiler-rt] r266994 - [tsan] Rename ReportThread->pid to ReportThread->os_id

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 07:49:25 PDT 2016


Author: kuba.brecka
Date: Thu Apr 21 09:49:25 2016
New Revision: 266994

URL: http://llvm.org/viewvc/llvm-project?rev=266994&view=rev
Log:
[tsan] Rename ReportThread->pid to ReportThread->os_id

The field "pid" in ReportThread is used to store the OS-provided thread ID (pthread_self or gettid). The name "pid" suggests it's a process ID, which it isn't. Let's rename it.

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


Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_debugging.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_interface.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_report.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
    compiler-rt/trunk/test/tsan/debugging.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_debugging.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_debugging.cc?rev=266994&r1=266993&r2=266994&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_debugging.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_debugging.cc Thu Apr 21 09:49:25 2016
@@ -139,14 +139,14 @@ int __tsan_get_report_mutex(void *report
 }
 
 SANITIZER_INTERFACE_ATTRIBUTE
-int __tsan_get_report_thread(void *report, uptr idx, int *tid, uptr *pid,
+int __tsan_get_report_thread(void *report, uptr idx, int *tid, uptr *os_id,
                              int *running, const char **name, int *parent_tid,
                              void **trace, uptr trace_size) {
   const ReportDesc *rep = (ReportDesc *)report;
   CHECK_LT(idx, rep->threads.Size());
   ReportThread *thread = rep->threads[idx];
   *tid = thread->id;
-  *pid = thread->pid;
+  *os_id = thread->os_id;
   *running = thread->running;
   *name = thread->name;
   *parent_tid = thread->parent_tid;

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interface.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interface.h?rev=266994&r1=266993&r2=266994&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interface.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interface.h Thu Apr 21 09:49:25 2016
@@ -124,7 +124,7 @@ int __tsan_get_report_mutex(void *report
 
 // Returns information about threads included in the report.
 SANITIZER_INTERFACE_ATTRIBUTE
-int __tsan_get_report_thread(void *report, uptr idx, int *tid, uptr *pid,
+int __tsan_get_report_thread(void *report, uptr idx, int *tid, uptr *os_id,
                              int *running, const char **name, int *parent_tid,
                              void **trace, uptr trace_size);
 

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc?rev=266994&r1=266993&r2=266994&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc Thu Apr 21 09:49:25 2016
@@ -236,7 +236,7 @@ static void PrintThread(const ReportThre
     Printf(" '%s'", rt->name);
   char thrbuf[kThreadBufSize];
   Printf(" (tid=%zu, %s) created by %s",
-    rt->pid, rt->running ? "running" : "finished",
+    rt->os_id, rt->running ? "running" : "finished",
     thread_name(thrbuf, rt->parent_tid));
   if (rt->stack)
     Printf(" at:");

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_report.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_report.h?rev=266994&r1=266993&r2=266994&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_report.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_report.h Thu Apr 21 09:49:25 2016
@@ -87,7 +87,7 @@ struct ReportLocation {
 
 struct ReportThread {
   int id;
-  uptr pid;
+  uptr os_id;
   bool running;
   char *name;
   int parent_tid;

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc?rev=266994&r1=266993&r2=266994&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc Thu Apr 21 09:49:25 2016
@@ -194,7 +194,7 @@ void ScopedReport::AddThread(const Threa
   ReportThread *rt = new(mem) ReportThread;
   rep_->threads.PushBack(rt);
   rt->id = tctx->tid;
-  rt->pid = tctx->os_id;
+  rt->os_id = tctx->os_id;
   rt->running = (tctx->status == ThreadStatusRunning);
   rt->name = internal_strdup(tctx->name);
   rt->parent_tid = tctx->parent_tid;

Modified: compiler-rt/trunk/test/tsan/debugging.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/debugging.cc?rev=266994&r1=266993&r2=266994&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/debugging.cc (original)
+++ compiler-rt/trunk/test/tsan/debugging.cc Thu Apr 21 09:49:25 2016
@@ -20,7 +20,7 @@ int __tsan_get_report_mop(void *report,
                           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,
+                             unsigned long *os_id, int *running,
                              const char **name, int *parent_tid, void **trace,
                              unsigned long trace_size);
 }
@@ -90,16 +90,16 @@ void __tsan_on_report(void *report) {
   fprintf(stderr, "thread_count = %d\n", thread_count);
   // CHECK: thread_count = 2
 
-  unsigned long pid;
+  unsigned long os_id;
   int running;
   const char *name;
   int parent_tid;
 
-  __tsan_get_report_thread(report, 0, &tid, &pid, &running, &name, &parent_tid, trace, 16);
+  __tsan_get_report_thread(report, 0, &tid, &os_id, &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);
+  __tsan_get_report_thread(report, 1, &tid, &os_id, &running, &name, &parent_tid, trace, 16);
   fprintf(stderr, "tid = %d\n", tid);
   // CHECK: tid = 0
 }




More information about the llvm-commits mailing list