llvm-project/libunwind/src
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
..
AddressSpace.hpp [libunwind] Silence warnings about unused variables. NFC. 2022-05-04 22:55:02 +03:00
CMakeLists.txt [runtimes] Introduce object libraries 2022-05-16 08:41:16 -04:00
CompactUnwinder.hpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
DwarfInstructions.hpp [NFC] [libunwind] turn assert into static_assert 2022-06-03 16:32:42 -07:00
DwarfParser.hpp [libunwind] [sparc] Add SPARCv9 support 2022-02-05 13:08:26 -08:00
EHHeaderParser.hpp [libunwind] Add more information to eh_frame_hdr version error 2022-06-01 19:48:19 -07:00
FrameHeaderCache.hpp [libunwind][DWARF] Fix end of .eh_frame calculation 2020-09-16 19:00:57 -07:00
RWMutex.hpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
Registers.hpp [NFC] [libunwind] turn assert into static_assert 2022-06-03 16:32:42 -07:00
Unwind-EHABI.cpp [libunwind] Fix build warnings in Unwind-EHABI.cpp. NFC. 2022-04-25 23:00:52 +03:00
Unwind-EHABI.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
Unwind-seh.cpp [libunwind] Don't store a predecremented PC when using SEH 2022-06-06 23:25:24 +03:00
Unwind-sjlj.c [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
UnwindCursor.hpp [libunwind] Don't store a predecremented PC when using SEH 2022-06-06 23:25:24 +03:00
UnwindLevel1-gcc-ext.c [libunwind][AIX] implementation of the unwinder for AIX 2022-04-13 11:01:59 -04:00
UnwindLevel1.c [libunwind][AIX] implementation of the unwinder for AIX 2022-04-13 11:01:59 -04:00
UnwindRegistersRestore.S [libunwind] Add SystemZ support 2022-05-02 14:35:29 +02:00
UnwindRegistersSave.S [libunwind] Add SystemZ support 2022-05-02 14:35:29 +02:00
Unwind_AIXExtras.cpp [libunwind][AIX] implementation of the unwinder for AIX 2022-04-13 11:01:59 -04:00
Unwind_AppleExtras.cpp [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
assembly.h [libunwind][AIX] implementation of the unwinder for AIX 2022-04-13 11:29:37 -04:00
cet_unwind.h Add some prototypes to fix -Wstrict-prototypes. NFC 2022-04-09 09:46:39 -07:00
config.h [libunwind] Add SystemZ support 2022-05-02 14:35:29 +02:00
dwarf2.h [runtimes][NFC] Remove filenames at the top of the license notice 2021-11-17 16:30:52 -05:00
libunwind.cpp [libunwind] Add SystemZ support 2022-05-02 14:35:29 +02:00
libunwind_ext.h [libunwind][AIX] implementation of the unwinder for AIX 2022-04-13 11:01:59 -04:00