runtime: report the memory region for a traced access violation (RT-STARTUP-TRACE) #1096

Closed
github-bot wants to merge 1 commit from gh-pr/1096/head into gh-pr/1096/base
Owner

@⁠Moriz82 on GitHub · 2026-11-24 18:21 UTC · original
split/rt-startup-trace → main · +10 −0 · 2 files · 1 commits · closed without merging

Claimed in the coordination issue as: RT-STARTUP-TRACE (claim).

Part of the split of #984 into small pull requests.

Depends on: none
Overlaps: #984 (integration source). #41 adds caller information for a null target. #638 handles breakpoint skipping. Neither records the faulting address's memory region.

What and why

The opt-in startup trace records the address and operation of an access violation. Those fields alone cannot distinguish an unallocated range from a committed read-only page or a mapped view. When VirtualQuery succeeds, the exception event now includes the region base, allocation base, size, state, protection and type. A failed query leaves the rest of the event available. The handler continues exception processing as before.

Startup tracing remains off by default. Enable it with gta6rt --trace FILE.

Tested

Cross-built with clang-cl 23 and the xwin SDK. Ran the synthetic exception fixture under Proton Experimental (Wine 11) on CachyOS Linux 7.3, Ryzen 5 5600X and 16 GB RAM.

cmake --build runtime/build/boot --target gta6rt startup_trace_test -j6
ctest --test-dir runtime/build/boot -j1 -R '^startup_trace$' --output-on-failure
python3 -I scripts/check_no_game_data.py runtime/shims/startup_trace.h runtime/test/startup_trace_test.cpp
git diff --check
  • Base 3aa975421 with the new assertion passed 26/27 checks. The trace lacked the faulting page's region.
  • Child passed 27/27 checks and 1/1 CTest. The synthetic access violation reported free memory. The test also checks the access kind, exception location and stack.
  • Native Windows and AMD/Intel GPU runs were not performed.

GPUs tested: none. The fixture exercises CPU memory and exception tracing.
AI-assisted: yes

Checklist

  • Based on current upstream main at the cut. Merge check passed against the subsequently fetched main.
  • One topic with a synthetic regression test.
  • Content guard and whitespace check passed.
  • No translator rule changed.

🤖 Generated with Claude Code

**@⁠Moriz82** on GitHub · 2026-11-24 18:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1096) `split/rt-startup-trace` → `main` · +10 −0 · 2 files · 1 commits · closed without merging Claimed in the coordination issue as: RT-STARTUP-TRACE ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)). Part of the split of #984 into small pull requests. Depends on: none Overlaps: #984 (integration source). #41 adds caller information for a null target. #638 handles breakpoint skipping. Neither records the faulting address's memory region. ### What and why The opt-in startup trace records the address and operation of an access violation. Those fields alone cannot distinguish an unallocated range from a committed read-only page or a mapped view. When `VirtualQuery` succeeds, the exception event now includes the region base, allocation base, size, state, protection and type. A failed query leaves the rest of the event available. The handler continues exception processing as before. Startup tracing remains off by default. Enable it with `gta6rt --trace FILE`. ### Tested Cross-built with clang-cl 23 and the xwin SDK. Ran the synthetic exception fixture under Proton Experimental (Wine 11) on CachyOS Linux 7.3, Ryzen 5 5600X and 16 GB RAM. ```sh cmake --build runtime/build/boot --target gta6rt startup_trace_test -j6 ctest --test-dir runtime/build/boot -j1 -R '^startup_trace$' --output-on-failure python3 -I scripts/check_no_game_data.py runtime/shims/startup_trace.h runtime/test/startup_trace_test.cpp git diff --check ``` - Base `3aa975421` with the new assertion passed 26/27 checks. The trace lacked the faulting page's region. - Child passed 27/27 checks and 1/1 CTest. The synthetic access violation reported free memory. The test also checks the access kind, exception location and stack. - Native Windows and AMD/Intel GPU runs were not performed. GPUs tested: none. The fixture exercises CPU memory and exception tracing. AI-assisted: yes ### Checklist - [x] Based on current upstream main at the cut. Merge check passed against the subsequently fetched main. - [x] One topic with a synthetic regression test. - [x] Content guard and whitespace check passed. - [x] No translator rule changed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
An access violation in the startup trace gives the address and operation but
does not identify the allocation or its page protection.

