[compiler-rt] 69fcf6a - Revert "[ubsan] Simplify ubsan_GetStackTrace"
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 13 01:41:30 PDT 2022
Author: Nikita Popov
Date: 2022-04-13T10:41:23+02:00
New Revision: 69fcf6a79e3678c56b8a75f41f5dda5abf180533
URL: https://github.com/llvm/llvm-project/commit/69fcf6a79e3678c56b8a75f41f5dda5abf180533
DIFF: https://github.com/llvm/llvm-project/commit/69fcf6a79e3678c56b8a75f41f5dda5abf180533.diff
LOG: Revert "[ubsan] Simplify ubsan_GetStackTrace"
This reverts commit 63f2d1f4d4b8ee284b4ab977242e322a9458a168.
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)'
Added:
Modified:
compiler-rt/lib/ubsan/ubsan_diag.cpp
compiler-rt/lib/ubsan/ubsan_signals_standalone.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/ubsan/ubsan_diag.cpp b/compiler-rt/lib/ubsan/ubsan_diag.cpp
index d88b32225e80a..3673e66539d0e 100644
--- a/compiler-rt/lib/ubsan/ubsan_diag.cpp
+++ b/compiler-rt/lib/ubsan/ubsan_diag.cpp
@@ -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();
}
diff --git a/compiler-rt/lib/ubsan/ubsan_signals_standalone.cpp b/compiler-rt/lib/ubsan/ubsan_signals_standalone.cpp
index 126be527427d5..2c91db8ca3974 100644
--- a/compiler-rt/lib/ubsan/ubsan_signals_standalone.cpp
+++ b/compiler-rt/lib/ubsan/ubsan_signals_standalone.cpp
@@ -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);
}
More information about the llvm-commits
mailing list