From e0d31e917026b8afc2a2f5827d869e3bd271d9c8 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 6 Jul 2012 14:54:25 +0000 Subject: tsan: Go lang: symbolize stack traces llvm-svn: 159827 --- compiler-rt/lib/tsan/rtl/tsan_report.cc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'compiler-rt/lib/tsan/rtl/tsan_report.cc') 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 -- cgit v1.2.3