[libunwind] Adjust the signal_frame test for Arm

Summary:
This patch adjusts the signal_frame.pass.cpp to pass on Arm targets:
* When Arm EHABI is used the unwinder does not use DWARF, hence the
  DWARF-specific check unw_is_signal_frame() must be disabled.
* Certain C libraries don't include EH tables, so the unwinder must
  not try to step out of main(). The patch moves the test code out of
  main() into a separate function to avoid this.

Reviewers: saugustine, ostannard, phosek, jfb, mclow.lists

Reviewed By: saugustine

Subscribers: dexonsmith, aprantl, kristof.beyls, christof, libcxx-commits, pbarrio, labrinea

Tags: #libc

Differential Revision: https://reviews.llvm.org/D70397
This commit is contained in:
Mikhail Maltsev 2019-11-19 09:57:04 +00:00
parent 26d36a1903
commit 4fb8ecdef4
1 changed files with 7 additions and 1 deletions

View File

@ -13,13 +13,19 @@
#include <stdlib.h>
#include <libunwind.h>
int main(void) {
void test() {
asm(".cfi_signal_frame");
unw_cursor_t cursor;
unw_context_t uc;
unw_getcontext(&uc);
unw_init_local(&cursor, &uc);
assert(unw_step(&cursor) > 0);
#if !defined(_LIBUNWIND_ARM_EHABI)
assert(unw_is_signal_frame(&cursor));
#endif
}
int main() {
test();
return 0;
}