1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // Ensure that functions marked as signal frames are reported as such.
11 
12 // TODO: Investigate this failure on macOS
13 // XFAIL: target={{.+}}-apple-darwin{{.+}}
14 
15 // UNSUPPORTED: libunwind-arm-ehabi
16 
17 // The AIX assembler does not support CFI directives, which
18 // are necessary to run this test.
19 // UNSUPPORTED: target=powerpc{{(64)?}}-ibm-aix
20 
21 #include <assert.h>
22 #include <stdlib.h>
23 #include <libunwind.h>
24 
25 void test() {
26   asm(".cfi_signal_frame");
27   unw_cursor_t cursor;
28   unw_context_t uc;
29   unw_getcontext(&uc);
30   unw_init_local(&cursor, &uc);
31   assert(unw_step(&cursor) > 0);
32   assert(unw_is_signal_frame(&cursor));
33 }
34 
35 int main(int, char**) {
36   test();
37   return 0;
38 }
39