<div dir="ltr">I've observed this in gcc build on our buildbot. Looks like when we run symbolization on some inlined code, we may get two stack trace entries for the same function (according to the debug info) in TSan runtime. I've observed this for Clang-generated code as well.<div>
<br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 6, 2013 at 8:35 PM, Kostya Serebryany <span dir="ltr"><<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Can we actually have more than one internal frame in tsan? <div>When does this happen? </div></div><div class="HOEnZb">
<div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 6, 2013 at 8:28 PM, Alexey Samsonov <span dir="ltr"><<a href="mailto:samsonov@google.com" target="_blank">samsonov@google.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: samsonov<br>
Date: Wed Feb  6 10:28:05 2013<br>
New Revision: 174516<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=174516&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=174516&view=rev</a><br>
Log:<br>
[TSan] skip multiple internal frames, if necessary<br>
<br>
Modified:<br>
    compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc<br>
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h<br>
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc<br>
<br>
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc?rev=174516&r1=174515&r2=174516&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc?rev=174516&r1=174515&r2=174516&view=diff</a><br>


==============================================================================<br>
--- compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc (original)<br>
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc Wed Feb  6 10:28:05 2013<br>
@@ -167,9 +167,9 @@ static ReportStack *ChooseSummaryStack(c<br>
   return 0;<br>
 }<br>
<br>
-static ReportStack *SkipTsanInternalFrame(ReportStack *ent) {<br>
-  if (FrameIsInternal(ent) && ent->next)<br>
-    return ent->next;<br>
+ReportStack *SkipTsanInternalFrames(ReportStack *ent) {<br>
+  while (FrameIsInternal(ent) && ent->next)<br>
+    ent = ent->next;<br>
   return ent;<br>
 }<br>
<br>
@@ -199,7 +199,7 @@ void PrintReport(const ReportDesc *rep)<br>
   for (uptr i = 0; i < rep->threads.Size(); i++)<br>
     PrintThread(rep->threads[i]);<br>
<br>
-  if (ReportStack *ent = SkipTsanInternalFrame(ChooseSummaryStack(rep)))<br>
+  if (ReportStack *ent = SkipTsanInternalFrames(ChooseSummaryStack(rep)))<br>
     ReportErrorSummary(rep_typ_str, ent->file, ent->line, ent->func);<br>
<br>
   Printf("==================\n");<br>
<br>
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h?rev=174516&r1=174515&r2=174516&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h?rev=174516&r1=174515&r2=174516&view=diff</a><br>


==============================================================================<br>
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h (original)<br>
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h Wed Feb  6 10:28:05 2013<br>
@@ -560,6 +560,7 @@ bool IsFiredSuppression(Context *ctx,<br>
                         const StackTrace &trace);<br>
 bool IsExpectedReport(uptr addr, uptr size);<br>
 bool FrameIsInternal(const ReportStack *frame);<br>
+ReportStack *SkipTsanInternalFrames(ReportStack *ent);<br>
<br>
 #if defined(TSAN_DEBUG_OUTPUT) && TSAN_DEBUG_OUTPUT >= 1<br>
 # define DPrintf Printf<br>
<br>
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc?rev=174516&r1=174515&r2=174516&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc?rev=174516&r1=174515&r2=174516&view=diff</a><br>


==============================================================================<br>
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc (original)<br>
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc Wed Feb  6 10:28:05 2013<br>
@@ -520,17 +520,14 @@ static bool IsJavaNonsense(const ReportD<br>
           && frame->module == 0)) {<br>
       return true;<br>
     }<br>
-    if (FrameIsInternal(frame)) {<br>
-      frame = frame->next;<br>
-      if (frame == 0<br>
-          || (frame->func == 0 && frame->file == 0 && frame->line == 0<br>
-            && frame->module == 0)) {<br>
-        if (frame) {<br>
-          FiredSuppression supp = {rep->typ, frame->pc};<br>
-          CTX()->fired_suppressions.PushBack(supp);<br>
-        }<br>
-        return true;<br>
-      }<br>
+    frame = SkipTsanInternalFrames(frame);<br>
+    if (frame->next == 0<br>
+        || (frame->func == 0 && frame->file == 0 && frame->line == 0<br>
+          && frame->module == 0)) {<br>
+      CHECK(frame);<br>
+      FiredSuppression supp = {rep->typ, frame->pc};<br>
+      CTX()->fired_suppressions.PushBack(supp);<br>
+      return true;<br>
     }<br>
   }<br>
   return false;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Alexey Samsonov, MSK</div>
</div>