[PATCH] D46462: [sanitizer] Allow Fuchsia symbolizer to be reused by Myriad RTEMS
Walter Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 4 13:49:28 PDT 2018
waltl created this revision.
waltl added reviewers: vitalybuka, eugenis, alekseyshl.
Herald added a subscriber: kubamracek.
Like Fuchsia, Myriad RTEMS uses an off-line symbolizer -- we just need
a custom backtrace frame string. Move this definition to
sanitizer_fuchsia.h; the corresponding RTEMS one will be added when we
add sanitizer_rtems.h.
Repository:
rL LLVM
https://reviews.llvm.org/D46462
Files:
compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.h
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_fuchsia.cc
Index: compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_fuchsia.cc
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_fuchsia.cc
+++ compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_fuchsia.cc
@@ -13,9 +13,13 @@
//===----------------------------------------------------------------------===//
#include "sanitizer_platform.h"
-#if SANITIZER_FUCHSIA
+#if SANITIZER_FUCHSIA || SANITIZER_RTEMS
+#if SANITIZER_FUCHSIA
#include "sanitizer_fuchsia.h"
+#elif SANITIZER_RTEMS
+#include "sanitizer_rtems.h"
+#endif
#include "sanitizer_stacktrace.h"
#include "sanitizer_symbolizer.h"
@@ -43,9 +47,6 @@
// 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) {
@@ -97,7 +98,7 @@
void RenderFrame(InternalScopedString *buffer, const char *format, int frame_no,
const AddressInfo &info, bool vs_style,
const char *strip_path_prefix, const char *strip_func_prefix) {
- buffer->append(kFormatFrame, frame_no, info.address);
+ buffer->append(kFormatBacktraceFrame, frame_no, info.address);
}
Symbolizer *Symbolizer::PlatformInit() {
@@ -111,6 +112,7 @@
UnwindSignalStackCallbackType unwind,
const void *unwind_context) {}
+#if !SANITIZER_RTEMS
struct UnwindTraceArg {
BufferedStackTrace *stack;
u32 max_depth;
@@ -146,6 +148,7 @@
CHECK_NE(context, nullptr);
UNREACHABLE("signal context doesn't exist");
}
+#endif // !SANITIZER_RTEMS
} // namespace __sanitizer
Index: compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.h
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.h
+++ compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.h
@@ -25,6 +25,9 @@
extern uptr MainThreadStackBase, MainThreadStackSize;
extern sanitizer_shadow_bounds_t ShadowBounds;
+// One frame in a backtrace (printed on a line by itself).
+constexpr const char *kFormatBacktraceFrame = "{{{bt:%u:%p}}}";
+
} // namespace __sanitizer
#endif // SANITIZER_FUCHSIA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46462.145279.patch
Type: text/x-patch
Size: 2502 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180504/06d6580e/attachment.bin>
More information about the llvm-commits
mailing list