feat(libSceLibcInternal): implement std::nested_exception destructors #16356

Merged
heditrigui merged 2 commits from upstream-pr/16356 into main 2026-11-10 14:28:40 +00:00
heditrigui commented 2026-11-06 11:29:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by heditrigui on 2026-11-06T11:29:11Z.


What

  • Implements std::nested_exception virtual destructors in libSceLibcInternal:
    • _ZNSt16nested_exceptionD0Ev (NID za50kXyi3SA, deleting destructor)
    • _ZNSt16nested_exceptionD1Ev (NID +qKS53qzWdA, complete-object destructor)
    • _ZNSt16nested_exceptionD2Ev (NID 8R00hgzXQDY, base-object destructor)
  • Under the Itanium C++ ABI, std::nested_exception contains a vtable pointer followed by a std::exception_ptr member.
  • Base destructor D2 releases the nested exception pointer through libc's _ZNSt15__exception_ptr13exception_ptr10_M_releaseEv_nid_postfix and resets the pointer to null.
  • Complete-object destructor D1 executes D2.
  • Deleting destructor D0 executes D1 and deallocates the object using libc's _ZdlPv_nid_postfix.
  • Eliminates inventory stubs libSceLibcInternalInventory_052_nid_no_patch, libSceLibcInternalInventory_053_nid_no_patch, and sceLibcInternalUnknown6_064_za50kXyi3SA_nid_no_patch.
  • Updates docs/dev/debt/libSceLibcInternal.md technical debt documentation and counts.

Tested

  • Added unit tests in core/libs/tests/GuestLibcInternalNestedException.cpp verifying:
    • Null-pointer resilience for _ZNSt16nested_exceptionD2Ev_nid_postfix, _ZNSt16nested_exceptionD1Ev_nid_postfix, and _ZNSt16nested_exceptionD0Ev_nid_postfix.
    • Base destructor D2 resets the exception pointer without throwing.
    • Complete-object destructor D1 resets the exception pointer without throwing.
    • Deleting destructor D0 cleans up object state and deallocates dynamic memory via _ZdlPv_nid_postfix.
  • Verified conventions with python tools/check_conventions.py --base upstream/main (0 findings).
  • Audited public declarations with python core/libs/tests/test_public_headers.py --audit-only (407 libraries, 30714 exports verified).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5187146421 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16356). Originally posted by [heditrigui](https://github.com/heditrigui) on 2026-11-06T11:29:11Z. --- ### What - Implements `std::nested_exception` virtual destructors in `libSceLibcInternal`: - `_ZNSt16nested_exceptionD0Ev` (NID `za50kXyi3SA`, deleting destructor) - `_ZNSt16nested_exceptionD1Ev` (NID `+qKS53qzWdA`, complete-object destructor) - `_ZNSt16nested_exceptionD2Ev` (NID `8R00hgzXQDY`, base-object destructor) - Under the Itanium C++ ABI, `std::nested_exception` contains a vtable pointer followed by a `std::exception_ptr` member. - Base destructor `D2` releases the nested exception pointer through libc's `_ZNSt15__exception_ptr13exception_ptr10_M_releaseEv_nid_postfix` and resets the pointer to null. - Complete-object destructor `D1` executes `D2`. - Deleting destructor `D0` executes `D1` and deallocates the object using libc's `_ZdlPv_nid_postfix`. - Eliminates inventory stubs `libSceLibcInternalInventory_052_nid_no_patch`, `libSceLibcInternalInventory_053_nid_no_patch`, and `sceLibcInternalUnknown6_064_za50kXyi3SA_nid_no_patch`. - Updates `docs/dev/debt/libSceLibcInternal.md` technical debt documentation and counts. ### Tested - Added unit tests in `core/libs/tests/GuestLibcInternalNestedException.cpp` verifying: - Null-pointer resilience for `_ZNSt16nested_exceptionD2Ev_nid_postfix`, `_ZNSt16nested_exceptionD1Ev_nid_postfix`, and `_ZNSt16nested_exceptionD0Ev_nid_postfix`. - Base destructor `D2` resets the exception pointer without throwing. - Complete-object destructor `D1` resets the exception pointer without throwing. - Deleting destructor `D0` cleans up object state and deallocates dynamic memory via `_ZdlPv_nid_postfix`. - Verified conventions with `python tools/check_conventions.py --base upstream/main` (0 findings). - Audited public declarations with `python core/libs/tests/test_public_headers.py --audit-only` (407 libraries, 30714 exports verified). ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Depends on: none - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!16356
No description provided.