When startup tracing is enabled, query the memory region at the fault
address. Include its state, protection, type and allocation bounds when the
query succeeds. The exception handler continues its usual search.

Cross-built gta6rt and startup_trace_test. With the new assertion, 1 of 27
checks failed on the base. All 27 passed with the change under Wine.


AI-assisted (Codex and Claude Code agents).

Co-authored-by: Plaaasma <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:37:57 +00:00
github-bot closed this pull request 2026-11-26 09:37:57 +00:00
Author
Owner

@⁠Plaaasma on GitHub · 2026-11-24 18:38 UTC · original

Native Windows check, AI-assisted (Claude Code). Windows 11, i9-13900K, 64 GB, RTX 4070 Ti 12 GB (NVIDIA 630.20), MSVC 2022 (VS 17 generator, Release), Vulkan.

Head 51868dfbe. Built startup_trace_test, then ctest -C Release -R "^startup_trace" --output-on-failure --timeout 300:

  • startup_trace: passed, 0.14 s (27 check(s), 0 failed)

1 passed, 0 failed.

**@⁠Plaaasma** on GitHub · 2026-11-24 18:38 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1096#issuecomment-7140924728) Native Windows check, AI-assisted (Claude Code). Windows 11, i9-13900K, 64 GB, RTX 4070 Ti 12 GB (NVIDIA 630.20), MSVC 2022 (VS 17 generator, Release), Vulkan. Head `51868dfbe`. Built `startup_trace_test`, then `ctest -C Release -R "^startup_trace" --output-on-failure --timeout 300`: - `startup_trace`: **passed**, 0.14 s (`27 check(s), 0 failed`) 1 passed, 0 failed.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 18:41 UTC · original · approved these changes

Audited and verified. Enriches access violation diagnostic logging in
untime/shims/startup_trace.h with VirtualQuery memory region details (ase, llocation_base, size, state, protect, ype). Verified in
untime/test/startup_trace_test.cpp. Clean-room compliant. Approved.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:41 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1096#pullrequestreview-6045221959) · **approved these changes** Audited and verified. Enriches access violation diagnostic logging in untime/shims/startup_trace.h with VirtualQuery memory region details (ase, llocation_base, size, state, protect, ype). Verified in untime/test/startup_trace_test.cpp. Clean-room compliant. Approved.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 18:51 UTC · original · approved these changes

Clean-Room Audit — PR #1096 (RT-STARTUP-TRACE Access Violation Region Info)

Very helpful diagnostic improvement in runtime/shims/startup_trace.h: logging VirtualQuery region metadata (base, allocation_base, size, state, protect, type) on access violations makes unmapped/guard/free-memory stops immediately diagnosable. Cleanly verified in runtime/test/startup_trace_test.cpp; 0 game data.

Verdict: APPROVED

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:51 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1096#pullrequestreview-6045356456) · **approved these changes** ### Clean-Room Audit — PR #1096 (`RT-STARTUP-TRACE` Access Violation Region Info) Very helpful diagnostic improvement in `runtime/shims/startup_trace.h`: logging `VirtualQuery` region metadata (`base`, `allocation_base`, `size`, `state`, `protect`, `type`) on access violations makes unmapped/guard/free-memory stops immediately diagnosable. Cleanly verified in `runtime/test/startup_trace_test.cpp`; 0 game data. **Verdict: APPROVED**
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:18 UTC · original

Recommendation: [MERGE]

Reasoning: Adds the VirtualQuery memory region to the opt-in startup trace's access-violation event (+10 lines), part of the #984 split. Diagnostic only, behind an opt-in trace. Verified natively on Windows by Plaaasma (startup_trace passes). CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 2/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1096#issuecomment-7143339567) **Recommendation:** [MERGE] **Reasoning:** Adds the `VirtualQuery` memory region to the opt-in startup trace's access-violation event (+10 lines), part of the #984 split. Diagnostic only, behind an opt-in trace. Verified natively on Windows by Plaaasma (`startup_trace` passes). CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 2/10
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-24 21:49 UTC · original

GPU verification (AI-assisted, independent worker on the shared test box) — head 51868dfbe. Note: this PR is based on 3aa975421, not current origin/main (58be9cdf8).

