Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 33 additions & 6 deletions lib/tsan/rtl/tsan_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,7 @@ static void PrintMutexShort(const ReportMutex *rm, const char *after) {
Printf("%sM%zd%s%s", d.Mutex(), rm->id, d.EndMutex(), after);
}

static void PrintMutexShortWithAddress(const ReportMutex *rm,
const char *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);
}
Expand Down Expand Up @@ -312,7 +311,13 @@ static SymbolizedStack *SkipTsanInternalFrames(SymbolizedStack *frames) {
return frames;
}

void PrintReport(const ReportDesc *rep) {
void PrintReport(const ReportDesc *rep)
{
static Vector<ReportMop*>* chkStack = new Vector<ReportMop*>(MBlockReportMop);
chkStack = ReportDesc::PrintReport(rep, chkStack);
}

void ReportDesc::PrintReport(const ReportDesc *rep) {
Decorator d;
Printf("==================\n");
const char *rep_typ_str = ReportTypeString(rep->typ);
Expand Down Expand Up @@ -389,8 +394,31 @@ void PrintReport(const ReportDesc *rep) {
Printf("==================\n");
}

#else // #if !SANITIZER_GO
Vector<ReportMop*>* ReportDesc::PrintReport(const ReportDesc *rep, Vector<ReportMop*>* memChk) {
bool flag = true;
for (uptr i = 0; i < rep->mops.Size(); i++)
{
//inserts only if unique address
for(uptr j = 0; j < (*memChk).Size(); j++)
{
flag = true;
if((void*)(*memChk)[j]->addr == (void *)(rep->mops[i])->addr)
{
flag = false;
break;
}
}
if(flag)
{
(*memChk).PushBack(rep->mops[i]);
ReportDesc::PrintReport(rep);
return memChk;
}
}
return memChk;
}

#else // #if !SANITIZER_GO
const int kMainThreadId = 1;

void PrintStack(const ReportStack *ent) {
Expand Down Expand Up @@ -479,7 +507,6 @@ void PrintReport(const ReportDesc *rep) {
}
Printf("==================\n");
}

#endif

} // namespace __tsan
} // namespace __tsan
10 changes: 9 additions & 1 deletion lib/tsan/rtl/tsan_report.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ class ReportDesc {
ReportStack *sleep;
int count;

//no reduction
static void PrintReport(const ReportDesc *rep);

//reduction on basis of reduction on mem operation (virtual address space)
static Vector<ReportMop*>* PrintReport(const ReportDesc *rep,
Vector<ReportMop*>* memChk);

ReportDesc();
~ReportDesc();

Expand All @@ -126,8 +133,9 @@ class ReportDesc {
};

// Format and output the report to the console/log. No additional logic.
void PrintReport(const ReportDesc *rep);
//void PrintReport(const ReportDesc *rep);
void PrintStack(const ReportStack *stack);
void PrintReport(const ReportDesc *rep);

} // namespace __tsan

Expand Down
3 changes: 3 additions & 0 deletions lib/tsan/rtl/tsan_rtl_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,9 @@ bool OutputReport(ThreadState *thr, const ScopedReport &srep) {
return false;
}
}

//static Vector<ReportMop*>* chkStack = new Vector<ReportMop*>(MBlockReportMop);
//chkStack = ReportDesc::PrintReport(rep, chkStack);
PrintReport(rep);
__tsan_on_report(rep);
ctx->nreported++;
Expand Down