[compiler-rt] r174516 - [TSan] skip multiple internal frames, if necessary

Alexey Samsonov samsonov at google.com
Wed Feb 6 08:43:42 PST 2013


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.





On Wed, Feb 6, 2013 at 8:35 PM, Kostya Serebryany <kcc at google.com> wrote:

> Can we actually have more than one internal frame in tsan?
> When does this happen?
>
>
> On Wed, Feb 6, 2013 at 8:28 PM, Alexey Samsonov <samsonov at google.com>wrote:
>
>> Author: samsonov
>> Date: Wed Feb  6 10:28:05 2013
>> New Revision: 174516
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=174516&view=rev
>> Log:
>> [TSan] skip multiple internal frames, if necessary
>>
>> Modified:
>>     compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
>>     compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
>>     compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
>>
>> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc?rev=174516&r1=174515&r2=174516&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc (original)
>> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_report.cc Wed Feb  6 10:28:05 2013
>> @@ -167,9 +167,9 @@ static ReportStack *ChooseSummaryStack(c
>>    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");
>>
>> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h?rev=174516&r1=174515&r2=174516&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h (original)
>> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h Wed Feb  6 10:28:05 2013
>> @@ -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
>>
>> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc?rev=174516&r1=174515&r2=174516&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc (original)
>> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc Wed Feb  6 10:28:05
>> 2013
>> @@ -520,17 +520,14 @@ static bool IsJavaNonsense(const ReportD
>>            && 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;
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>


-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130206/aea0987d/attachment.html>


More information about the llvm-commits mailing list