aboutsummaryrefslogtreecommitdiff
path: root/lib/libtsan/sanitizer_common/sanitizer_symbolizer_markup_constants.h
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-04-12 18:14:17 +0200
committerGitHub <noreply@github.com>2025-04-12 18:14:17 +0200
commit9352f379e8a08bcc5a3bfc851bfb6c6a662000af (patch)
tree9fee8a3b98ab806c02aab3a6e9646ccea08f40f1 /lib/libtsan/sanitizer_common/sanitizer_symbolizer_markup_constants.h
parent4e700fdf8ed01e7fc856e631ceffd6006e6f48df (diff)
parent1f896c1bf89aa0e3d2a0dce1f4cf6ba6ce5ae9ed (diff)
downloadzig-9352f379e8a08bcc5a3bfc851bfb6c6a662000af.tar.gz
zig-9352f379e8a08bcc5a3bfc851bfb6c6a662000af.zip
Merge pull request #23529 from alexrp/2879-groundwork
Introduce libzigc for libc function implementations in Zig
Diffstat (limited to 'lib/libtsan/sanitizer_common/sanitizer_symbolizer_markup_constants.h')
-rw-r--r--lib/libtsan/sanitizer_common/sanitizer_symbolizer_markup_constants.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/libtsan/sanitizer_common/sanitizer_symbolizer_markup_constants.h b/lib/libtsan/sanitizer_common/sanitizer_symbolizer_markup_constants.h
new file mode 100644
index 0000000000..a43661eaec
--- /dev/null
+++ b/lib/libtsan/sanitizer_common/sanitizer_symbolizer_markup_constants.h
@@ -0,0 +1,49 @@
+//===-- sanitizer_symbolizer_markup_constants.h
+//-----------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is shared between various sanitizers' runtime libraries.
+//
+// Define string formats and limits for the markup symbolizer.
+//===----------------------------------------------------------------------===//
+#ifndef SANITIZER_SYMBOLIZER_MARKUP_CONSTANTS_H
+#define SANITIZER_SYMBOLIZER_MARKUP_CONSTANTS_H
+
+#include "sanitizer_internal_defs.h"
+
+namespace __sanitizer {
+
+// See the spec at:
+// https://fuchsia.googlesource.com/zircon/+/master/docs/symbolizer_markup.md
+
+// This is used by UBSan for type names, and by ASan for global variable names.
+constexpr const char *kFormatDemangle = "{{{symbol:%s}}}";
+constexpr uptr kFormatDemangleMax = 1024; // Arbitrary.
+
+// Function name or equivalent from PC location.
+constexpr const char *kFormatFunction = "{{{pc:%p}}}";
+constexpr uptr kFormatFunctionMax = 64; // More than big enough for 64-bit hex.
+
+// Global variable name or equivalent from data memory address.
+constexpr const char *kFormatData = "{{{data:%p}}}";
+
+// One frame in a backtrace (printed on a line by itself).
+constexpr const char *kFormatFrame = "{{{bt:%d:%p}}}";
+
+// Module contextual element.
+constexpr const char *kFormatModule = "{{{module:%zu:%s:elf:%s}}}";
+
+// mmap for a module segment.
+constexpr const char *kFormatMmap = "{{{mmap:%p:0x%zx:load:%d:%s:0x%zx}}}";
+
+// Dump trigger element.
+#define FORMAT_DUMPFILE "{{{dumpfile:%s:%s}}}"
+
+} // namespace __sanitizer
+
+#endif // SANITIZER_SYMBOLIZER_MARKUP_CONSTANTS_H