From ee1d34230d4b5666fee684246d2d86bcaaf22d1b Mon Sep 17 00:00:00 2001 From: STL1te Date: Tue, 29 Sep 2026 17:23:11 +0300 Subject: [PATCH] feat(kernel): sceKernelDebugWriteCppExceptionInfo prints the uncaught C++ exception A title libc from sce_module calls it from __cxa_throw/__cxa_rethrow when no handler is found, right before std::terminate, with the thrown object, 0x400 (meaning unknown), the demangled type name and what() (or null). The console keeps it for the core dump; there are no guest core dumps here, so it is printed to stderr. It was the only import such a libc needed beyond the existing libs. Co-Authored-By: Claude Opus 5.5 --- core/libs/prx/libkernel/System/src/Coredump.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/libs/prx/libkernel/System/src/Coredump.cpp b/core/libs/prx/libkernel/System/src/Coredump.cpp index 9c6cc3986..1daea6429 100644 --- a/core/libs/prx/libkernel/System/src/Coredump.cpp +++ b/core/libs/prx/libkernel/System/src/Coredump.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "SceTypes.hpp" #include "prx/libc/include/General.hpp" @@ -23,4 +24,13 @@ int APS5_VABI sceCoredumpUnregisterCoredumpHandler(void) { return 0; } +// A libc that fails to throw (no handler: the exception is uncaught) reports it here right before +// std::terminate, after its own stderr line; the console keeps it for the core dump, we print it. +// The second argument is 0x400 from the libc that calls it; its meaning is not known. +int APS5_VABI sceKernelDebugWriteCppExceptionInfo(const void* exception, uint64_t unknown, const char* typeName, const char* what) { + (void)unknown; + std::fprintf(stderr, "[coredump] uncaught C++ exception %p of type %s%s%s\n", exception, typeName ? typeName : "(unknown)", what ? ", what(): " : "", what ? what : ""); + return 0; +} + }