summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/rtl/tsan_report.cc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2012-07-06 14:54:25 +0000
committerDmitry Vyukov <dvyukov@google.com>2012-07-06 14:54:25 +0000
commite0d31e917026b8afc2a2f5827d869e3bd271d9c8 (patch)
tree73121c91f99fa935c26c821c6a32ba952b313d3c /compiler-rt/lib/tsan/rtl/tsan_report.cc
parentc65aa3f6ae4b7fe085a963eb5d4d20f17dbe864d (diff)
downloadbcm5719-llvm-e0d31e917026b8afc2a2f5827d869e3bd271d9c8.tar.gz
bcm5719-llvm-e0d31e917026b8afc2a2f5827d869e3bd271d9c8.zip
tsan: Go lang: symbolize stack traces
llvm-svn: 159827
Diffstat (limited to 'compiler-rt/lib/tsan/rtl/tsan_report.cc')
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_report.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_report.cc b/compiler-rt/lib/tsan/rtl/tsan_report.cc
index cc3b5d737a2..a4aca667972 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_report.cc
+++ b/compiler-rt/lib/tsan/rtl/tsan_report.cc
@@ -27,6 +27,8 @@ ReportDesc::ReportDesc()
ReportDesc::~ReportDesc() {
}
+#ifndef TSAN_GO
+
static void PrintHeader(ReportType typ) {
TsanPrintf("WARNING: ThreadSanitizer: ");
@@ -125,4 +127,31 @@ void PrintReport(const ReportDesc *rep) {
TsanPrintf("==================\n");
}
+#else
+
+static void PrintStack(const ReportStack *ent) {
+ for (int i = 0; ent; ent = ent->next, i++) {
+ TsanPrintf(" %s()\n %s:%d +%p\n",
+ ent->func, ent->file, ent->line, (void*)ent->pc);
+ }
+}
+
+static void PrintMop(const ReportMop *mop, bool first) {
+ TsanPrintf("%s by goroutine %d:\n",
+ (first ? (mop->write ? "Write" : "Read")
+ : (mop->write ? "Previous write" : "Previous read")),
+ mop->tid);
+ PrintStack(mop->stack);
+}
+
+void PrintReport(const ReportDesc *rep) {
+ TsanPrintf("==================\n");
+ TsanPrintf("WARNING: DATA RACE at %p\n", (void*)rep->mops[0]->addr);
+ for (uptr i = 0; i < rep->mops.Size(); i++)
+ PrintMop(rep->mops[i], i == 0);
+ TsanPrintf("==================\n");
+}
+
+#endif
+
} // namespace __tsan
OpenPOWER on IntegriCloud