Fix backtraces on ARM EHABI.

Before this patch, our rust_eh_personality_catch routine would cut
backtracing short at the __rust_try function, due to it not handling
the _US_FORCE_UNWIND bit properly, which is passed by libunwind
implementations on ARM EHABI.

Examples of where the _US_FORCE_UNWIND bit is passed to the PR:
- GCC's libunwind: f1717362de/libgcc/unwind-arm-common.inc (L590)
- LLVM's libunwind: 61278584b5/src/UnwindLevel1-gcc-ext.c (L153)
This commit is contained in:
Timon Van Overveldt 2016-03-19 14:53:40 -07:00
parent 600dc3552f
commit 6e41885bd8

View File

@ -224,8 +224,13 @@ pub mod eabi {
context: *mut uw::_Unwind_Context
) -> uw::_Unwind_Reason_Code
{
// Backtraces on ARM will call the personality routine with
// state == _US_VIRTUAL_UNWIND_FRAME | _US_FORCE_UNWIND. In those cases
// we want to continue unwinding the stack, otherwise all our backtraces
// would end at __rust_try.
if (state as c_int & uw::_US_ACTION_MASK as c_int)
== uw::_US_VIRTUAL_UNWIND_FRAME as c_int { // search phase
== uw::_US_VIRTUAL_UNWIND_FRAME as c_int
&& (state as c_int & uw::_US_FORCE_UNWIND as c_int) == 0 { // search phase
uw::_URC_HANDLER_FOUND // catch!
}
else { // cleanup phase