test(libSceAgcDriver): check the sampled caller through native unwind data on SEH toolchains #24354

Merged
einfachama merged 1 commit from upstream-pr/24354 into main 2026-11-27 13:53:12 +00:00
einfachama commented 2026-11-20 14:59:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by einfachama on 2026-11-20T14:59:32Z.


What

agc_process_sampler_stack fails on every Windows build with an SEH toolchain (MSYS2 UCRT64 GCC) before it checks the sampler: fixture unexpectedly has native Windows unwind metadata. The check came with #13131. It requires Busy to have no RUNTIME_FUNCTION, so the walk takes the .ehfram path. That holds only when core/libs/CMakeLists.txt adds -fno-asynchronous-unwind-tables, which it does for DWARF exceptions (WinLibs). With an SEH toolchain every function has .pdata.

The test now branches on __SEH__, as core/libs/tests/GuestModuleInfo.cpp does. On SEH builds it requires the fixture's native unwind entry and checks the caller through RtlVirtualUnwind. DWARF builds keep the same check and message as before (-fno-asynchronous-unwind-tables leaves __SEH__ undefined), so the .ehfram walk stays covered by the WinLibs job. The sampler code is the same on both toolchains, so there is no debt entry.

CI on main:

Tested

Windows 11 Pro 26H2 (10.0.26300), MSYS2 UCRT64 GCC 16.2.0-7, Release; WinLibs not tested locally, CI covers it.

  • agc_process_sampler_stack fails on main and passes 10 of 10 runs with this change (ctest --repeat until-fail:10), 44 to 45 inclusive caller samples each.
  • Preprocessing the test with MSYS2 GCC: NativeUnwindFixture is true at -O3 and false with -fno-asynchronous-unwind-tables, the flag DWARF builds use.
  • tools/select_tests.py selected 1135 tests; all pass with --timeout 120.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5415440802 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24354). Originally posted by [einfachama](https://github.com/einfachama) on 2026-11-20T14:59:32Z. --- ### What `agc_process_sampler_stack` fails on every Windows build with an SEH toolchain (MSYS2 UCRT64 GCC) before it checks the sampler: `fixture unexpectedly has native Windows unwind metadata`. The check came with #13131. It requires `Busy` to have no `RUNTIME_FUNCTION`, so the walk takes the `.ehfram` path. That holds only when `core/libs/CMakeLists.txt` adds `-fno-asynchronous-unwind-tables`, which it does for DWARF exceptions (WinLibs). With an SEH toolchain every function has `.pdata`. The test now branches on `__SEH__`, as `core/libs/tests/GuestModuleInfo.cpp` does. On SEH builds it requires the fixture's native unwind entry and checks the caller through `RtlVirtualUnwind`. DWARF builds keep the same check and message as before (`-fno-asynchronous-unwind-tables` leaves `__SEH__` undefined), so the `.ehfram` walk stays covered by the WinLibs job. The sampler code is the same on both toolchains, so there is no debt entry. CI on `main`: - Windows MSYS2 nightly, failing in this test: [11-17](https://github.com/boykopovar/AnyPS5/actions/runs/44046984610), [11-19](https://github.com/boykopovar/AnyPS5/actions/runs/44487917040), [11-20](https://github.com/boykopovar/AnyPS5/actions/runs/44702806599). - WinLibs `windows` job of the `main` push build at 0a025bd3c6, passing: [job](https://github.com/boykopovar/AnyPS5/actions/runs/44738270262/job/136302343069). ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11 Pro 26H2 (10.0.26300), MSYS2 UCRT64 GCC 16.2.0-7, Release; WinLibs not tested locally, CI covers it. - `agc_process_sampler_stack` fails on `main` and passes 10 of 10 runs with this change (`ctest --repeat until-fail:10`), 44 to 45 inclusive caller samples each. - Preprocessing the test with MSYS2 GCC: `NativeUnwindFixture` is `true` at `-O3` and `false` with `-fno-asynchronous-unwind-tables`, the flag DWARF builds use. - `tools/select_tests.py` selected 1135 tests; all pass with `--timeout 120`. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-11-21 01:55:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T01:55:16Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the available evidence supports the compiler-specific fixture expectation.

What I ran

Reviewed head d36d0c84b0845a24af1dec4008e226a941831f65 and its prepared diff. No commands or tests were run.

Results

Check Result Note
Diff and changed source passed One test file read
Tests not run Author reports CI and local runs

Findings

Blocking

None.

Non-blocking

None.

Not verified

Did not independently run the Windows test or verify the reported CI results. Reviewed core/libs/prx/libSceAgcDriver/tests/ProcessSamplerStack.cpp; manifest.json lists this as the only changed file and marks its full text included. No files were excluded in the supplied manifest.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6001984977 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24354#pullrequestreview-6001984977). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T01:55:16Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the available evidence supports the compiler-specific fixture expectation. ## What I ran Reviewed head `d36d0c84b0845a24af1dec4008e226a941831f65` and its prepared diff. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Diff and changed source | passed | One test file read | | Tests | not run | Author reports CI and local runs | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Did not independently run the Windows test or verify the reported CI results. Reviewed `core/libs/prx/libSceAgcDriver/tests/ProcessSamplerStack.cpp`; `manifest.json` lists this as the only changed file and marks its full text included. No files were excluded in the supplied manifest. ## To get this to a good state Nothing is required.
mihiii1337 commented 2026-11-23 14:59:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T14:59:47Z.

Review: APPROVED


Reviewed exact head d36d0c84b0845a24af1dec4008e226a941831f65 with a new native Windows-SEH control.

I compiled the exact test and WorkerSampler sources in Release with WinLibs GCC 15.2, linked them directly to the existing hashed runtime libraries, and confirmed the object uses the native SEH form (__SEH__, .pdata/.xdata). The full sampler test passed 43 checks, including the caller-frame samples that the current main test refuses when it sees native Windows unwind metadata. The corresponding DWARF control remains covered separately.

This is deliberately not a new MSYS2 build. The independent MSYS2 A/B already reported 0/3 on old main and 3/3 on this change, and the latest main MSYS2 nightly still reproduces fixture unexpectedly has native Windows unwind metadata; I am not claiming those runs as mine. The exact-head Hosted Windows job is green with the test executed; Hosted Linux was skipped. No GPU path was involved.

#26061's conditional skip is mechanically correct, but this PR is preferable because it preserves and exercises SEH stack-walk coverage rather than skipping it. Within that scope I found no remaining blocker. This approval is limited to the exact commit above.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6023895746 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24354#pullrequestreview-6023895746). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T14:59:47Z. **Review:** APPROVED --- Reviewed exact head `d36d0c84b0845a24af1dec4008e226a941831f65` with a new native Windows-SEH control. I compiled the exact test and `WorkerSampler` sources in Release with WinLibs GCC 15.2, linked them directly to the existing hashed runtime libraries, and confirmed the object uses the native SEH form (`__SEH__`, `.pdata`/`.xdata`). The full sampler test passed 43 checks, including the caller-frame samples that the current main test refuses when it sees native Windows unwind metadata. The corresponding DWARF control remains covered separately. This is deliberately not a new MSYS2 build. The independent MSYS2 A/B already reported 0/3 on old main and 3/3 on this change, and the latest main MSYS2 nightly still reproduces `fixture unexpectedly has native Windows unwind metadata`; I am not claiming those runs as mine. The exact-head Hosted Windows job is green with the test executed; Hosted Linux was skipped. No GPU path was involved. #26061's conditional skip is mechanically correct, but this PR is preferable because it preserves and exercises SEH stack-walk coverage rather than skipping it. Within that scope I found no remaining blocker. This approval is limited to the exact commit above. 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!24354
No description provided.