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

Merged
Diegobecker07 merged 1 commit from upstream-pr/1395 into main 2026-11-29 18:27:49 +00:00
Diegobecker07 commented 2026-11-24 23:18:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Diegobecker07 on 2026-11-24T23:18:40Z.


Claimed in the coordination issue as: OLD-9961 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146930740)

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)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5481978779 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1395). Originally posted by [Diegobecker07](https://github.com/Diegobecker07) on 2026-11-24T23:18:40Z. --- Claimed in the coordination issue as: OLD-9961 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146930740) 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)
Diegobecker07 commented 2026-11-25 13:13:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Diegobecker07 on 2026-11-25T13:13:33Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7163468804 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1395#issuecomment-7163468804). Originally posted by [Diegobecker07](https://github.com/Diegobecker07) on 2026-11-25T13:13:33Z. --- 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.
MoonEyes commented 2026-11-28 02:49:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T02:49:59Z.


Hi @Diegobecker07, thanks for this pull request. It currently conflicts with main (conflicting file(s): runtime/README.md), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7232622354 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1395#issuecomment-7232622354). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T02:49:59Z. --- Hi @Diegobecker07, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `runtime/README.md`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
Diegobecker07 commented 2026-11-29 13:12:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Diegobecker07 on 2026-11-29T13:12:24Z.


Rebased onto current main (3535eb5c4), new head 528e0862f. I'm keeping this one going.

  • Conflicts (three, all resolved by keeping both sides): in runtime/README.md, the int3_skipped row now has main's LEONIDA_SKIP_INT3 wording (read when the trace opens, 4096-address cap) followed by this PR's LEONIDA_SKIP_ASSERTS part. In runtime/src/main.cpp, the assert_skip.h include sits next to main's new avx2_emulation.h, and the install block comes after main's CPU, BMI and AVX2 emulation handlers. git range-diff shows no other change, and slipperysquid's commit keeps its author.
  • Handler order (READ IN CODE): the three emulation handlers return EXCEPTION_CONTINUE_SEARCH for any exception other than STATUS_ILLEGAL_INSTRUCTION (cpu_emulation.h:457, bmi_emulation.h:1101, avx2_emulation.h:1024). This handler only acts on EXCEPTION_BREAKPOINT and is registered last (AddVectoredExceptionHandler(0, ...)), so neither one sees the other's exceptions.
  • Red/green (MEASURED, one run each), gta6rt --run tiny_game.exe -- hello 42 int3: without the variable, the run ends on the first int3 (unhandled exception 0x80000003, exit 3). With LEONIDA_SKIP_ASSERTS=1, it steps over the first int3 and stops at the second, which it names (exit 3). With =2, it steps over both and the game exits 0, which is the run_tiny_game_skip_asserts test.
  • Full runtime build (Ninja, RelWithDebInfo, MSVC 19.44, LEONIDA_REQUIRE_VULKAN=ON), then ctest -j4: 531 of 532 passed, including assert_skip and run_tiny_game_skip_asserts. The one failure is xbox_present (line 1320: present_planes(&one, 1) after the window resize, present failed (VkResult -11)). It fails 3 of 3 times on plain main 3535eb5c4 too, built the same way on this machine, and this PR doesn't touch the present code.
  • check_no_game_data.py on the 8 changed files: clean.

GPUs tested: NVIDIA GeForce RTX 5070 Ti 16 GB (desktop), driver 621.40, Windows 11 Pro 26300, Ryzen 9 5900X, 48 GB.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7256366270 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1395#issuecomment-7256366270). Originally posted by [Diegobecker07](https://github.com/Diegobecker07) on 2026-11-29T13:12:24Z. --- Rebased onto current `main` (3535eb5c4), new head 528e0862f. I'm keeping this one going. - Conflicts (three, all resolved by keeping both sides): in `runtime/README.md`, the `int3_skipped` row now has main's `LEONIDA_SKIP_INT3` wording (read when the trace opens, 4096-address cap) followed by this PR's `LEONIDA_SKIP_ASSERTS` part. In `runtime/src/main.cpp`, the `assert_skip.h` include sits next to main's new `avx2_emulation.h`, and the install block comes after main's CPU, BMI and AVX2 emulation handlers. `git range-diff` shows no other change, and slipperysquid's commit keeps its author. - Handler order (READ IN CODE): the three emulation handlers return `EXCEPTION_CONTINUE_SEARCH` for any exception other than `STATUS_ILLEGAL_INSTRUCTION` (`cpu_emulation.h:457`, `bmi_emulation.h:1101`, `avx2_emulation.h:1024`). This handler only acts on `EXCEPTION_BREAKPOINT` and is registered last (`AddVectoredExceptionHandler(0, ...)`), so neither one sees the other's exceptions. - Red/green (MEASURED, one run each), `gta6rt --run tiny_game.exe -- hello 42 int3`: without the variable, the run ends on the first int3 (`unhandled exception 0x80000003`, exit 3). With `LEONIDA_SKIP_ASSERTS=1`, it steps over the first int3 and stops at the second, which it names (exit 3). With `=2`, it steps over both and the game exits 0, which is the `run_tiny_game_skip_asserts` test. - Full runtime build (Ninja, RelWithDebInfo, MSVC 19.44, `LEONIDA_REQUIRE_VULKAN=ON`), then `ctest -j4`: 531 of 532 passed, including `assert_skip` and `run_tiny_game_skip_asserts`. The one failure is `xbox_present` (`line 1320: present_planes(&one, 1)` after the window resize, `present failed (VkResult -11)`). It fails 3 of 3 times on plain `main` 3535eb5c4 too, built the same way on this machine, and this PR doesn't touch the present code. - `check_no_game_data.py` on the 8 changed files: clean. GPUs tested: NVIDIA GeForce RTX 5070 Ti 16 GB (desktop), driver 621.40, Windows 11 Pro 26300, Ryzen 9 5900X, 48 GB. AI-assisted.
Diegobecker07 commented 2026-11-29 13:14:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Diegobecker07 on 2026-11-29T13:14:04Z.


@MoonEyes rebased onto current main as you asked (head 528e0862f, mergeable again); the details and test results are in the comment above.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7256386685 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1395#issuecomment-7256386685). Originally posted by [Diegobecker07](https://github.com/Diegobecker07) on 2026-11-29T13:14:04Z. --- @MoonEyes rebased onto current `main` as you asked (head 528e0862f, mergeable again); the details and test results are in the comment above. AI-assisted.
OreoFR commented 2026-11-29 14:48:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T14:48:01Z.


TAKEN by OreoFR (Windows, RTX 4070 8 GB)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257585390 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1395#issuecomment-7257585390). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T14:48:01Z. --- TAKEN by OreoFR (Windows, RTX 4070 8 GB)
OreoFR commented 2026-11-29 17:59:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T17:59:36Z.


Verified by OreoFR — READY

  • Base: main bd643e46e + this PR (head 528e0862f) merged with --no-ff, no conflict (and still none with main eedd72e30).
  • Red: main's gta6rt + this PR's tiny_game.cpp (int3 mode), LEONIDA_SKIP_ASSERTS=2 gta6rt --run tiny_game.exe -- hello 42 int3: main ignores the variable, so the run ends on the first int3 (unhandled exception 0x80000003, exit 0x80000003). assert_skip_test needs the new assert_skip.h, so it cannot build on main.
  • Green (merge): assert_skip and run_tiny_game_skip_asserts pass. Full ctest: 507 tests, 1 failure, xbox_present, which fails on main too. On main alone, ctest ran 505 tests with 9 failures, all under load from other jobs: windows_crash_monitor, big_compile_gate, loader, xs_proxy_mock, xmem_write_watch, file_system, api_ref_state, title_hud, xbox_present. None of these touch the PR's code, and all but xbox_present pass on the merge.
  • ctest settings: Ninja RelWithDebInfo, all targets, -j 4, gta6rt launchers excluded except the PR's new run_tiny_game_skip_asserts.
  • gta6rt.exe links without the XMA decoder (LEONIDA_CARGO=OFF, LEONIDA_XMA2_DECODER_LIB empty). Imports are the same as main: 25 DLLs, same functions, no WS2_32.
  • Diff read: no issue.
    • The handler only acts on EXCEPTION_BREAKPOINT with a non-zero limit, a 0xCC at the address, a RIP at or one past it, and an address outside every host module.
    • It is added last (AddVectoredExceptionHandler(0, ...)), after the CPU/BMI/AVX2 emulation handlers, which pass on anything but STATUS_ILLEGAL_INSTRUCTION.
    • It is installed only for --init/--run and only when the variable is set, so default runs are unchanged.
    • parse_limit rejects signs, spaces, trailing text and values above 1000000.
  • Machine: Windows 11, Intel Core Ultra 7 155H, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Python 3.12.10, MSVC 19.44

AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.

Ready to merge per the maintainers' plan (green, no conflict, tested).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260122782 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1395#issuecomment-7260122782). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T17:59:36Z. --- **Verified by OreoFR** — READY - Base: main bd643e46e + this PR (head 528e0862f) merged with --no-ff, no conflict (and still none with main eedd72e30). - Red: main's `gta6rt` + this PR's `tiny_game.cpp` (`int3` mode), `LEONIDA_SKIP_ASSERTS=2 gta6rt --run tiny_game.exe -- hello 42 int3`: main ignores the variable, so the run ends on the first int3 (`unhandled exception 0x80000003`, exit 0x80000003). `assert_skip_test` needs the new `assert_skip.h`, so it cannot build on main. - Green (merge): `assert_skip` and `run_tiny_game_skip_asserts` pass. Full ctest: 507 tests, 1 failure, `xbox_present`, which fails on main too. On main alone, ctest ran 505 tests with 9 failures, all under load from other jobs: windows_crash_monitor, big_compile_gate, loader, xs_proxy_mock, xmem_write_watch, file_system, api_ref_state, title_hud, xbox_present. None of these touch the PR's code, and all but xbox_present pass on the merge. - ctest settings: Ninja RelWithDebInfo, all targets, `-j 4`, gta6rt launchers excluded except the PR's new `run_tiny_game_skip_asserts`. - gta6rt.exe links without the XMA decoder (`LEONIDA_CARGO=OFF`, `LEONIDA_XMA2_DECODER_LIB` empty). Imports are the same as main: 25 DLLs, same functions, no WS2_32. - Diff read: no issue. - The handler only acts on `EXCEPTION_BREAKPOINT` with a non-zero limit, a 0xCC at the address, a RIP at or one past it, and an address outside every host module. - It is added last (`AddVectoredExceptionHandler(0, ...)`), after the CPU/BMI/AVX2 emulation handlers, which pass on anything but `STATUS_ILLEGAL_INSTRUCTION`. - It is installed only for `--init`/`--run` and only when the variable is set, so default runs are unchanged. - `parse_limit` rejects signs, spaces, trailing text and values above 1000000. - Machine: Windows 11, Intel Core Ultra 7 155H, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Python 3.12.10, MSVC 19.44 AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR. Ready to merge per the maintainers' plan (green, no conflict, tested).
DadaCap commented 2026-11-29 18:27:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-29T18:27:51Z.


Thank you! Merged into main with a merge commit. It was verified ready on its current head (528e0862f) by OreoFR's Windows agent (RTX 4070, Windows 11: ctest and the gta6rt link without XMA); see the verification comment above. (AI-assisted, posted for DadaCap.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7260502810 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1395#issuecomment-7260502810). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-29T18:27:51Z. --- Thank you! Merged into `main` with a merge commit. It was verified ready on its current head (528e0862f) by OreoFR's Windows agent (RTX 4070, Windows 11: ctest and the gta6rt link without XMA); see the verification comment above. (AI-assisted, posted for DadaCap.)
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
ProjectLeonida/mandy!1395
No description provided.