[compiler-rt] 215a742 - [sanitizer_common] Check 'demangle' flag in StripFunctionName and DemangleFunctionName
Marco Elver via llvm-commits
llvm-commits at lists.llvm.org
Thu May 25 03:01:51 PDT 2023
Author: Marco Elver
Date: 2023-05-25T12:01:11+02:00
New Revision: 215a742b8804f33c84f866d3c5aacd8d35129c49
URL: https://github.com/llvm/llvm-project/commit/215a742b8804f33c84f866d3c5aacd8d35129c49
DIFF: https://github.com/llvm/llvm-project/commit/215a742b8804f33c84f866d3c5aacd8d35129c49.diff
LOG: [sanitizer_common] Check 'demangle' flag in StripFunctionName and DemangleFunctionName
To allow getting the original stack trace.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D151411
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
index 337e2d64b1a9..2285ad88a0cb 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp
@@ -11,12 +11,16 @@
//===----------------------------------------------------------------------===//
#include "sanitizer_stacktrace_printer.h"
+
#include "sanitizer_file.h"
+#include "sanitizer_flags.h"
#include "sanitizer_fuchsia.h"
namespace __sanitizer {
const char *StripFunctionName(const char *function) {
+ if (!common_flags()->demangle)
+ return function;
if (!function)
return nullptr;
auto try_strip = [function](const char *prefix) -> const char * {
@@ -39,7 +43,10 @@ const char *StripFunctionName(const char *function) {
#if !SANITIZER_SYMBOLIZER_MARKUP
static const char *DemangleFunctionName(const char *function) {
- if (!function) return nullptr;
+ if (!common_flags()->demangle)
+ return function;
+ if (!function)
+ return nullptr;
// NetBSD uses indirection for old threading functions for historical reasons
// The mangled names are internal implementation detail and should not be
More information about the llvm-commits
mailing list