forked from OSchip/llvm-project
Revert "[ubsan] Simplify ubsan_GetStackTrace"
This reverts commit 63f2d1f4d4
.
I don't quite understand why, but this causes a linker error for
me and a number of buildbots:
/home/npopov/repos/llvm-project/compiler-rt/lib/ubsan/../sanitizer_common/sanitizer_stacktrace.h:130: error: undefined reference to '__sanitizer::BufferedStackTrace::UnwindImpl(unsigned long, unsigned long, void*, bool, unsigned int)'
This commit is contained in:
parent
eb4eef9ec4
commit
69fcf6a79e
|
@ -32,9 +32,13 @@ using namespace __ubsan;
|
|||
// Windows.
|
||||
// TODO(yln): This is a temporary workaround. GetStackTrace functions will be
|
||||
// removed in the future.
|
||||
void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr pc, uptr bp,
|
||||
void *context, bool request_fast) {
|
||||
stack->Unwind(pc, bp, context, request_fast);
|
||||
void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr max_depth, uptr pc,
|
||||
uptr bp, void *context, bool request_fast) {
|
||||
uptr top = 0;
|
||||
uptr bottom = 0;
|
||||
GetThreadStackTopAndBottom(false, &top, &bottom);
|
||||
bool fast = StackTrace::WillUseFastUnwind(request_fast);
|
||||
stack->Unwind(max_depth, pc, bp, context, top, bottom, fast);
|
||||
}
|
||||
|
||||
static void MaybePrintStackTrace(uptr pc, uptr bp) {
|
||||
|
@ -44,8 +48,8 @@ static void MaybePrintStackTrace(uptr pc, uptr bp) {
|
|||
return;
|
||||
|
||||
BufferedStackTrace stack;
|
||||
ubsan_GetStackTrace(&stack, pc, bp, nullptr,
|
||||
common_flags()->fast_unwind_on_fatal);
|
||||
ubsan_GetStackTrace(&stack, kStackTraceMax, pc, bp, nullptr,
|
||||
common_flags()->fast_unwind_on_fatal);
|
||||
stack.Print();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,14 +38,15 @@ void InitializeDeadlySignals() {}
|
|||
#include "sanitizer_common/sanitizer_signal_interceptors.inc"
|
||||
|
||||
// TODO(yln): Temporary workaround. Will be removed.
|
||||
void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr pc, uptr bp,
|
||||
void *context, bool fast);
|
||||
void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr max_depth,
|
||||
uptr pc, uptr bp, void *context, bool fast);
|
||||
|
||||
namespace __ubsan {
|
||||
|
||||
static void OnStackUnwind(const SignalContext &sig, const void *,
|
||||
BufferedStackTrace *stack) {
|
||||
ubsan_GetStackTrace(stack, StackTrace::GetNextInstructionPc(sig.pc), sig.bp,
|
||||
ubsan_GetStackTrace(stack, kStackTraceMax,
|
||||
StackTrace::GetNextInstructionPc(sig.pc), sig.bp,
|
||||
sig.context, common_flags()->fast_unwind_on_fatal);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue