Skip to content

Commit 751d6ed

Browse files
committed
Rollup merge of #32737 - timonvo:arm-ehabi-backtraces, r=alexcrichton
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: https://github.com/gcc-mirror/gcc/blob/f1717362de1e56fe1ffab540289d7d0c6ed48b20/libgcc/unwind-arm-common.inc#L590 - LLVM's libunwind: https://github.com/llvm-mirror/libunwind/blob/61278584b5c84c422ff5da10f46c3235c54636c9/src/UnwindLevel1-gcc-ext.c#L153
2 parents c58a9da + 6e41885 commit 751d6ed

File tree

1 file changed

+6
-1
lines changed
  • src/libstd/sys/common/unwind

1 file changed

+6
-1
lines changed

src/libstd/sys/common/unwind/gcc.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,13 @@ pub mod eabi {
224224
context: *mut uw::_Unwind_Context
225225
) -> uw::_Unwind_Reason_Code
226226
{
227+
// Backtraces on ARM will call the personality routine with
228+
// state == _US_VIRTUAL_UNWIND_FRAME | _US_FORCE_UNWIND. In those cases
229+
// we want to continue unwinding the stack, otherwise all our backtraces
230+
// would end at __rust_try.
227231
if (state as c_int & uw::_US_ACTION_MASK as c_int)
228-
== uw::_US_VIRTUAL_UNWIND_FRAME as c_int { // search phase
232+
== uw::_US_VIRTUAL_UNWIND_FRAME as c_int
233+
&& (state as c_int & uw::_US_FORCE_UNWIND as c_int) == 0 { // search phase
229234
uw::_URC_HANDLER_FOUND // catch!
230235
}
231236
else { // cleanup phase

0 commit comments

Comments
 (0)