[libunwind] fix unwinding from signal handler (#92291)

In case of this is frame of signal handler, the IP should be
incremented, because the IP saved in the signal handler points to first
non-executed instruction, while FDE/CIE expects IP to be after the first
non-executed instruction.

Refs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26208
This commit is contained in:
Azat Khuzhin 2024-07-09 22:57:00 +03:00 committed by GitHub
parent a937d2918e
commit 7b604cdf75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2589,6 +2589,14 @@ void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
--pc;
#endif
#if !(defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) && defined(_WIN32))
// In case of this is frame of signal handler, the IP saved in the signal
// handler points to first non-executed instruction, while FDE/CIE expects IP
// to be after the first non-executed instruction.
if (_isSignalFrame)
++pc;
#endif
// Ask address space object to find unwind sections for this pc.
UnwindInfoSections sects;
if (_addressSpace.findUnwindSections(pc, sects)) {