From b316c9885d80370e413efb70e1a21b9024d8c4a5 Mon Sep 17 00:00:00 2001 From: MarcZX100 Date: Sun, 11 Oct 2026 12:11:43 +0000 Subject: [PATCH] fix(libc): resume host foreign exceptions with host unwinder --- core/libs/prx/libc/src/exception/Unwind.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/libs/prx/libc/src/exception/Unwind.cpp b/core/libs/prx/libc/src/exception/Unwind.cpp index b958b18f8..e38aa9fb1 100644 --- a/core/libs/prx/libc/src/exception/Unwind.cpp +++ b/core/libs/prx/libc/src/exception/Unwind.cpp @@ -1,7 +1,11 @@ #include "prx/libc/include/exceptions/Unwind.hpp" +#include "prx/libc/include/exceptions/Runtime.hpp" #include "prx/libc/include/specifics/linux/ElfTypes.hpp" #include "prx/libc/src/specifics/x86_64/RegisterContext.cpp" +#if defined(__linux__) +#include +#endif #ifdef _WIN32 #include #include @@ -502,6 +506,14 @@ _Unwind_Reason_Code APS5_VABI _Unwind_RaiseException_nid_postfix(_Unwind_Excepti } [[noreturn]] void APS5_VABI _Unwind_Resume_nid_postfix(_Unwind_Exception* exception) { +#if defined(__linux__) + if (!LibcException::Native(exception->exception_class) && !exception->private_1) { + using Resume = void (*)(_Unwind_Exception*); + const auto resume = reinterpret_cast(dlsym(RTLD_NEXT, "_Unwind_Resume")); + if (!resume) std::abort(); + resume(exception); + } +#endif _Unwind_Context context; LibcCaptureRegisters(context.registers); if (!LibcUnwind::Step(context)) std::abort();