summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc')
-rw-r--r--compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc b/compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc
new file mode 100644
index 00000000000..e50cdb0632b
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/symbolize_stack.cc
@@ -0,0 +1,28 @@
+// RUN: %clangxx -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
+
+// Test that symbolizer does not crash on frame with large function name.
+
+#include <sanitizer/common_interface_defs.h>
+#include <vector>
+
+template <int N> struct A {
+ template <class T> void RecursiveTemplateFunction(const T &t);
+};
+
+template <int N>
+template <class T>
+__attribute__((noinline)) void A<N>::RecursiveTemplateFunction(const T &) {
+ std::vector<T> t;
+ return A<N - 1>().RecursiveTemplateFunction(t);
+}
+
+template <>
+template <class T>
+__attribute__((noinline)) void A<0>::RecursiveTemplateFunction(const T &) {
+ __sanitizer_print_stack_trace();
+}
+
+int main() {
+ // CHECK: {{vector<.*vector<.*vector<.*vector<.*vector<}}
+ A<10>().RecursiveTemplateFunction(0);
+}
OpenPOWER on IntegriCloud