[Sanitizer] Fix debug builds of sanitizer_stacktrace_test.cpp
authorLuís Marques <luismarques@lowrisc.org>
Wed, 17 Mar 2021 15:57:00 +0000 (15:57 +0000)
committerLuís Marques <luismarques@lowrisc.org>
Wed, 17 Mar 2021 15:57:54 +0000 (15:57 +0000)
An implementation of `__sanitizer::BufferedStackTrace::UnwindImpl` is
provided per sanitizer, but there isn't one for sanitizer-common. In
non-optimized builds of the sanitizer-common tests that becomes a problem:
the test `sanitizer_stacktrace_test.cpp` won't have a reference to that
method optimized away, causing linking errors. This patch provides a dummy
implementation, which fixes those builds.

Differential Revision: https://reviews.llvm.org/D96956

compiler-rt/lib/sanitizer_common/tests/sanitizer_stacktrace_test.cpp

index af19da0..58f92fc 100644 (file)
@@ -175,4 +175,11 @@ TEST(SlowUnwindTest, ShortStackTrace) {
   EXPECT_EQ(bp, stack.top_frame_bp);
 }
 
+// Dummy implementation. This should never be called, but is required to link
+// non-optimized builds of this test.
+void BufferedStackTrace::UnwindImpl(uptr pc, uptr bp, void *context,
+                                    bool request_fast, u32 max_depth) {
+  UNIMPLEMENTED();
+}
+
 }  // namespace __sanitizer