[libunwind] [libunwind][AIX] Fix the wrong traceback from signal handler (PR #101069)

Xing Xue via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 12:19:34 PDT 2024


https://github.com/xingxue-ibm created https://github.com/llvm/llvm-project/pull/101069

Patch [llvm#92291](https://github.com/llvm/llvm-project/pull/92291) causes wrong traceback from a signal handler for AIX because the AIX unwinder uses the traceback table at the end of each function instead of FDE/CIE for unwinding. This patch adds a condition to exclude traceback table based unwinding from the code added by the patch.

>From 05110959c01b5b7d4f2530e4d21232053db939f3 Mon Sep 17 00:00:00 2001
From: Xing Xue <xingxue at outlook.com>
Date: Mon, 29 Jul 2024 14:53:36 -0400
Subject: [PATCH] Fix the problem introduced by upstream patch
 https://github.com/llvm/llvm-project/pull/92291 guard the code added to
 exclude traceback based unwinding used for AIX.

---
 libunwind/src/UnwindCursor.hpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp
index 2ec60e4c123d5..758557337899e 100644
--- a/libunwind/src/UnwindCursor.hpp
+++ b/libunwind/src/UnwindCursor.hpp
@@ -2589,7 +2589,8 @@ void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
     --pc;
 #endif
 
-#if !(defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) && defined(_WIN32))
+#if !(defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) && defined(_WIN32)) &&            \
+    !defined(_LIBUNWIND_SUPPORT_TBTAB_UNWIND)
   // In case of this is frame of signal handler, 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.



More information about the cfe-commits mailing list