Sterling Augustine | b6a6639 | 2019-10-31 12:45:20 -0700 | [diff] [blame] | 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 | |
Louis Dionne | 9abefdd | 2022-05-26 10:19:25 -0400 | [diff] [blame] | 12 | // TODO: Investigate this failure on Apple |
| 13 | // XFAIL: target={{.+}}-apple-{{.+}} |
Louis Dionne | 9915ba5 | 2021-09-30 15:11:48 -0400 | [diff] [blame] | 14 | |
Louis Dionne | 31359e0 | 2022-03-02 17:49:13 -0500 | [diff] [blame] | 15 | // TODO: Figure out why this fails with Memory Sanitizer. |
| 16 | // XFAIL: msan |
| 17 | |
Sergej Jaskiewicz | baf07ac | 2019-12-06 17:26:35 +0300 | [diff] [blame] | 18 | // UNSUPPORTED: libunwind-arm-ehabi |
| 19 | |
Xing Xue | 909f967 | 2021-11-18 10:24:58 -0500 | [diff] [blame] | 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 | |
Florian Mayer | 47974e9 | 2022-08-04 15:02:52 -0700 | [diff] [blame] | 24 | #undef NDEBUG |
Sterling Augustine | b6a6639 | 2019-10-31 12:45:20 -0700 | [diff] [blame] | 25 | #include <assert.h> |
| 26 | #include <stdlib.h> |
| 27 | #include <libunwind.h> |
| 28 | |
Mikhail Maltsev | 4cd4dca | 2019-11-19 09:57:04 +0000 | [diff] [blame] | 29 | void test() { |
Sterling Augustine | b6a6639 | 2019-10-31 12:45:20 -0700 | [diff] [blame] | 30 | asm(".cfi_signal_frame"); |
| 31 | unw_cursor_t cursor; |
| 32 | unw_context_t uc; |
| 33 | unw_getcontext(&uc); |
| 34 | unw_init_local(&cursor, &uc); |
| 35 | assert(unw_step(&cursor) > 0); |
| 36 | assert(unw_is_signal_frame(&cursor)); |
Mikhail Maltsev | 4cd4dca | 2019-11-19 09:57:04 +0000 | [diff] [blame] | 37 | } |
| 38 | |
Louis Dionne | cbfe017 | 2020-10-08 13:36:33 -0400 | [diff] [blame] | 39 | int main(int, char**) { |
Mikhail Maltsev | 4cd4dca | 2019-11-19 09:57:04 +0000 | [diff] [blame] | 40 | test(); |
Sterling Augustine | b6a6639 | 2019-10-31 12:45:20 -0700 | [diff] [blame] | 41 | return 0; |
| 42 | } |