Skip to content

Commit 5e3635c

Browse files
committed
[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. Refs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26208
1 parent 9bbefb7 commit 5e3635c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libunwind/src/DwarfInstructions.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,12 @@ int DwarfInstructions<A, R>::stepWithDwarf(A &addressSpace, pint_t pc,
365365

366366
// Return address is address after call site instruction, so setting IP to
367367
// that does simulates a return.
368-
newRegisters.setIP(returnAddress);
368+
//
369+
// In case of this is frame of signal handler, the IP should be
370+
// incremented, because the IP saved in the signal handler points to
371+
// first non-executed instruction, while FDE/CIE expects IP to be after
372+
// the first non-executed instruction.
373+
newRegisters.setIP(returnAddress + cieInfo.isSignalFrame);
369374

370375
// Simulate the step by replacing the register set with the new ones.
371376
registers = newRegisters;

0 commit comments

Comments
 (0)