[libcxxabi] r204290 - Fix DW_CFA_GNU_args_size handling. The primary architecture using this

Joerg Sonnenberger joerg at bec.de
Wed Mar 19 18:23:55 PDT 2014


Author: joerg
Date: Wed Mar 19 20:23:55 2014
New Revision: 204290

URL: http://llvm.org/viewvc/llvm-project?rev=204290&view=rev
Log:
Fix DW_CFA_GNU_args_size handling. The primary architecture using this
opcode is VAX. A function call pushes the number of arguments given onto
the stack and "ret" will pop it automatically. The FDE of the caller
contains the amount of stack space used for arguments (and possibly
extra padding), so unwinding has to compensate for this when "returning"
from a function. This is exactly the case when step() is done. The
existing handling in unw_set_reg no longer makes sense.

Modified:
    libcxxabi/trunk/src/Unwind/UnwindCursor.hpp
    libcxxabi/trunk/src/Unwind/libunwind.cpp

Modified: libcxxabi/trunk/src/Unwind/UnwindCursor.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/UnwindCursor.hpp?rev=204290&r1=204289&r2=204290&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/UnwindCursor.hpp (original)
+++ libcxxabi/trunk/src/Unwind/UnwindCursor.hpp Wed Mar 19 20:23:55 2014
@@ -1041,6 +1041,8 @@ int UnwindCursor<A, R>::step() {
     this->setInfoBasedOnIPRegister(true);
     if (_unwindInfoMissing)
       return UNW_STEP_END;
+    if (_info.gp)
+      setReg(UNW_REG_SP, getReg(UNW_REG_SP) + _info.gp);
   }
 
   return result;

Modified: libcxxabi/trunk/src/Unwind/libunwind.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/libunwind.cpp?rev=204290&r1=204289&r2=204290&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/libunwind.cpp (original)
+++ libcxxabi/trunk/src/Unwind/libunwind.cpp Wed Mar 19 20:23:55 2014
@@ -174,9 +174,6 @@ _LIBUNWIND_EXPORT int unw_set_reg(unw_cu
       pint_t orgArgSize = (pint_t)info.gp;
       uint64_t orgFuncStart = info.start_ip;
       co->setInfoBasedOnIPRegister(false);
-      // and adjust REG_SP if there was a DW_CFA_GNU_args_size
-      if ((orgFuncStart == info.start_ip) && (orgArgSize != 0))
-        co->setReg(UNW_REG_SP, co->getReg(UNW_REG_SP) + orgArgSize);
     }
     return UNW_ESUCCESS;
   }





More information about the cfe-commits mailing list