[compiler-rt] f529a9f - [GWP-ASan] Fix sanitizer backtrace util using wrong print.
Mitch Phillips via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 12 13:59:42 PST 2022
Author: Mitch Phillips
Date: 2022-12-12T13:53:11-08:00
New Revision: f529a9f324a8eb4a0f2c5e662b6c57a6a775d62f
URL: https://github.com/llvm/llvm-project/commit/f529a9f324a8eb4a0f2c5e662b6c57a6a775d62f
DIFF: https://github.com/llvm/llvm-project/commit/f529a9f324a8eb4a0f2c5e662b6c57a6a775d62f.diff
LOG: [GWP-ASan] Fix sanitizer backtrace util using wrong print.
The sanitizer backtrace is used in tests, and calling StackTrace.Print()
means that it uses the sanitizer's Printf(), rather than GWP-ASan's
Printf(). In the current code, GWP-ASan's Printf() *is* the sanitizer
print, but this isn't guaranteed to be the case, and will change in an
upcoming patch.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D139748
Added:
Modified:
compiler-rt/lib/gwp_asan/optional/backtrace_sanitizer_common.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/gwp_asan/optional/backtrace_sanitizer_common.cpp b/compiler-rt/lib/gwp_asan/optional/backtrace_sanitizer_common.cpp
index e6cce86e3b7bc..f8b9cbdb79350 100644
--- a/compiler-rt/lib/gwp_asan/optional/backtrace_sanitizer_common.cpp
+++ b/compiler-rt/lib/gwp_asan/optional/backtrace_sanitizer_common.cpp
@@ -72,7 +72,9 @@ static void PrintBacktrace(uintptr_t *Trace, size_t TraceLength,
return;
}
- StackTrace.Print();
+ __sanitizer::InternalScopedString buffer;
+ StackTrace.PrintTo(&buffer);
+ Printf("%s\n", buffer.data());
}
} // anonymous namespace
More information about the llvm-commits
mailing list