blob: 513eef53bbc6cb78ab47025f3bd8b0e0f86cd5df [file] [log] [blame]
Sterling Augustineb6a66392019-10-31 12:45:20 -07001// -*- 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
Louis Dionne9915ba52021-09-30 15:11:48 -040012// TODO: Investigate these failures
13// XFAIL: asan, tsan, ubsan
14
15// TODO: Investigate this failure on macOS
16// XFAIL: target={{.+}}-apple-darwin{{.+}}
17
Sergej Jaskiewiczbaf07ac2019-12-06 17:26:35 +030018// UNSUPPORTED: libunwind-arm-ehabi
19
Xing Xue909f9672021-11-18 10:24:58 -050020// The AIX assembler does not support CFI directives, which
21// are necessary to run this test.
22// UNSUPPORTED: target=powerpc{{(64)?}}-ibm-aix
23
Sterling Augustineb6a66392019-10-31 12:45:20 -070024#include <assert.h>
25#include <stdlib.h>
26#include <libunwind.h>
27
Mikhail Maltsev4cd4dca2019-11-19 09:57:04 +000028void test() {
Sterling Augustineb6a66392019-10-31 12:45:20 -070029 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));
Mikhail Maltsev4cd4dca2019-11-19 09:57:04 +000036}
37
Louis Dionnecbfe0172020-10-08 13:36:33 -040038int main(int, char**) {
Mikhail Maltsev4cd4dca2019-11-19 09:57:04 +000039 test();
Sterling Augustineb6a66392019-10-31 12:45:20 -070040 return 0;
41}