[PATCH] D158655: [libunwind][AIX] Fix problem with stepping up from a leaf function when unwinding started in a signal handler

Stephen Peckham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 12:05:56 PDT 2023


stephenpeckham added inline comments.


================
Comment at: libunwind/src/UnwindCursor.hpp:2503
+    // or the function is '__start', or LR is not set in the current context.
+    if (TBTable->tb.saves_lr || !lastStack || !sigContextLRValue)
+      newRegisters.setSP(lastStack);
----------------
I think the check should be for TBTable->tb.stores_bc. It is possible for stores_bc to be 0 but saves_lr to be 1. This case can occur if a "leaf" function calls an internal routine that the compiler knows is stackless. In this case, the LR is saved in the stack before calling the internal function, but the stack pointer is not updated. 


================
Comment at: libunwind/src/UnwindCursor.hpp:2538
 
   if (nextReturnAddress > 0x01 && nextReturnAddress < 0x10000) {
     _LIBUNWIND_TRACE_UNWINDING("The next is a signal handler frame: "
----------------
This code wasn't changed, but the check could be done at the beginning of the function instead of the end. With this change, isSignalFrame does not need to be updated.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158655/new/

https://reviews.llvm.org/D158655



More information about the llvm-commits mailing list