summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_report.cc13
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_symbolize.cc6
-rw-r--r--compiler-rt/test/tsan/global_race.cc4
-rw-r--r--compiler-rt/test/tsan/simple_stack2.cc14
4 files changed, 22 insertions, 15 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_report.cc b/compiler-rt/lib/tsan/rtl/tsan_report.cc
index c5b5c743469..e2372906cbd 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_report.cc
+++ b/compiler-rt/lib/tsan/rtl/tsan_report.cc
@@ -102,10 +102,13 @@ void PrintStack(const ReportStack *ent) {
Printf(" #%d %s %s:%d", i, ent->func, ent->file, ent->line);
if (ent->col)
Printf(":%d", ent->col);
- if (ent->module && ent->offset)
- Printf(" (%s+%p)\n", ent->module, (void*)ent->offset);
- else
+ if (ent->module && ent->offset) {
+ char *stripped_module = StripModuleName(ent->module);
+ Printf(" (%s+%p)\n", stripped_module, (void*)ent->offset);
+ InternalFree(stripped_module);
+ } else {
Printf(" (%p)\n", (void*)ent->pc);
+ }
}
Printf("\n");
}
@@ -147,8 +150,10 @@ static void PrintLocation(const ReportLocation *loc) {
bool print_stack = false;
Printf("%s", d.Location());
if (loc->type == ReportLocationGlobal) {
+ char *stripped_module = StripModuleName(loc->module);
Printf(" Location is global '%s' of size %zu at %p (%s+%p)\n\n",
- loc->name, loc->size, loc->addr, loc->module, loc->offset);
+ loc->name, loc->size, loc->addr, stripped_module, loc->offset);
+ InternalFree(stripped_module);
} else if (loc->type == ReportLocationHeap) {
char thrbuf[kThreadBufSize];
Printf(" Location is heap block of size %zu at %p allocated by %s:\n",
diff --git a/compiler-rt/lib/tsan/rtl/tsan_symbolize.cc b/compiler-rt/lib/tsan/rtl/tsan_symbolize.cc
index d2ce6f32c72..451e6eb6a2e 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_symbolize.cc
+++ b/compiler-rt/lib/tsan/rtl/tsan_symbolize.cc
@@ -46,7 +46,8 @@ ReportStack *NewReportStackEntry(uptr addr) {
static ReportStack *NewReportStackEntry(const AddressInfo &info) {
ReportStack *ent = NewReportStackEntry(info.address);
- ent->module = StripModuleName(info.module);
+ if (info.module)
+ ent->module = internal_strdup(info.module);
ent->offset = info.module_offset;
if (info.function)
ent->func = internal_strdup(info.function);
@@ -127,7 +128,8 @@ ReportLocation *SymbolizeData(uptr addr) {
sizeof(ReportLocation));
internal_memset(ent, 0, sizeof(*ent));
ent->type = ReportLocationGlobal;
- ent->module = StripModuleName(info.module);
+ if (info.module)
+ ent->module = internal_strdup(info.module);
ent->offset = info.module_offset;
if (info.name)
ent->name = internal_strdup(info.name);
diff --git a/compiler-rt/test/tsan/global_race.cc b/compiler-rt/test/tsan/global_race.cc
index d74b4d52363..f4e8bc8c012 100644
--- a/compiler-rt/test/tsan/global_race.cc
+++ b/compiler-rt/test/tsan/global_race.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
+// RUN: %clangxx_tsan -O1 %s -o %T/global_race_bin && %deflake %run %T/global_race_bin | FileCheck %s
#include <pthread.h>
#include <stdio.h>
#include <stddef.h>
@@ -24,5 +24,5 @@ int main() {
// CHECK: addr=[[ADDR:0x[0-9,a-f]+]]
// CHECK: WARNING: ThreadSanitizer: data race
-// CHECK: Location is global 'GlobalData' of size 40 at [[ADDR]] ({{.*}}+0x{{[0-9,a-f]+}})
+// CHECK: Location is global 'GlobalData' of size 40 at [[ADDR]] (global_race_bin+0x{{[0-9,a-f]+}})
diff --git a/compiler-rt/test/tsan/simple_stack2.cc b/compiler-rt/test/tsan/simple_stack2.cc
index ae1c27b4dbc..df3d31ee547 100644
--- a/compiler-rt/test/tsan/simple_stack2.cc
+++ b/compiler-rt/test/tsan/simple_stack2.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
+// RUN: %clangxx_tsan -O1 %s -o %T/simple_stack2_bin && %deflake %run %T/simple_stack2_bin | FileCheck %s
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
@@ -44,10 +44,10 @@ int main() {
// CHECK: WARNING: ThreadSanitizer: data race
// CHECK-NEXT: Write of size 4 at {{.*}} by thread T1:
-// CHECK-NEXT: #0 foo1{{.*}} {{.*}}simple_stack2.cc:9{{(:3)?}} ({{.*}})
-// CHECK-NEXT: #1 bar1{{.*}} {{.*}}simple_stack2.cc:16{{(:3)?}} ({{.*}})
-// CHECK-NEXT: #2 Thread1{{.*}} {{.*}}simple_stack2.cc:34{{(:3)?}} ({{.*}})
+// CHECK-NEXT: #0 foo1{{.*}} {{.*}}simple_stack2.cc:9{{(:3)?}} (simple_stack2_bin+{{.*}})
+// CHECK-NEXT: #1 bar1{{.*}} {{.*}}simple_stack2.cc:16{{(:3)?}} (simple_stack2_bin+{{.*}})
+// CHECK-NEXT: #2 Thread1{{.*}} {{.*}}simple_stack2.cc:34{{(:3)?}} (simple_stack2_bin+{{.*}})
// CHECK: Previous read of size 4 at {{.*}} by main thread:
-// CHECK-NEXT: #0 foo2{{.*}} {{.*}}simple_stack2.cc:20{{(:3)?}} ({{.*}})
-// CHECK-NEXT: #1 bar2{{.*}} {{.*}}simple_stack2.cc:29{{(:3)?}} ({{.*}})
-// CHECK-NEXT: #2 main{{.*}} {{.*}}simple_stack2.cc:41{{(:3)?}} ({{.*}})
+// CHECK-NEXT: #0 foo2{{.*}} {{.*}}simple_stack2.cc:20{{(:3)?}} (simple_stack2_bin+{{.*}})
+// CHECK-NEXT: #1 bar2{{.*}} {{.*}}simple_stack2.cc:29{{(:3)?}} (simple_stack2_bin+{{.*}})
+// CHECK-NEXT: #2 main{{.*}} {{.*}}simple_stack2.cc:41{{(:3)?}} (simple_stack2_bin+{{.*}})
OpenPOWER on IntegriCloud