[PATCH] D38680: [libunwind] Fix handling of DW_CFA_GNU_args_size

Joerg Sonnenberger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 17 12:06:02 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL337312: The semantics of DW_CFA_GNU_args_size have changed subtile over the (authored by joerg, committed by ).
Herald added subscribers: llvm-commits, christof.

Changed prior to commit:
  https://reviews.llvm.org/D38680?vs=150049&id=155943#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38680

Files:
  libunwind/trunk/src/UnwindCursor.hpp
  libunwind/trunk/src/libunwind.cpp


Index: libunwind/trunk/src/UnwindCursor.hpp
===================================================================
--- libunwind/trunk/src/UnwindCursor.hpp
+++ libunwind/trunk/src/UnwindCursor.hpp
@@ -1411,8 +1411,6 @@
     this->setInfoBasedOnIPRegister(true);
     if (_unwindInfoMissing)
       return UNW_STEP_END;
-    if (_info.gp)
-      setReg(UNW_REG_SP, getReg(UNW_REG_SP) + _info.gp);
   }
 
   return result;
Index: libunwind/trunk/src/libunwind.cpp
===================================================================
--- libunwind/trunk/src/libunwind.cpp
+++ libunwind/trunk/src/libunwind.cpp
@@ -188,8 +188,20 @@
     co->setReg(regNum, (pint_t)value);
     // specical case altering IP to re-find info (being called by personality
     // function)
-    if (regNum == UNW_REG_IP)
+    if (regNum == UNW_REG_IP) {
+      unw_proc_info_t info;
+      // First, get the FDE for the old location and then update it.
+      co->getInfo(&info);
       co->setInfoBasedOnIPRegister(false);
+      // If the original call expects stack adjustment, perform this now.
+      // Normal frame unwinding would have included the offset already in the
+      // CFA computation.
+      // Note: for PA-RISC and other platforms where the stack grows up,
+      // this should actually be - info.gp. LLVM doesn't currently support
+      // any such platforms and Clang doesn't export a macro for them.
+      if (info.gp)
+        co->setReg(UNW_REG_SP, co->getReg(UNW_REG_SP) + info.gp);
+    }
     return UNW_ESUCCESS;
   }
   return UNW_EBADREG;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38680.155943.patch
Type: text/x-patch
Size: 1546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180717/fc837437/attachment.bin>


More information about the llvm-commits mailing list