AnyPS5/core/libs/prx/libc/src/exception
marshmll 438d410824 fix(libc): keep host diagnostics on stderr when a guest redirects it on Linux
On Linux a guest stderr redirect also moves the host's: guest
descriptors are host descriptors, and the guest stderr stream wraps the
host stderr FILE. After dup2(fd, 2), or freopen(path, mode, stderr) with
full buffering, the libc terminate report, the host fprintf(stderr)
diagnostics and libstdc++'s terminate message go into the title's pipe
or file, and abort() discards what is still buffered. RetroArch
(PPSA99169) reopens stderr onto app0/trace.txt with full buffering, so
its stop on main left no message anywhere.

Before the first guest redirect of descriptor 2 (libkernel dup2, libc
freopen of a stream on descriptor 2), keep a close-on-exec duplicate of
the host descriptor 2 and point the host stderr at an unbuffered stream
on it. The guest stream keeps its own FILE and follows the redirect.
The libc terminate report writes to the kept descriptor with write()
instead of the stderr stream, and libkernel's sceKernelDebugOutText uses
the same kept descriptor.
2026-10-12 19:00:08 -03:00
..
ArraySupport.cpp fix(libc): preserve the guest ABI for array callbacks 2026-10-11 18:51:28 -04:00
ExceptionPointer.cpp fix(libc): release future results' exceptions through libc on Windows 2026-10-10 19:29:19 +13:00
Exports.cpp fix(libc): name the throw site in unhandled exception reports 2026-10-11 19:59:31 +07:00
GuardSupport.cpp feat(libs): define vabi macros + add to declarations 2026-09-10 08:07:03 +03:00
Personality.cpp feat(libc): exception runtime on macOS hosts 2026-10-08 13:16:41 +03:00
Runtime.cpp fix(libc): keep host diagnostics on stderr when a guest redirects it on Linux 2026-10-12 19:00:08 -03:00
StandardExceptions.cpp feat(libSceAmpr): implement std::_Throw_Cpp_error 2026-10-12 18:46:43 +00:00
TypeInfo.cpp feat(libs): add new std symbols + unused filter off by default 2026-09-24 10:28:33 +03:00
Unwind.cpp feat(agc): write the worker sampler's stacks as collapsed stacks 2026-10-12 21:23:11 +02:00