forked from OSchip/llvm-project
[sanitizer] Simplify __sanitizer::BufferedStackTrace::UnwindImpl implementations
Intended to be NFC. D102046 relies on the refactoring for stack boundaries.
This commit is contained in:
parent
9cf6ff7aff
commit
261d6e05d5
|
@ -74,7 +74,8 @@ void __sanitizer::BufferedStackTrace::UnwindImpl(
|
|||
if (SANITIZER_MIPS && t &&
|
||||
!IsValidFrame(bp, t->stack_top(), t->stack_bottom()))
|
||||
return;
|
||||
Unwind(max_depth, pc, bp, context, 0, 0, false);
|
||||
Unwind(max_depth, pc, bp, context, t ? t->stack_top() : 0,
|
||||
t ? t->stack_bottom() : 0, false);
|
||||
}
|
||||
|
||||
// ------------------ Interface -------------- {{{1
|
||||
|
|
|
@ -35,18 +35,14 @@ void __sanitizer::BufferedStackTrace::UnwindImpl(
|
|||
uptr pc, uptr bp, void *context, bool request_fast, u32 max_depth) {
|
||||
using namespace __lsan;
|
||||
uptr stack_top = 0, stack_bottom = 0;
|
||||
ThreadContext *t;
|
||||
if (StackTrace::WillUseFastUnwind(request_fast) &&
|
||||
(t = CurrentThreadContext())) {
|
||||
if (ThreadContext *t = CurrentThreadContext()) {
|
||||
stack_top = t->stack_end();
|
||||
stack_bottom = t->stack_begin();
|
||||
}
|
||||
if (!SANITIZER_MIPS || IsValidFrame(bp, stack_top, stack_bottom)) {
|
||||
if (StackTrace::WillUseFastUnwind(request_fast))
|
||||
Unwind(max_depth, pc, bp, nullptr, stack_top, stack_bottom, true);
|
||||
else
|
||||
Unwind(max_depth, pc, 0, context, 0, 0, false);
|
||||
}
|
||||
if (SANITIZER_MIPS && !IsValidFrame(bp, stack_top, stack_bottom))
|
||||
return;
|
||||
bool fast = StackTrace::WillUseFastUnwind(request_fast);
|
||||
Unwind(max_depth, pc, bp, context, stack_top, stack_bottom, fast);
|
||||
}
|
||||
|
||||
using namespace __lsan;
|
||||
|
|
|
@ -308,7 +308,8 @@ void __sanitizer::BufferedStackTrace::UnwindImpl(
|
|||
if (!t || !StackTrace::WillUseFastUnwind(request_fast)) {
|
||||
// Block reports from our interceptors during _Unwind_Backtrace.
|
||||
SymbolizerScope sym_scope;
|
||||
return Unwind(max_depth, pc, bp, context, 0, 0, false);
|
||||
return Unwind(max_depth, pc, bp, context, t ? t->stack_top() : 0,
|
||||
t ? t->stack_bottom() : 0, false);
|
||||
}
|
||||
if (StackTrace::WillUseFastUnwind(request_fast))
|
||||
Unwind(max_depth, pc, bp, nullptr, t->stack_top(), t->stack_bottom(), true);
|
||||
|
|
|
@ -54,10 +54,8 @@ void __sanitizer::BufferedStackTrace::UnwindImpl(
|
|||
uptr pc, uptr bp, void *context, bool request_fast, u32 max_depth) {
|
||||
uptr top = 0;
|
||||
uptr bottom = 0;
|
||||
if (StackTrace::WillUseFastUnwind(request_fast)) {
|
||||
GetThreadStackTopAndBottom(false, &top, &bottom);
|
||||
Unwind(max_depth, pc, bp, nullptr, top, bottom, true);
|
||||
} else
|
||||
Unwind(max_depth, pc, 0, context, 0, 0, false);
|
||||
bool fast = StackTrace::WillUseFastUnwind(request_fast);
|
||||
Unwind(max_depth, pc, bp, context, top, bottom, fast);
|
||||
}
|
||||
#endif // SANITIZER_GO
|
||||
|
|
|
@ -20,11 +20,9 @@ void __sanitizer::BufferedStackTrace::UnwindImpl(
|
|||
uptr pc, uptr bp, void *context, bool request_fast, u32 max_depth) {
|
||||
uptr top = 0;
|
||||
uptr bottom = 0;
|
||||
if (StackTrace::WillUseFastUnwind(request_fast)) {
|
||||
GetThreadStackTopAndBottom(false, &top, &bottom);
|
||||
Unwind(max_depth, pc, bp, nullptr, top, bottom, true);
|
||||
} else
|
||||
Unwind(max_depth, pc, bp, context, 0, 0, false);
|
||||
bool fast = StackTrace::WillUseFastUnwind(request_fast);
|
||||
Unwind(max_depth, pc, bp, context, top, bottom, fast);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
|
Loading…
Reference in New Issue