diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2013-06-17 19:57:03 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2013-06-17 19:57:03 +0000 |
commit | e7718bcc1372d25fc21100e403cf41b166d42f9b (patch) | |
tree | 0876665ab4f01d43173724824b170f61e7b2e6e1 /lib/tsan/rtl/tsan_rtl_report.cc | |
parent | 441a21644ad802b278c45b4e87153113639b2fcc (diff) | |
download | compiler-rt-e7718bcc1372d25fc21100e403cf41b166d42f9b.tar.gz compiler-rt-e7718bcc1372d25fc21100e403cf41b166d42f9b.tar.bz2 compiler-rt-e7718bcc1372d25fc21100e403cf41b166d42f9b.tar.xz |
tsan: consistently use return pc as top frame pc
always substract 1 from the top pc
this allows to get correct stacks with -O2
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@184112 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/rtl/tsan_rtl_report.cc')
-rw-r--r-- | lib/tsan/rtl/tsan_rtl_report.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/tsan/rtl/tsan_rtl_report.cc b/lib/tsan/rtl/tsan_rtl_report.cc index 63435cf6..94419ce9 100644 --- a/lib/tsan/rtl/tsan_rtl_report.cc +++ b/lib/tsan/rtl/tsan_rtl_report.cc @@ -106,17 +106,25 @@ static ReportStack *SymbolizeStack(const StackTrace& trace) { return 0; ReportStack *stack = 0; for (uptr si = 0; si < trace.Size(); si++) { + const uptr pc = trace.Get(si); +#ifndef TSAN_GO // We obtain the return address, that is, address of the next instruction, // so offset it by 1 byte. - bool is_last = (si == trace.Size() - 1); - ReportStack *ent = SymbolizeCode(trace.Get(si) - !is_last); + const uptr pc1 = __sanitizer::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 + ReportStack *ent = SymbolizeCode(pc1); CHECK_NE(ent, 0); ReportStack *last = ent; while (last->next) { - last->pc += !is_last; + last->pc = pc; // restore original pc for report last = last->next; } - last->pc += !is_last; + last->pc = pc; // restore original pc for report last->next = stack; stack = ent; } |