2012-11-22 23:03:11 +01:00
|
|
|
//===-- tsan_report.cc ----------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file is a part of ThreadSanitizer (TSan), a race detector.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "tsan_report.h"
|
|
|
|
#include "tsan_platform.h"
|
|
|
|
#include "tsan_rtl.h"
|
2013-11-04 22:33:31 +01:00
|
|
|
#include "sanitizer_common/sanitizer_report_decorator.h"
|
2012-11-22 23:03:11 +01:00
|
|
|
|
|
|
|
namespace __tsan {
|
|
|
|
|
2013-11-04 22:33:31 +01:00
|
|
|
class Decorator: private __sanitizer::AnsiColorDecorator {
|
|
|
|
public:
|
|
|
|
Decorator() : __sanitizer::AnsiColorDecorator(PrintsToTtyCached()) { }
|
|
|
|
const char *Warning() { return Red(); }
|
|
|
|
const char *EndWarning() { return Default(); }
|
|
|
|
const char *Access() { return Blue(); }
|
|
|
|
const char *EndAccess() { return Default(); }
|
|
|
|
const char *ThreadDescription() { return Cyan(); }
|
|
|
|
const char *EndThreadDescription() { return Default(); }
|
|
|
|
const char *Location() { return Green(); }
|
|
|
|
const char *EndLocation() { return Default(); }
|
|
|
|
const char *Sleep() { return Yellow(); }
|
|
|
|
const char *EndSleep() { return Default(); }
|
|
|
|
const char *Mutex() { return Magenta(); }
|
|
|
|
const char *EndMutex() { return Default(); }
|
|
|
|
};
|
|
|
|
|
2012-11-22 23:03:11 +01:00
|
|
|
ReportDesc::ReportDesc()
|
|
|
|
: stacks(MBlockReportStack)
|
|
|
|
, mops(MBlockReportMop)
|
|
|
|
, locs(MBlockReportLoc)
|
|
|
|
, mutexes(MBlockReportMutex)
|
|
|
|
, threads(MBlockReportThread)
|
2014-05-22 09:09:21 +02:00
|
|
|
, unique_tids(MBlockReportThread)
|
2013-11-04 22:33:31 +01:00
|
|
|
, sleep()
|
|
|
|
, count() {
|
2012-11-22 23:03:11 +01:00
|
|
|
}
|
|
|
|
|
2013-01-10 13:44:08 +01:00
|
|
|
ReportMop::ReportMop()
|
|
|
|
: mset(MBlockReportMutex) {
|
|
|
|
}
|
|
|
|
|
2012-11-22 23:03:11 +01:00
|
|
|
ReportDesc::~ReportDesc() {
|
2012-12-05 14:19:55 +01:00
|
|
|
// FIXME(dvyukov): it must be leaking a lot of memory.
|
2012-11-22 23:03:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef TSAN_GO
|
|
|
|
|
2013-01-10 13:44:08 +01:00
|
|
|
const int kThreadBufSize = 32;
|
|
|
|
const char *thread_name(char *buf, int tid) {
|
|
|
|
if (tid == 0)
|
|
|
|
return "main thread";
|
|
|
|
internal_snprintf(buf, kThreadBufSize, "thread T%d", tid);
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
2013-02-13 11:46:01 +01:00
|
|
|
static const char *ReportTypeString(ReportType typ) {
|
2012-11-22 23:03:11 +01:00
|
|
|
if (typ == ReportTypeRace)
|
2013-02-13 11:46:01 +01:00
|
|
|
return "data race";
|
2013-11-04 22:33:31 +01:00
|
|
|
if (typ == ReportTypeVptrRace)
|
|
|
|
return "data race on vptr (ctor/dtor vs virtual call)";
|
2013-02-13 11:46:01 +01:00
|
|
|
if (typ == ReportTypeUseAfterFree)
|
|
|
|
return "heap-use-after-free";
|
|
|
|
if (typ == ReportTypeThreadLeak)
|
|
|
|
return "thread leak";
|
|
|
|
if (typ == ReportTypeMutexDestroyLocked)
|
|
|
|
return "destroy of a locked mutex";
|
2014-05-22 09:09:21 +02:00
|
|
|
if (typ == ReportTypeMutexDoubleLock)
|
|
|
|
return "double lock of a mutex";
|
|
|
|
if (typ == ReportTypeMutexBadUnlock)
|
|
|
|
return "unlock of an unlocked mutex (or by a wrong thread)";
|
|
|
|
if (typ == ReportTypeMutexBadReadLock)
|
|
|
|
return "read lock of a write locked mutex";
|
|
|
|
if (typ == ReportTypeMutexBadReadUnlock)
|
|
|
|
return "read unlock of a write locked mutex";
|
2013-02-13 11:46:01 +01:00
|
|
|
if (typ == ReportTypeSignalUnsafe)
|
|
|
|
return "signal-unsafe call inside of a signal";
|
|
|
|
if (typ == ReportTypeErrnoInSignal)
|
|
|
|
return "signal handler spoils errno";
|
2014-05-22 09:09:21 +02:00
|
|
|
if (typ == ReportTypeDeadlock)
|
|
|
|
return "lock-order-inversion (potential deadlock)";
|
2013-02-13 11:46:01 +01:00
|
|
|
return "";
|
2012-11-22 23:03:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void PrintStack(const ReportStack *ent) {
|
2012-11-23 15:46:25 +01:00
|
|
|
if (ent == 0) {
|
|
|
|
Printf(" [failed to restore the stack]\n\n");
|
|
|
|
return;
|
|
|
|
}
|
2012-11-22 23:03:11 +01:00
|
|
|
for (int i = 0; ent; ent = ent->next, i++) {
|
2012-11-23 15:46:25 +01:00
|
|
|
Printf(" #%d %s %s:%d", i, ent->func, ent->file, ent->line);
|
2012-11-22 23:03:11 +01:00
|
|
|
if (ent->col)
|
2012-11-23 15:46:25 +01:00
|
|
|
Printf(":%d", ent->col);
|
2012-11-22 23:03:11 +01:00
|
|
|
if (ent->module && ent->offset)
|
2012-11-23 15:46:25 +01:00
|
|
|
Printf(" (%s+%p)\n", ent->module, (void*)ent->offset);
|
2012-11-22 23:03:11 +01:00
|
|
|
else
|
2012-11-23 15:46:25 +01:00
|
|
|
Printf(" (%p)\n", (void*)ent->pc);
|
2012-11-22 23:03:11 +01:00
|
|
|
}
|
2012-11-23 15:46:25 +01:00
|
|
|
Printf("\n");
|
2012-11-22 23:03:11 +01:00
|
|
|
}
|
|
|
|
|
2013-01-10 13:44:08 +01:00
|
|
|
static void PrintMutexSet(Vector<ReportMopMutex> const& mset) {
|
|
|
|
for (uptr i = 0; i < mset.Size(); i++) {
|
|
|
|
if (i == 0)
|
|
|
|
Printf(" (mutexes:");
|
|
|
|
const ReportMopMutex m = mset[i];
|
|
|
|
Printf(" %s M%llu", m.write ? "write" : "read", m.id);
|
|
|
|
Printf(i == mset.Size() - 1 ? ")" : ",");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-13 11:46:01 +01:00
|
|
|
static const char *MopDesc(bool first, bool write, bool atomic) {
|
|
|
|
return atomic ? (first ? (write ? "Atomic write" : "Atomic read")
|
|
|
|
: (write ? "Previous atomic write" : "Previous atomic read"))
|
|
|
|
: (first ? (write ? "Write" : "Read")
|
|
|
|
: (write ? "Previous write" : "Previous read"));
|
|
|
|
}
|
|
|
|
|
2012-11-22 23:03:11 +01:00
|
|
|
static void PrintMop(const ReportMop *mop, bool first) {
|
2013-11-04 22:33:31 +01:00
|
|
|
Decorator d;
|
2013-01-10 13:44:08 +01:00
|
|
|
char thrbuf[kThreadBufSize];
|
2013-11-04 22:33:31 +01:00
|
|
|
Printf("%s", d.Access());
|
2013-01-10 13:44:08 +01:00
|
|
|
Printf(" %s of size %d at %p by %s",
|
2013-02-13 11:46:01 +01:00
|
|
|
MopDesc(first, mop->write, mop->atomic),
|
2013-01-10 13:44:08 +01:00
|
|
|
mop->size, (void*)mop->addr,
|
|
|
|
thread_name(thrbuf, mop->tid));
|
|
|
|
PrintMutexSet(mop->mset);
|
|
|
|
Printf(":\n");
|
2013-11-04 22:33:31 +01:00
|
|
|
Printf("%s", d.EndAccess());
|
2012-11-22 23:03:11 +01:00
|
|
|
PrintStack(mop->stack);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void PrintLocation(const ReportLocation *loc) {
|
2013-11-04 22:33:31 +01:00
|
|
|
Decorator d;
|
2013-01-10 13:44:08 +01:00
|
|
|
char thrbuf[kThreadBufSize];
|
2013-11-04 22:33:31 +01:00
|
|
|
bool print_stack = false;
|
|
|
|
Printf("%s", d.Location());
|
2012-11-22 23:03:11 +01:00
|
|
|
if (loc->type == ReportLocationGlobal) {
|
2013-12-05 10:18:38 +01:00
|
|
|
Printf(" Location is global '%s' of size %zu at %p (%s+%p)\n\n",
|
2013-01-23 12:41:33 +01:00
|
|
|
loc->name, loc->size, loc->addr, loc->module, loc->offset);
|
2012-11-22 23:03:11 +01:00
|
|
|
} else if (loc->type == ReportLocationHeap) {
|
2013-01-10 13:44:08 +01:00
|
|
|
char thrbuf[kThreadBufSize];
|
|
|
|
Printf(" Location is heap block of size %zu at %p allocated by %s:\n",
|
|
|
|
loc->size, loc->addr, thread_name(thrbuf, loc->tid));
|
2013-11-04 22:33:31 +01:00
|
|
|
print_stack = true;
|
2012-11-22 23:03:11 +01:00
|
|
|
} else if (loc->type == ReportLocationStack) {
|
2013-01-23 12:41:33 +01:00
|
|
|
Printf(" Location is stack of %s.\n\n", thread_name(thrbuf, loc->tid));
|
|
|
|
} else if (loc->type == ReportLocationTLS) {
|
|
|
|
Printf(" Location is TLS of %s.\n\n", thread_name(thrbuf, loc->tid));
|
2013-01-10 13:44:08 +01:00
|
|
|
} else if (loc->type == ReportLocationFD) {
|
|
|
|
Printf(" Location is file descriptor %d created by %s at:\n",
|
|
|
|
loc->fd, thread_name(thrbuf, loc->tid));
|
2013-11-04 22:33:31 +01:00
|
|
|
print_stack = true;
|
2012-11-22 23:03:11 +01:00
|
|
|
}
|
2013-11-04 22:33:31 +01:00
|
|
|
Printf("%s", d.EndLocation());
|
|
|
|
if (print_stack)
|
|
|
|
PrintStack(loc->stack);
|
2012-11-22 23:03:11 +01:00
|
|
|
}
|
|
|
|
|
2014-05-22 09:09:21 +02:00
|
|
|
static void PrintMutexShort(const ReportMutex *rm, const char *after) {
|
|
|
|
Decorator d;
|
|
|
|
Printf("%sM%zd%s%s", d.Mutex(), rm->id, d.EndMutex(), after);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void PrintMutexShortWithAddress(const ReportMutex *rm,
|
|
|
|
const char *after) {
|
|
|
|
Decorator d;
|
|
|
|
Printf("%sM%zd (%p)%s%s", d.Mutex(), rm->id, rm->addr, d.EndMutex(), after);
|
|
|
|
}
|
|
|
|
|
2012-11-22 23:03:11 +01:00
|
|
|
static void PrintMutex(const ReportMutex *rm) {
|
2013-11-04 22:33:31 +01:00
|
|
|
Decorator d;
|
2013-01-10 13:44:08 +01:00
|
|
|
if (rm->destroyed) {
|
2013-11-04 22:33:31 +01:00
|
|
|
Printf("%s", d.Mutex());
|
2013-01-10 13:44:08 +01:00
|
|
|
Printf(" Mutex M%llu is already destroyed.\n\n", rm->id);
|
2013-11-04 22:33:31 +01:00
|
|
|
Printf("%s", d.EndMutex());
|
2013-01-10 13:44:08 +01:00
|
|
|
} else {
|
2013-11-04 22:33:31 +01:00
|
|
|
Printf("%s", d.Mutex());
|
2014-05-22 09:09:21 +02:00
|
|
|
Printf(" Mutex M%llu (%p) created at:\n", rm->id, rm->addr);
|
2013-11-04 22:33:31 +01:00
|
|
|
Printf("%s", d.EndMutex());
|
2013-01-10 13:44:08 +01:00
|
|
|
PrintStack(rm->stack);
|
|
|
|
}
|
2012-11-22 23:03:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void PrintThread(const ReportThread *rt) {
|
2013-11-04 22:33:31 +01:00
|
|
|
Decorator d;
|
2012-11-22 23:03:11 +01:00
|
|
|
if (rt->id == 0) // Little sense in describing the main thread.
|
|
|
|
return;
|
2013-11-04 22:33:31 +01:00
|
|
|
Printf("%s", d.ThreadDescription());
|
2013-01-10 13:44:08 +01:00
|
|
|
Printf(" Thread T%d", rt->id);
|
2013-11-04 22:33:31 +01:00
|
|
|
if (rt->name && rt->name[0] != '\0')
|
2012-11-23 15:46:25 +01:00
|
|
|
Printf(" '%s'", rt->name);
|
2013-01-10 13:44:08 +01:00
|
|
|
char thrbuf[kThreadBufSize];
|
|
|
|
Printf(" (tid=%zu, %s) created by %s",
|
|
|
|
rt->pid, rt->running ? "running" : "finished",
|
|
|
|
thread_name(thrbuf, rt->parent_tid));
|
2012-11-22 23:03:11 +01:00
|
|
|
if (rt->stack)
|
2013-01-10 13:44:08 +01:00
|
|
|
Printf(" at:");
|
2012-11-23 15:46:25 +01:00
|
|
|
Printf("\n");
|
2013-11-04 22:33:31 +01:00
|
|
|
Printf("%s", d.EndThreadDescription());
|
2012-11-22 23:03:11 +01:00
|
|
|
PrintStack(rt->stack);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void PrintSleep(const ReportStack *s) {
|
2013-11-04 22:33:31 +01:00
|
|
|
Decorator d;
|
|
|
|
Printf("%s", d.Sleep());
|
2012-11-23 15:46:25 +01:00
|
|
|
Printf(" As if synchronized via sleep:\n");
|
2013-11-04 22:33:31 +01:00
|
|
|
Printf("%s", d.EndSleep());
|
2012-11-22 23:03:11 +01:00
|
|
|
PrintStack(s);
|
|
|
|
}
|
|
|
|
|
2013-02-13 11:46:01 +01:00
|
|
|
static ReportStack *ChooseSummaryStack(const ReportDesc *rep) {
|
|
|
|
if (rep->mops.Size())
|
|
|
|
return rep->mops[0]->stack;
|
|
|
|
if (rep->stacks.Size())
|
|
|
|
return rep->stacks[0];
|
|
|
|
if (rep->mutexes.Size())
|
|
|
|
return rep->mutexes[0]->stack;
|
|
|
|
if (rep->threads.Size())
|
|
|
|
return rep->threads[0]->stack;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReportStack *SkipTsanInternalFrames(ReportStack *ent) {
|
|
|
|
while (FrameIsInternal(ent) && ent->next)
|
|
|
|
ent = ent->next;
|
|
|
|
return ent;
|
|
|
|
}
|
|
|
|
|
2012-11-22 23:03:11 +01:00
|
|
|
void PrintReport(const ReportDesc *rep) {
|
2013-11-04 22:33:31 +01:00
|
|
|
Decorator d;
|
2012-11-23 15:46:25 +01:00
|
|
|
Printf("==================\n");
|
2013-02-13 11:46:01 +01:00
|
|
|
const char *rep_typ_str = ReportTypeString(rep->typ);
|
2013-11-04 22:33:31 +01:00
|
|
|
Printf("%s", d.Warning());
|
|
|
|
Printf("WARNING: ThreadSanitizer: %s (pid=%d)\n", rep_typ_str,
|
|
|
|
(int)internal_getpid());
|
|
|
|
Printf("%s", d.EndWarning());
|
2012-11-22 23:03:11 +01:00
|
|
|
|
2014-05-22 09:09:21 +02:00
|
|
|
if (rep->typ == ReportTypeDeadlock) {
|
|
|
|
char thrbuf[kThreadBufSize];
|
|
|
|
Printf(" Cycle in lock order graph: ");
|
|
|
|
for (uptr i = 0; i < rep->mutexes.Size(); i++)
|
|
|
|
PrintMutexShortWithAddress(rep->mutexes[i], " => ");
|
|
|
|
PrintMutexShort(rep->mutexes[0], "\n\n");
|
|
|
|
CHECK_GT(rep->mutexes.Size(), 0U);
|
|
|
|
CHECK_EQ(rep->mutexes.Size() * (flags()->second_deadlock_stack ? 2 : 1),
|
|
|
|
rep->stacks.Size());
|
|
|
|
for (uptr i = 0; i < rep->mutexes.Size(); i++) {
|
|
|
|
Printf(" Mutex ");
|
|
|
|
PrintMutexShort(rep->mutexes[(i + 1) % rep->mutexes.Size()],
|
|
|
|
" acquired here while holding mutex ");
|
|
|
|
PrintMutexShort(rep->mutexes[i], " in ");
|
|
|
|
Printf("%s", d.ThreadDescription());
|
|
|
|
Printf("%s:\n", thread_name(thrbuf, rep->unique_tids[i]));
|
|
|
|
Printf("%s", d.EndThreadDescription());
|
|
|
|
if (flags()->second_deadlock_stack) {
|
|
|
|
PrintStack(rep->stacks[2*i]);
|
|
|
|
Printf(" Mutex ");
|
|
|
|
PrintMutexShort(rep->mutexes[i],
|
|
|
|
" previously acquired by the same thread here:\n");
|
|
|
|
PrintStack(rep->stacks[2*i+1]);
|
|
|
|
} else {
|
|
|
|
PrintStack(rep->stacks[i]);
|
|
|
|
if (i == 0)
|
|
|
|
Printf(" Hint: use TSAN_OPTIONS=second_deadlock_stack=1 "
|
|
|
|
"to get more informative warning message\n\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (uptr i = 0; i < rep->stacks.Size(); i++) {
|
|
|
|
if (i)
|
|
|
|
Printf(" and:\n");
|
|
|
|
PrintStack(rep->stacks[i]);
|
|
|
|
}
|
2012-11-22 23:03:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (uptr i = 0; i < rep->mops.Size(); i++)
|
|
|
|
PrintMop(rep->mops[i], i == 0);
|
|
|
|
|
|
|
|
if (rep->sleep)
|
|
|
|
PrintSleep(rep->sleep);
|
|
|
|
|
|
|
|
for (uptr i = 0; i < rep->locs.Size(); i++)
|
|
|
|
PrintLocation(rep->locs[i]);
|
|
|
|
|
2014-05-22 09:09:21 +02:00
|
|
|
if (rep->typ != ReportTypeDeadlock) {
|
|
|
|
for (uptr i = 0; i < rep->mutexes.Size(); i++)
|
|
|
|
PrintMutex(rep->mutexes[i]);
|
|
|
|
}
|
2012-11-22 23:03:11 +01:00
|
|
|
|
|
|
|
for (uptr i = 0; i < rep->threads.Size(); i++)
|
|
|
|
PrintThread(rep->threads[i]);
|
|
|
|
|
2013-11-04 22:33:31 +01:00
|
|
|
if (rep->typ == ReportTypeThreadLeak && rep->count > 1)
|
|
|
|
Printf(" And %d more similar thread leaks.\n\n", rep->count - 1);
|
|
|
|
|
2013-02-13 11:46:01 +01:00
|
|
|
if (ReportStack *ent = SkipTsanInternalFrames(ChooseSummaryStack(rep)))
|
|
|
|
ReportErrorSummary(rep_typ_str, ent->file, ent->line, ent->func);
|
|
|
|
|
2012-11-23 15:46:25 +01:00
|
|
|
Printf("==================\n");
|
2012-11-22 23:03:11 +01:00
|
|
|
}
|
|
|
|
|
2013-11-04 22:33:31 +01:00
|
|
|
#else // #ifndef TSAN_GO
|
|
|
|
|
|
|
|
const int kMainThreadId = 1;
|
2012-11-22 23:03:11 +01:00
|
|
|
|
|
|
|
void PrintStack(const ReportStack *ent) {
|
2012-12-05 14:19:55 +01:00
|
|
|
if (ent == 0) {
|
2013-11-04 22:33:31 +01:00
|
|
|
Printf(" [failed to restore the stack]\n");
|
2012-12-05 14:19:55 +01:00
|
|
|
return;
|
|
|
|
}
|
2012-11-22 23:03:11 +01:00
|
|
|
for (int i = 0; ent; ent = ent->next, i++) {
|
2012-11-23 15:46:25 +01:00
|
|
|
Printf(" %s()\n %s:%d +0x%zx\n",
|
2012-11-22 23:03:11 +01:00
|
|
|
ent->func, ent->file, ent->line, (void*)ent->offset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void PrintMop(const ReportMop *mop, bool first) {
|
2013-11-04 22:33:31 +01:00
|
|
|
Printf("\n");
|
|
|
|
Printf("%s by ",
|
2012-11-22 23:03:11 +01:00
|
|
|
(first ? (mop->write ? "Write" : "Read")
|
2013-11-04 22:33:31 +01:00
|
|
|
: (mop->write ? "Previous write" : "Previous read")));
|
|
|
|
if (mop->tid == kMainThreadId)
|
|
|
|
Printf("main goroutine:\n");
|
|
|
|
else
|
|
|
|
Printf("goroutine %d:\n", mop->tid);
|
2012-11-22 23:03:11 +01:00
|
|
|
PrintStack(mop->stack);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void PrintThread(const ReportThread *rt) {
|
2013-11-04 22:33:31 +01:00
|
|
|
if (rt->id == kMainThreadId)
|
2012-11-22 23:03:11 +01:00
|
|
|
return;
|
2013-11-04 22:33:31 +01:00
|
|
|
Printf("\n");
|
2012-11-23 15:46:25 +01:00
|
|
|
Printf("Goroutine %d (%s) created at:\n",
|
2012-11-22 23:03:11 +01:00
|
|
|
rt->id, rt->running ? "running" : "finished");
|
|
|
|
PrintStack(rt->stack);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PrintReport(const ReportDesc *rep) {
|
2012-11-23 15:46:25 +01:00
|
|
|
Printf("==================\n");
|
2014-05-22 09:09:21 +02:00
|
|
|
if (rep->typ == ReportTypeRace) {
|
|
|
|
Printf("WARNING: DATA RACE");
|
|
|
|
for (uptr i = 0; i < rep->mops.Size(); i++)
|
|
|
|
PrintMop(rep->mops[i], i == 0);
|
|
|
|
for (uptr i = 0; i < rep->threads.Size(); i++)
|
|
|
|
PrintThread(rep->threads[i]);
|
|
|
|
} else if (rep->typ == ReportTypeDeadlock) {
|
|
|
|
Printf("WARNING: DEADLOCK\n");
|
|
|
|
for (uptr i = 0; i < rep->mutexes.Size(); i++) {
|
|
|
|
Printf("Goroutine %d lock mutex %d while holding mutex %d:\n",
|
|
|
|
999, rep->mutexes[i]->id,
|
|
|
|
rep->mutexes[(i+1) % rep->mutexes.Size()]->id);
|
|
|
|
PrintStack(rep->stacks[2*i]);
|
|
|
|
Printf("\n");
|
|
|
|
Printf("Mutex %d was previously locked here:\n",
|
|
|
|
rep->mutexes[(i+1) % rep->mutexes.Size()]->id);
|
|
|
|
PrintStack(rep->stacks[2*i + 1]);
|
|
|
|
Printf("\n");
|
|
|
|
}
|
|
|
|
}
|
2012-11-23 15:46:25 +01:00
|
|
|
Printf("==================\n");
|
2012-11-22 23:03:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
} // namespace __tsan
|