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

Xing Xue via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 23 11:49:25 PDT 2023


xingxue created this revision.
xingxue added reviewers: MaskRay, compnerd, hubert.reinterpretcast, stephenpeckham, daltenty.
xingxue added a project: LLVM.
Herald added a project: All.
xingxue requested review of this revision.
Herald added subscribers: libcxx-commits, llvm-commits.
Herald added a project: libunwind.
Herald added a reviewer: libunwind.

The implementation of AIX unwinder gets the return address from the link area of the stack frame of a function and uses the return address to walk up functions. However, when unwinding starts from a signal handler and the function that raised the signal happens to be a leaf function and it does not have its own stack frame, the return address of the stack frame of the leaf function points to the caller of the function that calls the leaf function because the leaf function and its caller share the same stack frame. As a result, the caller of the leaf function is skipped. This patch fixes the problem by saving the LR value in sigcontext when the unwinder hits the signal handler trampoline frame and using it as the return address of the leaf function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158655

Files:
  libunwind/src/Registers.hpp
  libunwind/src/UnwindCursor.hpp
  libunwind/test/aix_signal_unwind.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158655.552800.patch
Type: text/x-patch
Size: 7307 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230823/33d22d25/attachment.bin>


More information about the libcxx-commits mailing list