[compiler-rt] r224022 - tsan: don't subtract one from fake PCs
Dmitry Vyukov
dvyukov at google.com
Thu Dec 11 08:12:17 PST 2014
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);
More information about the llvm-commits
mailing list