[TSan] skip multiple internal frames, if necessary
authorAlexey Samsonov <samsonov@google.com>
Wed, 6 Feb 2013 16:28:05 +0000 (16:28 +0000)
committerAlexey Samsonov <samsonov@google.com>
Wed, 6 Feb 2013 16:28:05 +0000 (16:28 +0000)
llvm-svn: 174516

compiler-rt/lib/tsan/rtl/tsan_report.cc
compiler-rt/lib/tsan/rtl/tsan_rtl.h
compiler-rt/lib/tsan/rtl/tsan_rtl_report.cc

index 3d2dd40..f52f456 100644 (file)
@@ -167,9 +167,9 @@ static ReportStack *ChooseSummaryStack(const ReportDesc *rep) {
   return 0;
 }
 
-static ReportStack *SkipTsanInternalFrame(ReportStack *ent) {
-  if (FrameIsInternal(ent) && ent->next)
-    return ent->next;
+ReportStack *SkipTsanInternalFrames(ReportStack *ent) {
+  while (FrameIsInternal(ent) && ent->next)
+    ent = ent->next;
   return ent;
 }
 
@@ -199,7 +199,7 @@ void PrintReport(const ReportDesc *rep) {
   for (uptr i = 0; i < rep->threads.Size(); i++)
     PrintThread(rep->threads[i]);
 
-  if (ReportStack *ent = SkipTsanInternalFrame(ChooseSummaryStack(rep)))
+  if (ReportStack *ent = SkipTsanInternalFrames(ChooseSummaryStack(rep)))
     ReportErrorSummary(rep_typ_str, ent->file, ent->line, ent->func);
 
   Printf("==================\n");
index ab51fec..e29c18b 100644 (file)
@@ -560,6 +560,7 @@ bool IsFiredSuppression(Context *ctx,
                         const StackTrace &trace);
 bool IsExpectedReport(uptr addr, uptr size);
 bool FrameIsInternal(const ReportStack *frame);
+ReportStack *SkipTsanInternalFrames(ReportStack *ent);
 
 #if defined(TSAN_DEBUG_OUTPUT) && TSAN_DEBUG_OUTPUT >= 1
 # define DPrintf Printf
index 809aac2..d909942 100644 (file)
@@ -520,17 +520,14 @@ static bool IsJavaNonsense(const ReportDesc *rep) {
           && frame->module == 0)) {
       return true;
     }
-    if (FrameIsInternal(frame)) {
-      frame = frame->next;
-      if (frame == 0
-          || (frame->func == 0 && frame->file == 0 && frame->line == 0
-            && frame->module == 0)) {
-        if (frame) {
-          FiredSuppression supp = {rep->typ, frame->pc};
-          CTX()->fired_suppressions.PushBack(supp);
-        }
-        return true;
-      }
+    frame = SkipTsanInternalFrames(frame);
+    if (frame->next == 0
+        || (frame->func == 0 && frame->file == 0 && frame->line == 0
+          && frame->module == 0)) {
+      CHECK(frame);
+      FiredSuppression supp = {rep->typ, frame->pc};
+      CTX()->fired_suppressions.PushBack(supp);
+      return true;
     }
   }
   return false;