[compiler-rt] r194580 - [Sanitizer] Use same PC threshold in slow unwinder on all platforms
Alexey Samsonov
samsonov at google.com
Wed Nov 13 07:20:11 PST 2013
Author: samsonov
Date: Wed Nov 13 09:20:10 2013
New Revision: 194580
URL: http://llvm.org/viewvc/llvm-project?rev=194580&view=rev
Log:
[Sanitizer] Use same PC threshold in slow unwinder on all platforms
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc?rev=194580&r1=194579&r2=194580&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc Wed Nov 13 09:20:10 2013
@@ -161,7 +161,7 @@ void StackTrace::SlowUnwindStack(uptr pc
UnwindTraceArg arg = {this, Min(max_depth + 1, kStackTraceMax)};
_Unwind_Backtrace(Unwind_Trace, &arg);
// We need to pop a few frames so that pc is on top.
- uptr to_pop = LocatePcInTrace(pc, 64, 6);
+ uptr to_pop = LocatePcInTrace(pc, 6);
// trace[0] belongs to the current function so we always pop it.
if (to_pop == 0)
to_pop = 1;
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc?rev=194580&r1=194579&r2=194580&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc Wed Nov 13 09:20:10 2013
@@ -152,9 +152,12 @@ static bool MatchPc(uptr cur_pc, uptr tr
}
uptr
-StackTrace::LocatePcInTrace(uptr pc, uptr pc_threshold, uptr max_pc_depth) {
+StackTrace::LocatePcInTrace(uptr pc, uptr max_pc_depth) {
+ // Use threshold to find PC in stack trace, as PC we want to unwind from may
+ // slightly differ from return address in the actual unwinded stack trace.
+ const int kPcThreshold = 64;
for (uptr i = 0; i < max_pc_depth && i < size; ++i) {
- if (MatchPc(pc, trace[i], pc_threshold))
+ if (MatchPc(pc, trace[i], kPcThreshold))
return i;
}
return 0;
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h?rev=194580&r1=194579&r2=194580&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h Wed Nov 13 09:20:10 2013
@@ -69,7 +69,7 @@ struct StackTrace {
uptr max_depth);
void SlowUnwindStack(uptr pc, uptr max_depth);
void PopStackFrames(uptr count);
- uptr LocatePcInTrace(uptr pc, uptr pc_threshold = 0, uptr max_pc_depth = -1);
+ uptr LocatePcInTrace(uptr pc, uptr max_pc_depth = -1);
};
} // namespace __sanitizer
More information about the llvm-commits
mailing list