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 these failures
13 // XFAIL: asan, tsan, ubsan
14 
15 // TODO: Investigate this failure on macOS
16 // XFAIL: target={{.+}}-apple-darwin{{.+}}
17 
18 // TODO: Investigate this failure
19 // XFAIL: 32bits-on-64bits
20 
21 // UNSUPPORTED: libunwind-arm-ehabi
22 
23 #include <assert.h>
24 #include <stdlib.h>
25 #include <libunwind.h>
26 
27 void test() {
28   asm(".cfi_signal_frame");
29   unw_cursor_t cursor;
30   unw_context_t uc;
31   unw_getcontext(&uc);
32   unw_init_local(&cursor, &uc);
33   assert(unw_step(&cursor) > 0);
34   assert(unw_is_signal_frame(&cursor));
35 }
36 
37 int main(int, char**) {
38   test();
39   return 0;
40 }
41