| 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 |
/// Fast unwinder does not work with Thumb code |
| 11 |
// UNSUPPORTED: target={{.*thumb.*}} |
| 12 |
|
| 13 |
/// No .eh_frame && -g => .debug_frame |
| 14 |
// SEC: .debug_frame |
| 15 |
|
| 16 |
#include <sanitizer/common_interface_defs.h> |
| 17 |
#include <vector> |
| 18 |
|
| 19 |
template <int N> |
| 20 |
struct A { |
| 21 |
template <class T> |
| 22 |
void RecursiveTemplateFunction(const T &t); |
| 23 |
}; |
| 24 |
|
| 25 |
template <int N> |
| 26 |
template <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 |
|
| 32 |
template <> |
| 33 |
template <class T> |
| 34 |
__attribute__((noinline)) void A<0>::RecursiveTemplateFunction(const T &) { |
| 35 |
__sanitizer_print_stack_trace(); |
| 36 |
} |
| 37 |
|
| 38 |
int main() { |
| 39 |
// CHECK: {{vector<.*vector<.*vector<.*vector<.*vector<}} |
| 40 |
A<7>().RecursiveTemplateFunction(0); |
| 41 |
} |