Skip to content

Commit 63f2d1f

Browse files
committed
[ubsan] Simplify ubsan_GetStackTrace
Suggested by Vitaly Buka
1 parent b0343a3 commit 63f2d1f

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

compiler-rt/lib/ubsan/ubsan_diag.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,9 @@ using namespace __ubsan;
3232
// Windows.
3333
// TODO(yln): This is a temporary workaround. GetStackTrace functions will be
3434
// removed in the future.
35-
void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr max_depth, uptr pc,
36-
uptr bp, void *context, bool request_fast) {
37-
uptr top = 0;
38-
uptr bottom = 0;
39-
GetThreadStackTopAndBottom(false, &top, &bottom);
40-
bool fast = StackTrace::WillUseFastUnwind(request_fast);
41-
stack->Unwind(max_depth, pc, bp, context, top, bottom, fast);
35+
void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr pc, uptr bp,
36+
void *context, bool request_fast) {
37+
stack->Unwind(pc, bp, context, request_fast);
4238
}
4339

4440
static void MaybePrintStackTrace(uptr pc, uptr bp) {
@@ -48,8 +44,8 @@ static void MaybePrintStackTrace(uptr pc, uptr bp) {
4844
return;
4945

5046
BufferedStackTrace stack;
51-
ubsan_GetStackTrace(&stack, kStackTraceMax, pc, bp, nullptr,
52-
common_flags()->fast_unwind_on_fatal);
47+
ubsan_GetStackTrace(&stack, pc, bp, nullptr,
48+
common_flags()->fast_unwind_on_fatal);
5349
stack.Print();
5450
}
5551

compiler-rt/lib/ubsan/ubsan_signals_standalone.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,14 @@ void InitializeDeadlySignals() {}
3838
#include "sanitizer_common/sanitizer_signal_interceptors.inc"
3939

4040
// TODO(yln): Temporary workaround. Will be removed.
41-
void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr max_depth,
42-
uptr pc, uptr bp, void *context, bool fast);
41+
void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr pc, uptr bp,
42+
void *context, bool fast);
4343

4444
namespace __ubsan {
4545

4646
static void OnStackUnwind(const SignalContext &sig, const void *,
4747
BufferedStackTrace *stack) {
48-
ubsan_GetStackTrace(stack, kStackTraceMax,
49-
StackTrace::GetNextInstructionPc(sig.pc), sig.bp,
48+
ubsan_GetStackTrace(stack, StackTrace::GetNextInstructionPc(sig.pc), sig.bp,
5049
sig.context, common_flags()->fast_unwind_on_fatal);
5150
}
5251

0 commit comments

Comments
 (0)