Skip to content

Commit ff514ff

Browse files
azataaryanshukla
authored andcommitted
[libunwind] fix unwinding from signal handler (llvm#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
1 parent 7cea289 commit ff514ff

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

libunwind/src/UnwindCursor.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2589,6 +2589,14 @@ void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
25892589
--pc;
25902590
#endif
25912591

2592+
#if !(defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) && defined(_WIN32))
2593+
// In case of this is frame of signal handler, the IP saved in the signal
2594+
// handler points to first non-executed instruction, while FDE/CIE expects IP
2595+
// to be after the first non-executed instruction.
2596+
if (_isSignalFrame)
2597+
++pc;
2598+
#endif
2599+
25922600
// Ask address space object to find unwind sections for this pc.
25932601
UnwindInfoSections sects;
25942602
if (_addressSpace.findUnwindSections(pc, sects)) {

0 commit comments

Comments
 (0)