runtime: LEONIDA_SKIP_ASSERTS steps over guest asserts without a trace (OLD-9961, RT-526) #1395

Open
github-bot wants to merge 1 commit from github-bot/gh-1395 into main AGit
Owner

@⁠Diegobecker07 on GitHub · 2026-11-24 23:18 UTC · original
Diegobecker07:old-9961-skip-asserts → main · +366 −4 · 8 files · 1 commits · open

Claimed in the coordination issue as: OLD-9961 (#14)

Carries over the assert half of #228 (old upstream PR 9961 by slipperysquid, RT-526), rebased on current main, with the author kept. #228's other half, caller logging for forwarded device slots, is left out: #1390 carries old PR 9990 (#260), which does the same with a smaller change. With both in, #228 can be closed.

What and why

LEONIDA_SKIP_ASSERTS=N is a retail-boot diagnostic, off unless set. --init and --run install a vectored exception handler (runtime/src/assert_skip.h) before any image code runs. It steps over up to N int3 (0xCC) at addresses in no host module, and logs each one:

[rt] LEONIDA_SKIP_ASSERTS: int3 at game.exe+0x1234 stepped over (1 of 3)

After N it says so once, and the next int3 ends the run as before. It passes on:

  • an int3 in a host module;
  • a breakpoint with no 0xCC at its address;
  • a RIP that is neither at the 0xCC nor one past it.

It needs no --trace and no debugger. With a trace open, each skip is also an int3_skipped event.

LEONIDA_SKIP_INT3 stays as it is (trace only, no limit, one log per address). tools/int3_cause.py on main already names LEONIDA_SKIP_ASSERTS among the switches that report an assert's address, but main's runtime did not have it.

Compared with #228's commit:

  • left out: set_caller_describer / device_slot_first_caller in d3d12_xs_device.*, its call in main.cpp, check_slot_callers in xs_proxy_mock_test.cpp, the caller paragraph in docs/d3d12_command_objects.md, and the caller bullet in docs/boot.md;
  • the one conflict was in main.cpp: main's CPU-emulation handler is installed first, then this one.

The commit message says the same.

Tested

  • scripts\build_runtime.ps1 (MSVC 19.44, VS 2022 Build Tools, CMake 3.31.6 + Ninja, Vulkan SDK 1.4.363.0): builds.
  • ctest -R "assert_skip|int3_skip|skip_asserts|run_tiny_game|xs_proxy_mock|pe_loader|loader": 25/25 passed, among them the new assert_skip and run_tiny_game_skip_asserts.
  • Retail boot (own 1.0.2.1 copy, LEONIDA_D3D12=vulkan, overlay outside the package):
    • On main before #375, the same handler (#228 merged locally on 4a50cafc7) stepped over the render-target budget int3 with LEONIDA_SKIP_ASSERTS=5: int3 at game_scarlett_master.exe+0x… stepped over (1 of 5). The run then went on to XboxBvhBuilder.dll's first compute pipeline.
    • On current main with this branch, the handler is installed (LEONIDA_SKIP_ASSERTS=5: up to 5 int3 in guest code are stepped over). No guest int3 is reached any more, and the run ends as on main.

GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 621.24, Vulkan 1.4.357, Windows 11 Pro 26300

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)
**@⁠Diegobecker07** on GitHub · 2026-11-24 23:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1395) `Diegobecker07:old-9961-skip-asserts` → `main` · +366 −4 · 8 files · 1 commits · open Claimed in the coordination issue as: OLD-9961 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) Carries over the assert half of #228 (old upstream PR 9961 by slipperysquid, RT-526), rebased on current `main`, with the author kept. #228's other half, caller logging for forwarded device slots, is left out: #1390 carries old PR 9990 (#260), which does the same with a smaller change. With both in, #228 can be closed. ### What and why `LEONIDA_SKIP_ASSERTS=N` is a retail-boot diagnostic, off unless set. `--init` and `--run` install a vectored exception handler (`runtime/src/assert_skip.h`) before any image code runs. It steps over up to N `int3` (0xCC) at addresses in no host module, and logs each one: `[rt] LEONIDA_SKIP_ASSERTS: int3 at game.exe+0x1234 stepped over (1 of 3)` After N it says so once, and the next `int3` ends the run as before. It passes on: - an `int3` in a host module; - a breakpoint with no 0xCC at its address; - a RIP that is neither at the 0xCC nor one past it. It needs no `--trace` and no debugger. With a trace open, each skip is also an `int3_skipped` event. `LEONIDA_SKIP_INT3` stays as it is (trace only, no limit, one log per address). `tools/int3_cause.py` on `main` already names `LEONIDA_SKIP_ASSERTS` among the switches that report an assert's address, but `main`'s runtime did not have it. Compared with #228's commit: - left out: `set_caller_describer` / `device_slot_first_caller` in `d3d12_xs_device.*`, its call in `main.cpp`, `check_slot_callers` in `xs_proxy_mock_test.cpp`, the caller paragraph in `docs/d3d12_command_objects.md`, and the caller bullet in `docs/boot.md`; - the one conflict was in `main.cpp`: `main`'s CPU-emulation handler is installed first, then this one. The commit message says the same. ### Tested - `scripts\build_runtime.ps1` (MSVC 19.44, VS 2022 Build Tools, CMake 3.31.6 + Ninja, Vulkan SDK 1.4.363.0): builds. - `ctest -R "assert_skip|int3_skip|skip_asserts|run_tiny_game|xs_proxy_mock|pe_loader|loader"`: 25/25 passed, among them the new `assert_skip` and `run_tiny_game_skip_asserts`. - Retail boot (own 1.0.2.1 copy, `LEONIDA_D3D12=vulkan`, overlay outside the package): - On `main` before #375, the same handler (#228 merged locally on `4a50cafc7`) stepped over the render-target budget `int3` with `LEONIDA_SKIP_ASSERTS=5`: `int3 at game_scarlett_master.exe+0x… stepped over (1 of 5)`. The run then went on to `XboxBvhBuilder.dll`'s first compute pipeline. - On current `main` with this branch, the handler is installed (`LEONIDA_SKIP_ASSERTS=5: up to 5 int3 in guest code are stepped over`). No guest `int3` is reached any more, and the run ends as on `main`. GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 621.24, Vulkan 1.4.357, Windows 11 Pro 26300 AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change)
A diagnostic for the retail boot (RT-5 follow-ups), off the hot path and with no behaviour change unless asked
for: LEONIDA_SKIP_ASSERTS=N (src/assert_skip.h, installed by main.cpp before any image code runs under
--init/--run): a vectored handler, added last, steps over up to N int3 (0xCC) at addresses in no host module and
logs each one as module+RVA (and as an int3_skipped trace event when --trace is open). After N it says so once
and the next int3 ends the run as before. An int3 in a host module, a breakpoint with no 0xCC at its address, or
a RIP that is neither at nor one past the 0xCC is passed on. Needs no --trace and no debugger.

