This is an archive of the discontinued LLVM Phabricator instance.

[test] Add basic _Unwind_ForcedUnwind + exception tests
ClosedPublic

Authored by MaskRay on Jan 21 2021, 7:40 PM.

Details

Summary

Forced unwinding is like a foreign exception, which can be caught by catch (...) and rethrown.
If not rethrown, __cxa_end_cath will call _Unwind_DeleteException to destroy the object.

The behavior going through empty throw() and non-empty throw(int) is not
clear (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98785), so I do not add such
tests.

Diff Detail

Event Timeline

MaskRay requested review of this revision.Jan 21 2021, 7:40 PM
MaskRay created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 21 2021, 7:40 PM
Herald added 1 blocking reviewer(s): Restricted Project. · View Herald Transcript

Won't complain, you're adding tests. But can you please resolve the CI issues? This is breaking the tests under a few configurations. See https://buildkite.com/llvm-project/diff-checks/builds/26184.

ldionne requested changes to this revision.Jan 28 2021, 7:51 AM
This revision now requires changes to proceed.Jan 28 2021, 7:51 AM
MaskRay updated this revision to Diff 319926.Jan 28 2021, 11:04 AM

Fix signature of _Unwind_Stop_Fn
Fix -Werror=shadow on GCC

MaskRay updated this revision to Diff 319942.Jan 28 2021, 12:47 PM

Use a trait

MaskRay updated this revision to Diff 319989.Jan 28 2021, 4:19 PM

UNSUPPORT c++03 because I use tuple_element

@ldionne PTAL.

https://buildkite.com/llvm-project/libcxx-ci/builds/1163 macosx 10.9 was flaky and failed for unrelated libc++ tests. Other configuration passed.

ldionne accepted this revision.Feb 2 2021, 9:25 AM

Sorry about the flakiness, I'm working on fixing it.

This revision is now accepted and ready to land.Feb 2 2021, 9:25 AM
This revision was landed with ongoing or failed builds.Feb 2 2021, 9:35 AM
This revision was automatically updated to reflect the committed changes.

Hi @MaskRay,

these tests get failed on Windows to ARMv7 Linux cross builder with the following error:

C:/buildbot/as-builder-1/x-armv7l/llvm-project/libcxxabi/test/forced_unwind1.pass.cpp:37:42: error: typedef '_Unwind_Exception' cannot be referenced with a struct specifier

http://lab.llvm.org:8011/#/builders/60/builds/1855

Hi @MaskRay,

these tests get failed on Windows to ARMv7 Linux cross builder with the following error:

C:/buildbot/as-builder-1/x-armv7l/llvm-project/libcxxabi/test/forced_unwind1.pass.cpp:37:42: error: typedef '_Unwind_Exception' cannot be referenced with a struct specifier

http://lab.llvm.org:8011/#/builders/60/builds/1855

The standard writes struct _Unwind_Exception *. This way it works in C as well. https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html

I am not sure libunwind's ARMEH implementation has working _Unwind_ForcedUnwind so looks like the best is to unsupport arm. How to do that?

I am not sure libunwind's ARMEH implementation has working _Unwind_ForcedUnwind so looks like the best is to unsupport arm. How to do that?

It looks like the function has not been implemented for Arm EHABI yet, see D89570.

There are a number of tests in the libcxxabi test suite that use #if !defined(_LIBCXXABI_ARM_EHABI) to do some adjustments or disable the test completely.

I am not sure libunwind's ARMEH implementation has working _Unwind_ForcedUnwind so looks like the best is to unsupport arm. How to do that?

It looks like the function has not been implemented for Arm EHABI yet, see D89570.

There are a number of tests in the libcxxabi test suite that use #if !defined(_LIBCXXABI_ARM_EHABI) to do some adjustments or disable the test completely.

In the absence of an ARMEH disabling directive, do this?

#ifdef _LIBCXXABI_ARM_EHABI
int main() {}
#else
...
#endif

Seems OK. Something similar is in exception_object_alignment.pass.cpp.

@ikudrin thank you for your help.

got it, thank you.