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.

llvm-svn: 224022
This commit is contained in:
Dmitry Vyukov 2014-12-11 16:12:16 +00:00
parent 9df08f027d
commit 4bde5c42b0
3 changed files with 7 additions and 6 deletions

View File

@ -111,13 +111,14 @@ static ReportStack *SymbolizeStack(StackTrace trace) {
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

View File

@ -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,

View File

@ -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);