[PATCH] D46971: [DWARF] Get RA from RA register even if it appears unused

whitequark via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 16 12:17:34 PDT 2018


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46971.147152.patch
Type: text/x-patch
Size: 439 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180516/457de936/attachment.bin>


More information about the cfe-commits mailing list