[compiler-rt] 63f2d1f - [ubsan] Simplify ubsan_GetStackTrace
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 13 00:32:14 PDT 2022
Author: Fangrui Song
Date: 2022-04-13T00:32:10-07:00
New Revision: 63f2d1f4d4b8ee284b4ab977242e322a9458a168
URL: https://github.com/llvm/llvm-project/commit/63f2d1f4d4b8ee284b4ab977242e322a9458a168
DIFF: https://github.com/llvm/llvm-project/commit/63f2d1f4d4b8ee284b4ab977242e322a9458a168.diff
LOG: [ubsan] Simplify ubsan_GetStackTrace
Suggested by Vitaly Buka
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 3673e66539d0e..d88b32225e80a 100644
--- a/compiler-rt/lib/ubsan/ubsan_diag.cpp
+++ b/compiler-rt/lib/ubsan/ubsan_diag.cpp
@@ -32,13 +32,9 @@ 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 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);
+void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr pc, uptr bp,
+ void *context, bool request_fast) {
+ stack->Unwind(pc, bp, context, request_fast);
}
static void MaybePrintStackTrace(uptr pc, uptr bp) {
@@ -48,8 +44,8 @@ static void MaybePrintStackTrace(uptr pc, uptr bp) {
return;
BufferedStackTrace stack;
- ubsan_GetStackTrace(&stack, kStackTraceMax, pc, bp, nullptr,
- common_flags()->fast_unwind_on_fatal);
+ ubsan_GetStackTrace(&stack, 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 2c91db8ca3974..126be527427d5 100644
--- a/compiler-rt/lib/ubsan/ubsan_signals_standalone.cpp
+++ b/compiler-rt/lib/ubsan/ubsan_signals_standalone.cpp
@@ -38,15 +38,14 @@ void InitializeDeadlySignals() {}
#include "sanitizer_common/sanitizer_signal_interceptors.inc"
// TODO(yln): Temporary workaround. Will be removed.
-void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr max_depth,
- uptr pc, uptr bp, void *context, bool fast);
+void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr pc, uptr bp,
+ void *context, bool fast);
namespace __ubsan {
static void OnStackUnwind(const SignalContext &sig, const void *,
BufferedStackTrace *stack) {
- ubsan_GetStackTrace(stack, kStackTraceMax,
- StackTrace::GetNextInstructionPc(sig.pc), sig.bp,
+ ubsan_GetStackTrace(stack, StackTrace::GetNextInstructionPc(sig.pc), sig.bp,
sig.context, common_flags()->fast_unwind_on_fatal);
}
More information about the llvm-commits
mailing list