42 lines · cpp
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 %t4// RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=SEC5// RUN: %run %t 2>&1 | FileCheck %s6 7// On android %t is a wrapper python script so llvm-readelf will fail.8// UNSUPPORTED: android9 10/// Fast unwinder does not work with Thumb code11// UNSUPPORTED: target={{.*thumb.*}}12 13/// No .eh_frame && -g => .debug_frame14// SEC: .debug_frame15 16#include <sanitizer/common_interface_defs.h>17#include <vector>18 19template <int N>20struct A {21 template <class T>22 void RecursiveTemplateFunction(const T &t);23};24 25template <int N>26template <class T>27__attribute__((noinline)) void A<N>::RecursiveTemplateFunction(const T &) {28 std::vector<T> t;29 return A<N - 1>().RecursiveTemplateFunction(t);30}31 32template <>33template <class T>34__attribute__((noinline)) void A<0>::RecursiveTemplateFunction(const T &) {35 __sanitizer_print_stack_trace();36}37 38int main() {39 // CHECK: {{vector<.*vector<.*vector<.*vector<.*vector<}}40 A<7>().RecursiveTemplateFunction(0);41}42