summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/sanitizer_common/CMakeLists.txt4
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_platform.h7
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_fuchsia.h40
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cc (renamed from compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_fuchsia.cc)33
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_rtems.h41
5 files changed, 104 insertions, 21 deletions
diff --git a/compiler-rt/lib/sanitizer_common/CMakeLists.txt b/compiler-rt/lib/sanitizer_common/CMakeLists.txt
index 26897d710e3..43f84d4abbb 100644
--- a/compiler-rt/lib/sanitizer_common/CMakeLists.txt
+++ b/compiler-rt/lib/sanitizer_common/CMakeLists.txt
@@ -74,10 +74,10 @@ set(SANITIZER_SYMBOLIZER_SOURCES
sanitizer_stacktrace_printer.cc
sanitizer_stacktrace_sparc.cc
sanitizer_symbolizer.cc
- sanitizer_symbolizer_fuchsia.cc
sanitizer_symbolizer_libbacktrace.cc
sanitizer_symbolizer_libcdep.cc
sanitizer_symbolizer_mac.cc
+ sanitizer_symbolizer_markup.cc
sanitizer_symbolizer_posix_libcdep.cc
sanitizer_symbolizer_report.cc
sanitizer_symbolizer_win.cc
@@ -147,9 +147,11 @@ set(SANITIZER_HEADERS
sanitizer_stoptheworld.h
sanitizer_suppressions.h
sanitizer_symbolizer.h
+ sanitizer_symbolizer_fuchsia.h
sanitizer_symbolizer_internal.h
sanitizer_symbolizer_libbacktrace.h
sanitizer_symbolizer_mac.h
+ sanitizer_symbolizer_rtems.h
sanitizer_syscall_generic.inc
sanitizer_syscall_linux_x86_64.inc
sanitizer_syscall_linux_aarch64.inc
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
index 9dd42e2098d..9caa3b9319b 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
@@ -329,4 +329,11 @@
# define SANITIZER_CACHE_LINE_SIZE 64
#endif
+// Enable offline markup symbolizer for Fuchsia and RTEMS.
+#if SANITIZER_FUCHSIA || SANITIZER_RTEMS
+#define SANITIZER_SYMBOLIZER_MARKUP 1
+#else
+#define SANITIZER_SYMBOLIZER_MARKUP 0
+#endif
+
#endif // SANITIZER_PLATFORM_H
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_fuchsia.h b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_fuchsia.h
new file mode 100644
index 00000000000..3c1c864c061
--- /dev/null
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_fuchsia.h
@@ -0,0 +1,40 @@
+//===-- sanitizer_symbolizer_fuchsia.h -----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is shared between various sanitizers' runtime libraries.
+//
+// Define Fuchsia's string formats and limits for the markup symbolizer.
+//===----------------------------------------------------------------------===//
+#ifndef SANITIZER_SYMBOLIZER_FUCHSIA_H
+#define SANITIZER_SYMBOLIZER_FUCHSIA_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:%u:%p}}}";
+
+} // namespace __sanitizer
+
+#endif // SANITIZER_SYMBOLIZER_FUCHSIA_H
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_fuchsia.cc b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cc
index 3a1227e9c6c..c62dc90fabb 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_fuchsia.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_markup.cc
@@ -1,4 +1,4 @@
-//===-- sanitizer_symbolizer_fuchsia.cc -----------------------------------===//
+//===-- sanitizer_symbolizer_markup.cc ------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -9,13 +9,17 @@
//
// This file is shared between various sanitizers' runtime libraries.
//
-// Implementation of Fuchsia-specific symbolizer.
+// Implementation of offline markup symbolizer.
//===----------------------------------------------------------------------===//
#include "sanitizer_platform.h"
-#if SANITIZER_FUCHSIA
+#if SANITIZER_SYMBOLIZER_MARKUP
-#include "sanitizer_fuchsia.h"
+#if SANITIZER_FUCHSIA
+#include "sanitizer_symbolizer_fuchsia.h"
+#elif SANITIZER_RTEMS
+#include "sanitizer_symbolizer_rtems.h"
+#endif
#include "sanitizer_stacktrace.h"
#include "sanitizer_symbolizer.h"
@@ -24,7 +28,8 @@
namespace __sanitizer {
-// For Fuchsia we don't do any actual symbolization per se.
+// This generic support for offline symbolizing is based on the
+// Fuchsia port. We don't do any actual symbolization per se.
// Instead, we emit text containing raw addresses and raw linkage
// symbol names, embedded in Fuchsia's symbolization markup format.
// Fuchsia's logging infrastructure emits enough information about
@@ -33,20 +38,6 @@ namespace __sanitizer {
// 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:%u:%p}}}";
-
-// This is used by UBSan for type names, and by ASan for global variable names.
// It's expected to return a static buffer that will be reused on each call.
const char *Symbolizer::Demangle(const char *name) {
static char buffer[kFormatDemangleMax];
@@ -111,6 +102,7 @@ void ReportDeadlySignal(const SignalContext &sig, u32 tid,
UnwindSignalStackCallbackType unwind,
const void *unwind_context) {}
+#if SANITIZER_CAN_SLOW_UNWIND
struct UnwindTraceArg {
BufferedStackTrace *stack;
u32 max_depth;
@@ -146,7 +138,8 @@ void BufferedStackTrace::SlowUnwindStackWithContext(uptr pc, void *context,
CHECK_NE(context, nullptr);
UNREACHABLE("signal context doesn't exist");
}
+#endif // SANITIZER_CAN_SLOW_UNWIND
} // namespace __sanitizer
-#endif // SANITIZER_FUCHSIA
+#endif // SANITIZER_SYMBOLIZER_MARKUP
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_rtems.h b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_rtems.h
new file mode 100644
index 00000000000..62356ef6ef7
--- /dev/null
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_rtems.h
@@ -0,0 +1,41 @@
+//===-- sanitizer_symbolizer_rtems.h -----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is shared between various sanitizers' runtime libraries.
+//
+// Define RTEMS's string formats and limits for the markup symbolizer.
+//===----------------------------------------------------------------------===//
+#ifndef SANITIZER_SYMBOLIZER_RTEMS_H
+#define SANITIZER_SYMBOLIZER_RTEMS_H
+
+#include "sanitizer_internal_defs.h"
+
+namespace __sanitizer {
+
+// The Myriad RTEMS symbolizer currently only parses backtrace lines,
+// so use a format that the symbolizer understands. For other
+// markups, keep them the same as the Fuchsia's.
+
+// 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 = " [%u] IP: %p";
+
+} // namespace __sanitizer
+
+#endif // SANITIZER_SYMBOLIZER_RTEMS_H
OpenPOWER on IntegriCloud