feat(libc): implement std::bad_weak_ptr and _Throw_bad_weak_ptr #1143
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1143"
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 reyani-dev on 2026-10-07T14:11:39Z.
What
tools/nid_names.pyresolves the libc stubBnMAMrsfVWo(sceLibcUnknown_BnMAMrsfVWoinHeapDiagnostics.cpp) to_ZSt19_Throw_bad_weak_ptrv, i.e.std::_Throw_bad_weak_ptr(), whichstd::shared_ptr's constructor from an expiredweak_ptrcalls._ZSt19_Throw_bad_weak_ptrv_nid_postfix, which throws a gueststd::bad_weak_ptrthroughLibcException::ThrowPlain, like_Xbad_function_calland_Xbad_alloc.std::bad_weak_ptr: type info (St12bad_weak_ptr, basestd::exception), vtable,D0/D1/D2andwhat().what()returns"bad_weak_ptr", as libc++ and libstdc++ do.BnMAMrsfVWoentry from TechnicalDebt.Note: #545 and #407 add throwing stubs named
_ZTVSt12bad_weak_ptr_nid_postfixand_ZNSt12bad_weak_ptrD1Ev_nid_postfix(as functions). This PR defines the vtable as data in libc, so whichever lands second needs to drop the stubs.Tested
Added a case to
exception_runtime_tests: calling_Throw_bad_weak_ptris caught as a hoststd::bad_weak_ptrandwhat()is"bad_weak_ptr". I have no local toolchain on this machine, so I'm relying on CI (Linux and Windows) for the build and tests. No title tested.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T14:33:49Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libc/src/exception/StandardExceptions.cppL291Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T04:36:13Z.
Progress report (
8e22498→df570de)📈 System libraries: 85.2% (+0.05%, +5 implemented, -1 removed functions)
✅ 5 implemented
_ZNKSt12bad_weak_ptr4whatEv_nid_postfix_ZNSt12bad_weak_ptrD0Ev_nid_postfix_ZNSt12bad_weak_ptrD1Ev_nid_postfix_ZNSt12bad_weak_ptrD2Ev_nid_postfix_ZSt19_Throw_bad_weak_ptrv_nid_postfix🗑️ 1 removed
sceLibcUnknown_BnMAMrsfVWoImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T08:15:40Z.
Checked: the stub
BnMAMrsfVWois gone with its TechnicalDebt line,std::bad_weak_ptrfollows the existingbad_function_callpattern (type info withstd::exceptionbase, vtable, D0/D1/D2,what()="bad_weak_ptr"as in MS STL, libc++ and libstdc++), and the new case inexception_runtime_testsfails to link without the change.Rebased onto current
main(the only conflicts were adjacency with the_Xbad_function_calladditions inStandardExceptions.cppandExceptionRuntime.cpp); build and ctest pass (424/424). Merging once CI is green on the rebased head.