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 // UNSUPPORTED: libunwind-arm-ehabi 19 20 #include <assert.h> 21 #include <stdlib.h> 22 #include <libunwind.h> 23 24 void test() { 25 asm(".cfi_signal_frame"); 26 unw_cursor_t cursor; 27 unw_context_t uc; 28 unw_getcontext(&uc); 29 unw_init_local(&cursor, &uc); 30 assert(unw_step(&cursor) > 0); 31 assert(unw_is_signal_frame(&cursor)); 32 } 33 34 int main(int, char**) { 35 test(); 36 return 0; 37 } 38