forked from OSchip/llvm-project
[Sanitizer] Use same PC threshold in slow unwinder on all platforms
llvm-svn: 194580
This commit is contained in:
parent
9ff4598225
commit
cf6ac12e23
|
@ -161,7 +161,7 @@ void StackTrace::SlowUnwindStack(uptr pc, uptr max_depth) {
|
|||
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;
|
||||
|
|
|
@ -152,9 +152,12 @@ static bool MatchPc(uptr cur_pc, uptr trace_pc, uptr threshold) {
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue