================
@@ -365,7 +365,12 @@ int DwarfInstructions<A, R>::stepWithDwarf(A 
&addressSpace, pint_t pc,
 
       // Return address is address after call site instruction, so setting IP 
to
       // that does simulates a return.
-      newRegisters.setIP(returnAddress);
+      //
+      // 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.
+      newRegisters.setIP(returnAddress + cieInfo.isSignalFrame);
----------------
azat wrote:

>The idea here is that cieInfo.isSignalFrame is a boolean and will increment by 
>1

Correct

>However, how do we ensure that the IP should be incremented by 1 and not say 4 
>or some other size for the instruction?

This is only needed to execute proper CFI here - 
https://github.com/llvm/llvm-project/blob/23d1d959583c35e6eab7e3e70d4c16449b418563/libunwind/src/DwarfParser.hpp#L433-L437

So 1 is enough

https://github.com/llvm/llvm-project/pull/92291
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to