blob: a6f3f483bea5f68fd674fb33c370dae0002c477b [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
12#include <assert.h>
13#include <stdlib.h>
14#include <libunwind.h>
15
Mikhail Maltsev4cd4dca2019-11-19 09:57:04 +000016void test() {
Sterling Augustineb6a66392019-10-31 12:45:20 -070017 asm(".cfi_signal_frame");
18 unw_cursor_t cursor;
19 unw_context_t uc;
20 unw_getcontext(&uc);
21 unw_init_local(&cursor, &uc);
22 assert(unw_step(&cursor) > 0);
Mikhail Maltsev4cd4dca2019-11-19 09:57:04 +000023#if !defined(_LIBUNWIND_ARM_EHABI)
Sterling Augustineb6a66392019-10-31 12:45:20 -070024 assert(unw_is_signal_frame(&cursor));
Mikhail Maltsev4cd4dca2019-11-19 09:57:04 +000025#endif
26}
27
28int main() {
29 test();
Sterling Augustineb6a66392019-10-31 12:45:20 -070030 return 0;
31}