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 <noreply@anthropic.com>
This commit is contained in:
STL1te
2026-09-29 17:23:11 +03:00
parent 8dbff97486
commit ee1d34230d
@@ -1,6 +1,7 @@
#include <cstdint>
#include <cstddef>
#include <atomic>
#include <cstdio>
#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;
}
}