Tests (synthetic, no game files): assert_skip_test (int3 in a VirtualAlloc'd page, the limit, a host-module int3,
a two-byte int 3, value parsing) and run_tiny_game_skip_asserts (two int3 in the mapped stand-in game, stepped
over end to end).

Carried over from old upstream PR 9961 (#228) without its caller logging for forwarded device slots, which the
carry-over of old PR 9990 (#1390) brings instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:49:52 +00:00
Author
Owner

@⁠Diegobecker07 on GitHub · 2026-11-25 13:13 UTC · original

Rebased onto current main (0d80bc5df); the needs rebase label should clear on the next hourly run. slipperysquid's commit is kept with the same diff (+366/−4). The conflicts were additions at the same spot:

  • docs/boot.md: the LEONIDA_SKIP_ASSERTS bullet stays right after the LEONIDA_SKIP_INT3 one, whose caveat it refers to; main's LEONIDA_STUB_PIPELINES and splash bullets follow it.
  • runtime/CMakeLists.txt: run_tiny_game_skip_asserts stays next to run_tiny_game_stack; main's TLS tests are kept.
  • runtime/src/main.cpp: include list. The handler is still installed before loader.initialise(), the first image code that runs.

Re-verified on Windows 11 Pro (26300), MSVC 19.44, NVIDIA RTX 5070 Ti (driver 621.24): full runtime build, ctest 441/441, including assert_skip and run_tiny_game_skip_asserts.

Main's tools/int3_cause.py (line 8) already lists LEONIDA_SKIP_ASSERTS as a source of stop addresses; this PR implements that variable.

CI for this push is waiting for workflow approval (first-time contributor).

AI-assisted.

**@⁠Diegobecker07** on GitHub · 2026-11-25 13:13 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1395#issuecomment-7163468804) Rebased onto current main (0d80bc5df); the `needs rebase` label should clear on the next hourly run. slipperysquid's commit is kept with the same diff (+366/−4). The conflicts were additions at the same spot: - `docs/boot.md`: the `LEONIDA_SKIP_ASSERTS` bullet stays right after the `LEONIDA_SKIP_INT3` one, whose caveat it refers to; main's `LEONIDA_STUB_PIPELINES` and splash bullets follow it. - `runtime/CMakeLists.txt`: `run_tiny_game_skip_asserts` stays next to `run_tiny_game_stack`; main's TLS tests are kept. - `runtime/src/main.cpp`: include list. The handler is still installed before `loader.initialise()`, the first image code that runs. Re-verified on Windows 11 Pro (26300), MSVC 19.44, NVIDIA RTX 5070 Ti (driver 621.24): full runtime build, ctest 441/441, including `assert_skip` and `run_tiny_game_skip_asserts`. Main's `tools/int3_cause.py` (line 8) already lists `LEONIDA_SKIP_ASSERTS` as a source of stop addresses; this PR implements that variable. CI for this push is waiting for workflow approval (first-time contributor). AI-assisted.
This pull request has changes conflicting with the target branch.
  • runtime/README.md
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1395/head:github-bot/gh-1395'
git switch 'github-bot/gh-1395'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1395'
git switch 'github-bot/gh-1395'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1395'
git switch 'github-bot/gh-1395'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1395'
git switch 'main'
git merge --squash 'github-bot/gh-1395'
git switch 'main'
git merge --ff-only 'github-bot/gh-1395'
git switch 'main'
git merge 'github-bot/gh-1395'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.