From: Mitch Phillips <31459023+hctim@users.noreply.github.com> Date: Mon, 12 Dec 2022 21:53:08 +0000 (-0800) Subject: [GWP-ASan] Fix sanitizer backtrace util using wrong print. X-Git-Tag: upstream/17.0.6~24155 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f529a9f324a8eb4a0f2c5e662b6c57a6a775d62f;p=platform%2Fupstream%2Fllvm.git [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 --- 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 e6cce86..f8b9cbd 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