Change is 8 lines in runtime/shims/startup_trace.h (VirtualQuery region info appended to the logged access-violation record) plus one new check in startup_trace_test.cpp.

Host tests (ctest -R 'startup_trace|run_startup', TEMP/TMP pointed at a user-writable dir — agent shells otherwise default to C:\Windows and these tests fail with 0xc0000409, environmental): 2/2 passed — startup_trace (26 checks incl. the new "region" assertion: base 0x0, state MEM_FREE for the null dereference) and run_startup_cmdline.

GPU suite py -3.14 -I scripts/run_gpu_tests.py --build runtime/build on the AMD Radeon iGPU (gfx1035, driver 24.10.24, Vulkan 1.3.280): VK_LOADER_DRIVERS_SELECT=*amd-vulkan* LEONIDA_VK_DEVICE=radeon VK_LOADER_LAYERS_DISABLE=~implicit~ LEONIDA_VK_VALIDATION=1 LEONIDA_PC_TAIL_UBO=1, LLVM_MC=wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc → 230/252 passed, 20 skipped, 2 failed: ms_clip and ms_wave_info_s3, byte-identical to the origin/main baseline on this machine — known AMD LLPC issue (#802/#808). 261 shaders translated, 261 pass spirv-val. No validation errors.

Verdict: PASS — low-risk instrumentation; host coverage and a full validated GPU pass show no regressions.

**@⁠whoalin1** on GitHub · 2026-11-24 21:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1096#issuecomment-7145435689) GPU verification (AI-assisted, independent worker on the shared test box) — head `51868dfbe`. Note: this PR is based on `3aa975421`, not current `origin/main` (`58be9cdf8`). Change is 8 lines in `runtime/shims/startup_trace.h` (VirtualQuery region info appended to the logged access-violation record) plus one new check in `startup_trace_test.cpp`. Host tests (`ctest -R 'startup_trace|run_startup'`, `TEMP`/`TMP` pointed at a user-writable dir — agent shells otherwise default to `C:\Windows` and these tests fail with 0xc0000409, environmental): **2/2 passed** — `startup_trace` (26 checks incl. the new `"region"` assertion: base 0x0, state MEM_FREE for the null dereference) and `run_startup_cmdline`. GPU suite `py -3.14 -I scripts/run_gpu_tests.py --build runtime/build` on the AMD Radeon iGPU (gfx1035, driver 24.10.24, Vulkan 1.3.280): `VK_LOADER_DRIVERS_SELECT=*amd-vulkan* LEONIDA_VK_DEVICE=radeon VK_LOADER_LAYERS_DISABLE=~implicit~ LEONIDA_VK_VALIDATION=1 LEONIDA_PC_TAIL_UBO=1`, `LLVM_MC=wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc` → **230/252 passed, 20 skipped, 2 failed**: `ms_clip` and `ms_wave_info_s3`, byte-identical to the `origin/main` baseline on this machine — known AMD LLPC issue (#802/#808). 261 shaders translated, 261 pass spirv-val. No validation errors. Verdict: PASS — low-risk instrumentation; host coverage and a full validated GPU pass show no regressions.
Author
Owner

@⁠Moriz82 on GitHub · 2026-11-25 03:41 UTC · original · edited 2026-11-25 03:59 UTC

Current main already reports the memory region for a traced access violation and includes the same startup-trace test. #984 brought in both. A rebase leaves a single source comment describing that behavior.

For the check alert on 51868df, Runtime, No Game Data, and CI ran zero jobs while waiting for maintainer approval. The label job was cancelled before a runner picked it up. A trial merge against 5129be10 adds just the comment. The trace fields and test are already in #984.

AI-assisted.

**@⁠Moriz82** on GitHub · 2026-11-25 03:41 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1096#issuecomment-7152147518) · edited 2026-11-25 03:59 UTC Current main already reports the memory region for a traced access violation and includes the same startup-trace test. #984 brought in both. A rebase leaves a single source comment describing that behavior. For the check alert on `51868df`, Runtime, No Game Data, and CI ran zero jobs while waiting for maintainer approval. The label job was cancelled before a runner picked it up. A trial merge against `5129be10` adds just the comment. The trace fields and test are already in #984. AI-assisted.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.