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 Apple 13 // XFAIL: target={{.+}}-apple-{{.+}} 14 15 // TODO: Figure out why this fails with Memory Sanitizer. 16 // XFAIL: msan 17 18 // UNSUPPORTED: libunwind-arm-ehabi 19 20 // The AIX assembler does not support CFI directives, which 21 // are necessary to run this test. 22 // UNSUPPORTED: target=powerpc{{(64)?}}-ibm-aix 23 24 #include <assert.h> 25 #include <stdlib.h> 26 #include <libunwind.h> 27 test()28void test() { 29 asm(".cfi_signal_frame"); 30 unw_cursor_t cursor; 31 unw_context_t uc; 32 unw_getcontext(&uc); 33 unw_init_local(&cursor, &uc); 34 assert(unw_step(&cursor) > 0); 35 assert(unw_is_signal_frame(&cursor)); 36 } 37 main(int,char **)38int main(int, char**) { 39 test(); 40 return 0; 41 } 42