feat(libSceAmpr): implement std::_Throw_Cpp_error #3679
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3679"
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 MarcZX10 on 2026-10-11T15:13:32Z.
What
std::_Throw_Cpp_error(int)for the seven VC12 Dinkumware thread error codes.std::system_errorobjects with their FreeBSD errno and generic category; reject out-of-range codes withstd::out_of_range.error_codethroughsystem_errorcopies and assignments, and add a MinGW-only guest exception regression test.This carries David's implementation from issue #3346, retaining his commit author. The
what()text follows VC12'sthread0.cppand_Generic_error_category::message/_Syserror_mapinsyserror.cpp: the lowercase table message followed by the lowercase generic category message for the errno (for these seven codes, the strings are identical). Console behavior has not been verified.Tested
python3 tools/check_conventions.py --base upstream/mainandgit diff --check upstream/main...HEADpassed.guest_ampr_cpp_errortest: it has no MinGW compiler, and local CMake configuration could not find system SDL2 development files while the pinned SDL2 submodule commit could not be fetched from this checkout.guest_ampr_cpp_error(5/5) and the listed exception-runtime tests.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)Closes #3346.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T15:13:56Z.
Progress report (
1acfa7f→2dc4d9d)📈 System libraries: 86.39% (+0.03%, +1 implemented functions)
✅ 1 implemented
_ZSt16_Throw_Cpp_errori_nid_postfixImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T15:18:42Z.
Review: CHANGES_REQUESTED
Thanks for carrying this. Build and ctest are green here on top of current
main(76/76 in the touched libraries); the new test is MinGW-only, so it could not be run on Linux.One problem, in the second commit:
core/libs/prx/libc/src/exception/StandardExceptions.cpp:380-385andcore/libs/tests/GuestAmprCppError.cpp:26-32expectwhat()="device or resource busy: Device busy", anddocs/dev/TechnicalDebt.md:354says this follows VC12'ssyserror.cpp. In that file,_Generic_error_category::messagereturns_Syserror_map(code), which is the lowercase_Sys_errtab("device or resource busy","invalid argument", ...). microsoft/STL does the same. So by the cited source the text is"device or resource busy: device or resource busy", as in your first commit."Device busy","Cannot allocate memory"and"Resource temporarily unavailable"are FreeBSDstrerrorstrings, not VC12's.libc.prx_Generic_error_category::message/_Syserror_mappath) and cite that in TechnicalDebt as unverified-against-VC12. Otherwise revert the second commit's message change and its test expectations.Everything else looked right: the seven codes and order match VC12
thread0.cpp, errno values are FreeBSD's, out-of-range codes throw, and the copy/assign now carry theerror_code.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T15:23:34Z.
Thanks for checking the pinned source. You are right: VC12's generic category calls
_Syserror_map, and the entries for these seven errno values are lowercase. I incorrectly treated them as FreeBSDstrerrormessages.I reverted my message-text follow-up; the branch now uses the repeated lowercase strings from the original implementation, matching
thread0.cppandsyserror.cpp. I also updated the PR description. The corrected branch head is94a393579c92f27ccf3a334a788cfc1080c4f1bb.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T16:07:15Z.
Requested VC12 correction is in the current head
The title-case message change was reverted. Head
94a3935now uses the lowercase VC12_Syserror_mapstrings, and the PR description and TechnicalDebt entry reflect that source. The applicable CI checks on this head pass; the PR's earlier touched-library build and ctest report was green.@adriadam10, could you re-review the corrected head? The separate #3499 overlap is in different exports; we can rebase if it lands first.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T23:16:22Z.
Conflicts with main in
core/libs/prx/libSceAmpr/Export.cppanddocs/dev/TechnicalDebt.md; please rebase. The message text is right now.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T00:34:18Z.
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/libSceAmpr/Export.cppL834-843docs/dev/debt/libc.mdL58_ZSt16_Throw_Cpp_errori_nid_postfixImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T17:29:45Z.
The current PR head (
e456729) includes the requested VC12 message correction:_Throw_Cpp_erroruses the lowercase_Syserror_mapstrings, andwhat()repeats that string for the generic category. The head also includes currentmain. Could you re-review this updated head when convenient? The new CI jobs are still queued.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T18:06:34Z.
Coordination note on the overlap with #4164: its current patch removes
_ZSt16_Throw_Cpp_errori_nid_postfixfromlibSceAmprand leaves a throwing export inlibc. Issue #3346 reports Deathloop and Minecraft Legends importing the AMPR export, while #4164 documents Unity titles importing fromlibc. Since the import library is part of resolution, these reports may require both providers. I asked #4164’s author to verify the AMPR import source before this overlap is resolved; #3679’s current code is unchanged.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T20:48:09Z.
Review: APPROVED
Checked on top of current
main: build and ctest of libs, libSceAmpr and libc are green on Linux (90/90). The newguest_ampr_cpp_errortest is MinGW-only, so it was not run here; the full Windows build was dispatched for this PR (run 38306435583) and the earlier Windows 11 run reported by @screamm covers it. Thewhat()text matches VC12'ssyserror.cpp, as discussed above.Merging once that Windows run is green. #4164 also touches
_ZSt16_Throw_Cpp_errori; it will need to rebase over this.