[PATCH] D46971: [DWARF] Get RA from RA register even if it appears unused
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
[PATCH] D46971: [DWARF] Get RA from RA register even if it appears unused
whitequark updated this revision to Diff 147153. whitequark added a comment. Reuploaded diff with context. 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
[PATCH] D46971: [DWARF] Get RA from RA register even if it appears unused
whitequark added a comment. @compnerd ping Repository: rUNW libunwind https://reviews.llvm.org/D46971 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46971: [DWARF] Get RA from RA register even if it appears unused
whitequark added a comment. > It would be nice if we had a test case added for this This is inherently architecture and platform specific, and libunwind currently doesn't have any provisions for this... In principle, would a x86-only Linux-only test suffice? I'm not sure if I can spend time making it more portable. Comment at: src/DwarfInstructions.hpp:195 } +else if (i == (int)cieInfo.returnAddressRegister) + returnAddress = registers.getRegister(i); compnerd wrote: > I think that we should stick to LLVM style (coddled braces) and use C++ style > casts. Ack re braces. I was copying that cast from ten lines above. Should I change that too? This should be a static_cast, right? Repository: rUNW libunwind https://reviews.llvm.org/D46971 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D83015: [Driver] Add -fld-path= and deprecate -fuse-ld=/abs/path and -fuse-ld=rel/path
whitequark added a comment. Thank you for making this change. IIRC I introduced `-fuse-ld=` out of frustration with the inability to change the linker path in any way other than with a shell script on `PATH`. It was not a good design. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83015/new/ https://reviews.llvm.org/D83015 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits