diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -132,6 +132,9 @@ option(LIBUNWIND_HIDE_SYMBOLS "Do not export any symbols from the static library." OFF) +option(LIBUNWIND_OMIT_LINUX_AARCH64_SIGRETURN_CHECK + "Omit the special check for Linux aarch64 sigreturn frames and just rely on unwind info." OFF) + #=============================================================================== # Configure System #=============================================================================== @@ -344,6 +347,10 @@ add_compile_definitions(_LIBUNWIND_REMEMBER_HEAP_ALLOC) endif() +if(LIBUNWIND_OMIT_LINUX_AARCH64_SIGRETURN_CHECK) + add_compile_definitions(_LIBUNWIND_OMIT_LINUX_AARCH64_SIGRETURN_CHECK) +endif() + # This is the _ONLY_ place where add_definitions is called. if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp --- a/libunwind/src/UnwindCursor.hpp +++ b/libunwind/src/UnwindCursor.hpp @@ -25,6 +25,11 @@ #include #endif +#if defined(_LIBUNWIND_TARGET_LINUX) && defined(_LIBUNWIND_TARGET_AARCH64) && \ + !defined(_LIBUNWIND_OMIT_LINUX_AARCH64_SIGRETURN_CHECK) +#define _LIBUNWIND_CHECK_LINUX_AARCH64_SIGRETURN +#endif + #if defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) // Provide a definition for the DISPATCHER_CONTEXT struct for old (Win7 and // earlier) SDKs. @@ -937,7 +942,7 @@ } #endif -#if defined(_LIBUNWIND_TARGET_LINUX) && defined(_LIBUNWIND_TARGET_AARCH64) +#if defined(_LIBUNWIND_CHECK_LINUX_AARCH64_SIGRETURN) bool setInfoForSigReturn() { R dummy; return setInfoForSigReturn(dummy); @@ -1226,7 +1231,7 @@ unw_proc_info_t _info; bool _unwindInfoMissing; bool _isSignalFrame; -#if defined(_LIBUNWIND_TARGET_LINUX) && defined(_LIBUNWIND_TARGET_AARCH64) +#if defined(_LIBUNWIND_CHECK_LINUX_AARCH64_SIGRETURN) bool _isSigReturn = false; #endif }; @@ -1925,7 +1930,7 @@ template void UnwindCursor::setInfoBasedOnIPRegister(bool isReturnAddress) { -#if defined(_LIBUNWIND_TARGET_LINUX) && defined(_LIBUNWIND_TARGET_AARCH64) +#if defined(_LIBUNWIND_CHECK_LINUX_AARCH64_SIGRETURN) _isSigReturn = false; #endif @@ -2027,7 +2032,7 @@ } #endif // #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) -#if defined(_LIBUNWIND_TARGET_LINUX) && defined(_LIBUNWIND_TARGET_AARCH64) +#if defined(_LIBUNWIND_CHECK_LINUX_AARCH64_SIGRETURN) if (setInfoForSigReturn()) return; #endif @@ -2036,7 +2041,7 @@ _unwindInfoMissing = true; } -#if defined(_LIBUNWIND_TARGET_LINUX) && defined(_LIBUNWIND_TARGET_AARCH64) +#if defined(_LIBUNWIND_CHECK_LINUX_AARCH64_SIGRETURN) template bool UnwindCursor::setInfoForSigReturn(Registers_arm64 &) { // Look for the sigreturn trampoline. The trampoline's body is two @@ -2096,7 +2101,7 @@ _isSignalFrame = true; return UNW_STEP_SUCCESS; } -#endif // defined(_LIBUNWIND_TARGET_LINUX) && defined(_LIBUNWIND_TARGET_AARCH64) +#endif // defined(_LIBUNWIND_CHECK_LINUX_AARCH64_SIGRETURN) template int UnwindCursor::step() { @@ -2106,7 +2111,7 @@ // Use unwinding info to modify register set as if function returned. int result; -#if defined(_LIBUNWIND_TARGET_LINUX) && defined(_LIBUNWIND_TARGET_AARCH64) +#if defined(_LIBUNWIND_CHECK_LINUX_AARCH64_SIGRETURN) if (_isSigReturn) { result = this->stepThroughSigReturn(); } else