llvm-project/libunwind
Martin Storsjö 08d30c602b [libunwind] Don't store a predecremented PC when using SEH
This fixes unwinding in boundary cases on ARM with SEH.

In the case of ARM/Thumb, disp->ControlPc points at the following
instruction, with the thumb bit set. Thus by decrementing 1,
it still points at the next instruction. To achieve the desired
effect of pointing at the previous instruction, one first has to strip
out the thumb bit, then do the decrement by 1 to reach the previous
instruction.

When libcxxabi looks for call site ranges, it already does
`_Unwind_GetIP(context) - 1` (in `scan_eh_tab` in
libcxxabi/src/cxa_personality.cpp), so we shouldn't do the
corresponding `- 1` multiple times.

In the case of libcxxabi on Thumb, `funcStart` (still in `scan_eh_tab`)
may have the thumb bit set. If the program counter address is
decremented both in libunwind (first removing the thumb bit, then
decremented), and then libcxxabi decrements it further, and compares
with a `funcStart` with the thumb bit set, it could point to one byte
before the start of the call site.

Thus: This modification makes libunwind with SEH work with libcxxabi
on Thumb, in settings where libunwind and libcxxabi worked fine with
Dwarf before.

For existing cases with libunwind with SEH (on x86_64 and aarch64),
this modification doesn't break any of my testcases.

Differential Revision: https://reviews.llvm.org/D126869
2022-06-06 23:25:24 +03:00
..
cmake [libunwind][CMake] Fix name of LIBUNWIND_SUPPORTS_NODEFAULTLIBS_FLAG 2022-05-27 09:20:57 +03:00
docs Replace links to archived mailing lists by links to Discourse forums 2022-03-23 10:10:20 -04:00
include [libunwind] Fix SEH unwinding on ARM 2022-06-06 23:23:35 +03:00
src [libunwind] Don't store a predecremented PC when using SEH 2022-06-06 23:25:24 +03:00
test [libunwind][ci][AIX] Add libunwind to buildbot CI 2022-06-02 09:03:10 -04:00
.clang-format
CMakeLists.txt [runtimes] Default LIB*_HERMETIC_STATIC_LIBRARY to ON on Windows 2022-05-18 20:31:51 +03:00
LICENSE.TXT