[compiler-rt] r224022 - tsan: don't subtract one from fake PCs

Dmitry Vyukov dvyukov at google.com
Fri Dec 12 12:51:24 PST 2014


Testing this requires changes to JVM. We have tests for Java stacks in
internal codebase.


On Fri, Dec 12, 2014 at 9:39 PM, Kostya Serebryany <kcc at google.com> wrote:
> is this testable?
>
> On Thu, Dec 11, 2014 at 8:12 AM, Dmitry Vyukov <dvyukov at google.com> wrote:
>>
>> Author: dvyukov
>> Date: Thu Dec 11 10:12:16 2014
>> New Revision: 224022
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=224022&view=rev
>> Log:
>> tsan: don't subtract one from fake PCs
>>
>> These are fake and not actual PCs, more like function IDs.
>> Pass them to external symbolizer untouched.
>>
>>
>> Modified:
>>     compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
>>     compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc
>>     compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.h
>>
>> 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=224022&r1=224021&r2=224022&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc (original)
>> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc Thu Dec 11 10:12:16
>> 2014
>> @@ -111,13 +111,14 @@ static ReportStack *SymbolizeStack(Stack
>>    SymbolizedStack *top = nullptr;
>>    for (uptr si = 0; si < trace.size; si++) {
>>      const uptr pc = trace.trace[si];
>> +    uptr pc1 = pc;
>>  #ifndef SANITIZER_GO
>>      // We obtain the return address, but we're interested in the previous
>>      // instruction.
>> -    const uptr pc1 = StackTrace::GetPreviousInstructionPc(pc);
>> +    if ((pc & kExternalPCBit) == 0)
>> +      pc1 = StackTrace::GetPreviousInstructionPc(pc);
>>  #else
>>      // FIXME(dvyukov): Go sometimes uses address of a function as top pc.
>> -    uptr pc1 = pc;
>>      if (si != trace.size - 1)
>>        pc1 -= 1;
>>  #endif
>>
>> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc?rev=224022&r1=224021&r2=224022&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc (original)
>> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc Thu Dec 11 10:12:16
>> 2014
>> @@ -36,10 +36,6 @@ void ExitSymbolizer() {
>>    thr->ignore_interceptors--;
>>  }
>>
>> -// Denotes fake PC values that come from JIT/JAVA/etc.
>> -// For such PC values __tsan_symbolize_external() will be called.
>> -const uptr kExternalPCBit = 1ULL << 60;
>> -
>>  // May be overriden by JIT/JAVA/etc,
>>  // whatever produces PCs marked with kExternalPCBit.
>>  extern "C" bool __tsan_symbolize_external(uptr pc,
>>
>> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.h?rev=224022&r1=224021&r2=224022&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.h (original)
>> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.h Thu Dec 11 10:12:16
>> 2014
>> @@ -18,6 +18,10 @@
>>
>>  namespace __tsan {
>>
>> +// Denotes fake PC values that come from JIT/JAVA/etc.
>> +// For such PC values __tsan_symbolize_external() will be called.
>> +const uptr kExternalPCBit = 1ULL << 60;
>> +
>>  void EnterSymbolizer();
>>  void ExitSymbolizer();
>>  SymbolizedStack *SymbolizeCode(uptr addr);
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>



More information about the llvm-commits mailing list