whitequark created this revision.
whitequark added a reviewer: compnerd.
Herald added a subscriber: JDevlieghere.

If prolog info lists the RA register as unused, it means that
the current stack frame corresponds to a leaf function which never
needs to save the RA register. The RA register is of course used
to return from this leaf function.

Such a frame may be in the middle of the stack if another frame was
pushed on top of it by a signal or CPU exception. In this case,
unless we extract RA from the RA register, _Unwind_Backtrace would
stop at the frame right above the signal or exception frame.


Repository:
  rUNW libunwind

https://reviews.llvm.org/D46971

Files:
  src/DwarfInstructions.hpp


Index: src/DwarfInstructions.hpp
===================================================================
--- src/DwarfInstructions.hpp
+++ src/DwarfInstructions.hpp
@@ -192,6 +192,8 @@
           else
             return UNW_EBADREG;
         }
+        else if (i == (int)cieInfo.returnAddressRegister)
+          returnAddress = registers.getRegister(i);
       }
 
       // By definition, the CFA is the stack pointer at the call site, so


Index: src/DwarfInstructions.hpp
===================================================================
--- src/DwarfInstructions.hpp
+++ src/DwarfInstructions.hpp
@@ -192,6 +192,8 @@
           else
             return UNW_EBADREG;
         }
+        else if (i == (int)cieInfo.returnAddressRegister)
+          returnAddress = registers.getRegister(i);
       }
 
       // By definition, the CFA is the stack pointer at the call site, so
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to