https://github.com/azat updated https://github.com/llvm/llvm-project/pull/92291
>From 7066c0d3c7e84ccfdaeebd3b279bcdd91955ec7b Mon Sep 17 00:00:00 2001 From: Azat Khuzhin <a3at.m...@gmail.com> Date: Wed, 15 May 2024 08:17:22 +0200 Subject: [PATCH] [libunwind] fix unwinding from signal handler 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. v2: move the increment from DwarfInstructions<A, R>::stepWithDwarf() into the UnwindCursor<A, R>::setInfoBasedOnIPRegister() to avoid exposing posslibly unaligned IP (also note, that this matches with gcc implementation as well) Refs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26208 --- libunwind/src/UnwindCursor.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp index 677e842d8a22b..feaadb58f5f6e 100644 --- a/libunwind/src/UnwindCursor.hpp +++ b/libunwind/src/UnwindCursor.hpp @@ -2589,6 +2589,12 @@ void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) { --pc; #endif + // 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; + // 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