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 | |
Sergej Jaskiewicz | baf07ac | 2019-12-06 17:26:35 +0300 | [diff] [blame] | 12 | // UNSUPPORTED: libunwind-arm-ehabi |
| 13 | |
Sterling Augustine | b6a6639 | 2019-10-31 12:45:20 -0700 | [diff] [blame] | 14 | #include <assert.h> |
| 15 | #include <stdlib.h> |
| 16 | #include <libunwind.h> |
| 17 | |
Mikhail Maltsev | 4cd4dca | 2019-11-19 09:57:04 +0000 | [diff] [blame] | 18 | void test() { |
Sterling Augustine | b6a6639 | 2019-10-31 12:45:20 -0700 | [diff] [blame] | 19 | asm(".cfi_signal_frame"); |
| 20 | unw_cursor_t cursor; |
| 21 | unw_context_t uc; |
| 22 | unw_getcontext(&uc); |
| 23 | unw_init_local(&cursor, &uc); |
| 24 | assert(unw_step(&cursor) > 0); |
| 25 | assert(unw_is_signal_frame(&cursor)); |
Mikhail Maltsev | 4cd4dca | 2019-11-19 09:57:04 +0000 | [diff] [blame] | 26 | } |
| 27 | |
Louis Dionne | cbfe017 | 2020-10-08 13:36:33 -0400 | [diff] [blame^] | 28 | int main(int, char**) { |
Mikhail Maltsev | 4cd4dca | 2019-11-19 09:57:04 +0000 | [diff] [blame] | 29 | test(); |
Sterling Augustine | b6a6639 | 2019-10-31 12:45:20 -0700 | [diff] [blame] | 30 | return 0; |
| 31 | } |