1 /// When the main program doesn't use .eh_frame, the slow unwinder does not work.
2 /// Test that we can fall back to the fast unwinder.
3 // RUN: %clangxx -O0 -g1 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer %s -o %t
4 // RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=SEC
5 // RUN: %run %t 2>&1 | FileCheck %s
6 
7 // On android %t is a wrapper python script so llvm-readelf will fail.
8 // UNSUPPORTED: android
9 
10 /// No .eh_frame && -g => .debug_frame
11 // SEC: .debug_frame
12 
13 #include <sanitizer/common_interface_defs.h>
14 #include <vector>
15 
16 template <int N>
17 struct A {
18   template <class T>
19   void RecursiveTemplateFunction(const T &t);
20 };
21 
22 template <int N>
23 template <class T>
24 __attribute__((noinline)) void A<N>::RecursiveTemplateFunction(const T &) {
25   std::vector<T> t;
26   return A<N - 1>().RecursiveTemplateFunction(t);
27 }
28 
29 template <>
30 template <class T>
31 __attribute__((noinline)) void A<0>::RecursiveTemplateFunction(const T &) {
32   __sanitizer_print_stack_trace();
33 }
34 
35 int main() {
36   // CHECK: {{vector<.*vector<.*vector<.*vector<.*vector<}}
37   A<7>().RecursiveTemplateFunction(0);
38 }
39