Author: Azat Khuzhin Date: 2024-07-09T12:57:00-07:00 New Revision: 7b604cdf75fd1c741a15138684ea0e98dca5e46f
URL: https://github.com/llvm/llvm-project/commit/7b604cdf75fd1c741a15138684ea0e98dca5e46f DIFF: https://github.com/llvm/llvm-project/commit/7b604cdf75fd1c741a15138684ea0e98dca5e46f.diff LOG: [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 Added: Modified: libunwind/src/UnwindCursor.hpp Removed: ################################################################################ diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp index 677e842d8a22b..2ec60e4c123d5 100644 --- a/libunwind/src/UnwindCursor.hpp +++ b/libunwind/src/UnwindCursor.hpp @@ -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)) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits