test(libc): cover the unwind context accessors #9775
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9775"
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 DavidSamir on 2026-10-22T14:16:42Z.
What
Adds
guest_unwind_accessors, a test for the ten accessors of_Unwind_Contextinlibc/src/exception/Unwind.cppthat no test named or ran (found by a gcov run of the CPU-side tests, which listed them with zero hits):_Unwind_GetGR,_Unwind_SetGR,_Unwind_GetIP,_Unwind_SetIP,_Unwind_GetIPInfo,_Unwind_GetCFA,_Unwind_GetLanguageSpecificData,_Unwind_GetRegionStart,_Unwind_GetDataRelBaseand_Unwind_GetTextRelBase.It builds a context the way
ExceptionPersonalitydoes and checks:SetIP,GetIPandSetGR;_Unwind_GetIPInforeturns the instruction pointer, reports the signal frame flag as the before-instruction flag, and accepts a null flag pointer;No source file changes.
Tested
Windows 11, WinLibs GCC 15.2.0, Release, on
main8b3e39832a:guest_unwind_accessorspasses 3 of 3._Unwind_GetDataRelBasereturningtextBase, it fails at line 77 (GetDataRelBaseis0x8400).python tools/check_conventions.py --base origin/mainpasses.Linux (Ubuntu 24.04 in WSL2, GCC 13.3.0, Release):
guest_unwind_accessors,exception_runtimeandexception_personalitypass 3 of 3.Not run on macOS. An out-of-range register index aborts in the source and is not tested.
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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T14:34:59Z.
Review: APPROVED
The test covers all ten named accessors, independent register writes, the IP/register-16 alias, signal-frame behavior and a null
beforepointer. I compared those expectations with the current implementations inUnwind.cpp; they match. The negative control for the text/data base accessor is also useful.The hosted
register-contextsuite passes on Ubuntu and macOS Intel in both Debug and Release, and conventions/eligibility/relinker/ASan/write-watch checks pass. Linux and Windows product jobs are skipped by repository policy. I did not run the CTest locally because this checkout has no configured build and less than 1 GB of free disk. No open PR implementing these accessors was found. #9773 also inserts a separate test registration in the same CMake block; the changes compose cleanly and do not require an ordering dependency.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T16:36:13Z.
Review: DISMISSED
This test-only addition exercises all ten unwind accessors, each of the 17 general registers and the instruction-pointer/register-16 alias, plus signal-frame behavior and the context-base fields. The CMake registration is consistent with nearby libc tests. Current-main conventions and
git diff --checkpass. I did not rerun the test locally; the PR reports three passing Windows runs and three passing Linux WSL2 runs. Upstream product jobs are skipped.This branch is 24 commits behind live
main(499b1cf9fc44da935fe6d63813675ad5810e8402). CONTRIBUTING.md requires branches to be based on and kept up to date withmain. Please sync it and rerunguest_unwind_accessorson the resulting head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T16:58:12Z.
Review: COMMENTED
The exact head
48b936e3945a1f9a3f1d953e3ad7a9cfd8d1b877has a clean merge tree with currentmain(11f976b27c16ed91633f00039dba5dfd97dd7cc1); conventions andgit diff --checkpass. The new test covers all ten accessors, all 17 register slots, IP aliasing, signal-frame reporting and context fields. The PR’s hosted register-context matrix passes on Ubuntu and macOS Intel Debug/Release; product Linux/Windows jobs are skipped. Windows/Linux runs in the description are contributor-reported. This branch is based on8b3e39832a, 32 commits behind current main. Please rebase and rerunguest_unwind_accessorson the refreshed head before merge. I did not rerun locally.Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-25T07:05:22Z.
Review: APPROVED
Reviewed
48b936e3945a1f9a3f1d953e3ad7a9cfd8d1b877against author merge base8b3e39832af85f404c6195418d11b3e1ebd1924d.Approve. No actionable findings in this accessor-test addition.
Reviewed the full test/CMake patch and pinned _Unwind_Context plus Unwind.cpp accessors: all 17 register slots, instruction-pointer aliasing, signal-frame before flag (including nullptr output), distinct metadata fields, and preservation of unrelated registers are checked consistently with implementation. This test exercises field access, not stack unwinding.
Validation: exact head test compiled and ran successfully with the pinned Unwind.cpp translation unit, using function/data sections and linker garbage collection. The existing development libc DLL supplied ancillary link dependencies; this is not a complete pinned libc rebuild. A prior DLL-only attempt lacked UnwindCursorSlots and was superseded by that source build. Head syntax, conventions, whitespace and registration passed. Baseline has no new test. Hosted native product jobs were skipped; no full exception-unwind/application test is claimed.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-30T15:38:40Z.
Review: COMMENTED
This head fails
public_headers, both on its own and merged into currentmain.Ubuntu 26.04, i7-8700, GCC 15.2, Release,
BUILD_TESTING=ON. Head9f7fbe4ebamerged (--no-commit) ontomained1e0ed08f; the merge is clean.The ten accessors were already declared in
prx/libc/include/Api.hpp(lines 1392 to 1401) by #10706, which is in this branch's base5454cd2e45. The fix-up commit9f7fbe4ebaadds them a second time toexceptions/Unwind.hpp, and the audit requires one declaration per export:The same happens for the other nine. Dropping the ten lines from
Unwind.hppand includingApi.hppin the test fixes it:With that change, on the same merge:
public_headersand the 64public_headers_compile_*tests pass (65/65).guest_unwind_accessorspasses 3/3.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.