libSceAmpr: std::_Throw_Cpp_error is a stub (Deathloop, Minecraft Legends); fix branch ready #3346
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-11T08:23:59Z.
std::_Throw_Cpp_error(int)(_ZSt16_Throw_Cpp_errori, exported by libSceAmpr, Export.cpp) is aNotImplemented_nid_no_patchstub. Deathloop (PPSA01670) and Minecraft Legends import it; Dinkumware'sstd::thread/std::mutexwrappers call it to turn a_Thrd_resultinto astd::system_error.Fix branch ready:
screamm:feat/ampr-throw-cpp-error(bed1deaf, one commit onmain2bb78d2c). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is. This one touches the guest exception runtime, so it deserves a careful look.[[noreturn]]and calls a new libc helperThrowCppError_nid_no_patch(src/exception/StandardExceptions.cpp). For codes 0 to 6 it throws a gueststd::system_errorthrough the existing__cxa_allocate_exception/__cxa_throwpath typed_ZTISt12system_error, so a title'scatch (std::system_error&),catch (std::runtime_error&)orcatch (std::exception&)catches it. The object is 32 bytes: the existing 16-byte runtime_error part, the error value at 16 and the category pointer at 24; the value is the FreeBSD errno (busy 16, invalid argument 22, no such process 3, not enough memory 12, operation not permitted 1, deadlock 11, try again 35) andwhat()is "message: message" as VC12 composes it. Other codes throw a hoststd::out_of_range. A static genericerror_categorywith VC12's virtual order is added (name()"generic",default_error_conditionand bothequivalentoverloads;message()throws because the gueststd::stringlayout is not modelled; the deleting destructor throws). The existingsystem_errorcopy constructors and assignment now copy the error code, which they left uninitialised. Sources: VC12 Dinkumwarethread0.cpp,system_error,syserror.cpp(ganboing/crt.vc12f1d47126), microsoft/STLthread0.cpp/xthreads.h(da52dc0f), aerolib's_Error_objects<int>::_Generic_objectand_Syserror_mapnames confirming the VC12 model. TechnicalDebt records that the category is not the console's object (soe.code() == std::errc::...compares unequal untilgeneric_category()is exported), the virtual order, the layout and the hostout_of_range.guest_ampr_cpp_error(C++ plus a.Swith a guest personality and LSDA, like libc's message destructor test) catches all seven codes assystem_error, plus one each asruntime_errorandexception, checking type name,what()through the guest vtable, the errno value, the category's name and comparisons, the throwingmessage()and deleting destructor, copy and assignment keeping the code, and -1/7 throwingout_of_range.Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
BUILD_TESTING=ON, full build includinglibs:guest_ampr_cpp_error,guest_ampr_markers,guest_ampr_threads5/5 and the 24 exception-runtime tests 3/3 (oneguest_ampr_markersrun aborted once in the first repeat batch and passed on every rerun; I could not reproduce it);ctest -j8 -E "^agc_driver_|^video_out_flip"508/508 (with the #3329 test fix applied locally so the tree builds); withmain'sExport.cppthe new test fails;tools/check_conventions.py --base mainandgit diff --checkpass. Not run on Linux, where the test is not built.Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T09:52:47Z.
Independent verification on Linux (the gap noted in the report): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON.bed1deafonto currentmain(the branch was 239 commits behind): applies cleanly, no conflicts.tools/check_conventions.py --base origin/mainandgit diff --checkpass.guest_ampr_markers,guest_ampr_threadsand the exception-runtime tests pass.guest_ampr_cpp_erroritself is MinGW-only (if(MINGW)in the CMakeLists), so as the report notes it is not built on Linux and could not be run here.ctest -j8 -E "^agc_driver_|^video_out_flip"): 520/520 passed.The rebased branch is available at
blawesom:verify/3346for anyone carrying — the commit is otherwise unchanged.