Skip to content

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

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
einfachama:fix/agc-sampler-stack-seh-toolchain
Nov 27, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
einfachama:fix/agc-sampler-stack-seh-toolchain

Conversation

@einfachama

Copy link
Copy Markdown
Contributor

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, 11-19, 11-20.
  • WinLibs windows job of the main push build at 0a025bd, passing: job.

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

… data on SEH toolchains

The process sampler stack fixture has no .pdata only when the libraries
build with -fno-asynchronous-unwind-tables (DWARF exceptions, WinLibs).
With an SEH toolchain such as MSYS2 UCRT64 GCC every function has
.pdata, so the test stopped before checking the sampler. On SEH builds,
require the native unwind entry and check the caller through it; DWARF
builds keep requiring its absence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head d36d0c84b0, applied with git apply on main fd4aeed483 together with the other 29 PRs of one batch (#16191, #16207, #17573, #18945, #20978, #21054, #22002, #22003, #22042, #22078, #22822, #24484, #12860, #18915, #19999, #22160, #22890, #22891, #23488, #23751, #24051, #24578, #14506, #19462, #22206, #22291, #22627, #24048, #24424). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
agc_process_sampler_stack, agc_worker_sampler_process (2 tests, matched by name to the test file this PR changes) all pass all pass

Whole batch: the full ctest -j 12 (6526 tests) on the RTX 3080 has 15 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked. Traced to other PRs of the batch, each by reverting it and testing again: #12860 (guest_user_service_account_name_limits, guest_user_service_age_level_guest_bounds, guest_user_service_initial_user_bounds, guest_user_service_kratos), #22891 (nkwebkit_securityorigin), #18915 (public_headers); none is in this PR's area. Failing tests I could not trace to a single PR (reverting the likely candidates did not clear them): guest_apr_read_longeof, guest_filesystem, guest_kernel_rename, guest_windows_directory_link_types, tools_patch_advisor_json, tools_suggest_patches. The 2125 agc_/video tests on the iGPU have 2 failing: agc_driver_stencil_plane_memory, agc_driver_store_over_untracked (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

@Jirka135

Copy link
Copy Markdown
Contributor

Windows run on the toolchain this change targets: on main the test fails the same way as the MSYS2 nightly, and with this change merged it passes.

Setup: Windows 11 Enterprise 10.0.26300, Ryzen 7 9800X3D, MSYS2 UCRT64 GCC 16.2.0 (Rev7), cmake 4.5, Ninja, Release, BUILD_TESTING=ON. Configure took the SEH path (ANYPS5_MINGW_SYSV_SEH_EXCEPTIONS=1). Head d36d0c84b0 merged with git merge --no-ff onto main 8b40357971. 3 runs each, each in a fresh ctest process.

Tree ctest -R "^agc_process_sampler_stack$"
main 8b40357971 fails 3/3: fixture unexpectedly has native Windows unwind metadata
main + this PR passes 3/3: process sampler caller: passed (45 inclusive samples)

AI-assisted: yes

@mihiii1337

Copy link
Copy Markdown
Contributor

An isolated WinLibs control for the MSYS2 report in #25167. On Windows 11 build 26300 with WinLibs GCC 15.2.0 r7, the project’s -fno-asynchronous-unwind-tables flag leaves __SEH__ undefined for this test. Both test executables contained .ehfram.

Test fixture agc_process_sampler_stack Inclusive caller samples
main 8763aeffdc 10/10 passed 43–45
With the test from d36d0c84b0 10/10 passed 44–45

I rebuilt the fixture and sampler with the project’s Release compile and link settings. Both builds shared the same existing test wrappers and libc.prx from e60b2f74ad. This isolates the fixture change on the WinLibs DWARF path. AI-assisted testing.

@einfachama

Copy link
Copy Markdown
Contributor Author

The Windows MSYS2 nightly has failed on agc_process_sampler_stack (fixture unexpectedly has native Windows unwind metadata) in every run that reached ctest since 13 November: 13 Nov, 14 Nov, 17 Nov, 19 Nov, 20 Nov, 21 Nov.

Until 20 November unwind_cursor and unwind_enclosing_function failed with it; #24502 fixed those. The 21 November run (main a300f8483b, after #24502) fails only this test. Its check_skips.py step, which does not run after a ctest failure, passes on that run's ctest.xml (1559 skips, all expected).

This PR makes the test pass on MSYS2 UCRT64 GCC 16.2.0: 10/10 in my runs with #24502 and this PR on main, and 3/3 in Jirka135's run above, which fails 3/3 on main. So merging it should turn the nightly green, with two caveats outside this PR:

AI-assisted: yes

@mihiii1337 mihiii1337 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants