Revert 316150 which reinstated r316025.
[llvm-project.git] / libunwind / test / libunwind_01.pass.cpp
blob6957d98f956d7545ffedad4df1ef81535a617cba
1 #include <libunwind.h>
2 #include <stdlib.h>
4 void backtrace(int lower_bound) {
5 unw_context_t context;
6 unw_getcontext(&context);
8 unw_cursor_t cursor;
9 unw_init_local(&cursor, &context);
11 int n = 0;
12 do {
13 ++n;
14 if (n > 100) {
15 abort();
17 } while (unw_step(&cursor) > 0);
19 if (n < lower_bound) {
20 abort();
24 void test1(int i) {
25 backtrace(i);
28 void test2(int i, int j) {
29 backtrace(i);
30 test1(j);
33 void test3(int i, int j, int k) {
34 backtrace(i);
35 test2(j, k);
38 int main() {
39 test1(1);
40 test2(1, 2);
41 test3(1, 2, 3);