feat(libSceLibcInternal): implement bad_exception::_Doraise and its deleting destructor #24043
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24043"
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 PostMalloy on 2026-11-20T01:59:36Z.
What
Two
std::bad_exceptionexports oflibSceLibcInternalwere stubs:_ZNKSt13bad_exception8_DoraiseEv(NIDkTlQY47fo88) threw throughNotImplemented_nid_no_patch._ZNSt13bad_exceptionD0Ev(NIDlX9M5u0e48k) was the inventory stublibSceLibcInternalInventory_020, which threw too._Doraisenow throws a newstd::bad_exception, as Dinkumware's_RAISE(*this)does for a class with no state of its own. It mirrors the existingbad_allocandbad_typeid_Doraiseexports inExceptionVirtuals.cpp, including thestd::invalid_argumentfor a null object.libcgains aSt13bad_exceptiontype record, withSt9exceptionas its base, and a plain 8-byte vtable. Guest catch matching compares type names, so a guestcatch (std::bad_exception&)orcatch (std::exception&)catches the object.LibcThrowBadException_nid_no_patchhelper, likeLibcThrowOverflowError_nid_no_patch, throws it.what()returnsbad exception, the default message in Microsoft STL's<exception>, the Dinkumware-derived library the debt file already cites for_Xoverflow_error. The console's string is unverified, and the debt entry says so._ZTISt13bad_exceptionand_ZTVSt13bad_exceptionon the console is unknown, and exporting them from the wrong one would not resolve a title's import anyway.D0releases the object throughoperator delete. The existing debt entry "Empty facet and exception members" recordsbad_exception'sD1andD2as a bareretin firmware 13.42, and those stay as they are. The Itanium deleting destructor isD1followed byoperator delete, soD0calls_ZdlPv, as thebad_variant_accessD0inExceptionDestructors.cppdoes.The debt fragment drops
_Doraisefrom its "Additional 3.20 imports" entry and adds an entry describing both exports.#23809 is the only open PR I found that touches this area. It implements the two
istreambuf_iterator::equalexports listed in the same debt entry, and its fragment changes that entry to keep only_Doraise. This PR's fragment changes it from the other side, so whichever merges second has to drop the entry;tools/debt_fold.pyrefuses the pair until then. Its code changes are in other lines, so the two PRs do not conflict in code. #17300, which already conflicts withmain, renames thelibSceLibcInternalinventory stubs after their mangled names, includinglibSceLibcInternalInventory_020to_ZNSt13bad_exceptionD0Ev. It keeps that stub throwing, so it does not implementD0, but it will need to drop that rename after this PR.gh search prsfinds no other open PR mentioningbad_exception::_Doraise,_ZNKSt13bad_exception8_DoraiseEvor_ZNSt13bad_exceptionD0Ev, andpr_overlap.py --branchagainst the 100 most recent open PRs reports no overlap.Tested
Windows 11 x64 (10.0.26200), WinLibs MinGW-w64 GCC 15.2.0, Release.
guest_libc_internal_exception_virtuals, newCheckBadExceptionDoraise:_Doraiseon an object throws a new object.catch (const std::bad_exception&)catches it, with type nameSt13bad_exceptionandwhat()bad exception.catch (const std::exception&)also catches it.std::invalid_argument.guest_libc_internal_libc_forwards, newCheckBadException:D0on anoperator newblock releases exactly that block once through the registered application heap.what()string makesguest_libc_internal_exception_virtualsfail at the new check.mainwith this commit, after a full build: all 95 tests matchingguest_libc_internal,guest_exception_vtable,guest_sce_v2_exceptions,exception_personality,windows_exceptions,guest_exception_handler,guest_raise_exception,guest_mutex_raise_exceptionandundeliverable_host_exceptionpass.tools/check_conventions.py --base origin/mainandtools/debt_fold.py --checkpass.tools/nid_names.pygiveslX9M5u0e48kfor_ZNSt13bad_exceptionD0EvandkTlQY47fo88for_ZNKSt13bad_exception8_DoraiseEv, the NIDs the stubs exported.No title was found calling either export, and no PS5 hardware was used.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T02:17:14Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
c8229fea33:tools/check_conventions.pypassed.guest_libc_internal_exception_virtuals_tests,guest_libc_internal_libc_forwards_testsbuilt cleanly.guest_libc_internal_exception_virtuals,guest_libc_internal_libc_forwards):core/libs/prx/libSceLibcInternal/ExceptionDestructors.cpp,core/libs/prx/libSceLibcInternal/ExceptionVirtuals.cpp,core/libs/prx/libSceLibcInternal/InventoryExports.cpp,core/libs/prx/libSceLibcInternal/InventoryExports2.cpp,core/libs/prx/libSceLibcInternal/include/Api.hpp,core/libs/prx/libSceLibcInternal/include/ExceptionVirtuals.hpp,core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp,core/libs/prx/libSceLibcInternal/include/InventoryExports2.hpp,core/libs/prx/libc/include/Api.hpp,core/libs/prx/libc/src/exception/StandardExceptions.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T06:38:46Z.
Review: APPROVED
Reviewed — looks good
The reviewed changes at
c8229fea336681cffc1e505a1635900515a89161implement the two described exports and their tests; I found no blocking defect in the inspected code.What I ran
Read the prepared diff and relevant source ranges through
repo_read.py. No commands or tests were run by me.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The PR description reports Windows tests, conventions and debt checks, but I did not run them. Console behavior and the console’s
what()string remain unverified as noted by the author. All 13 changed files inmanifest.jsonwere included; I read the diff and relevant ranges, not every full file. Thefiles.jsonpath was unavailable in the review folder; the folder listing confirms the changed-file inventory.To get this to a good state
Nothing is required.