mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:40:52 +01:00
[PR #228] runtime: LEONIDA_SKIP_ASSERTS and caller logging for forwarded device slots (RT-526) #281
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#281
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/228
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/9961📝 Commits (1)
a75e325runtime: LEONIDA_SKIP_ASSERTS and caller logging for forwarded device slots (RT-526)📊 Changes
12 files changed (+541 additions, -9 deletions)
View changed files
📝
docs/boot.md(+6 -0)📝
docs/d3d12_command_objects.md(+4 -1)📝
runtime/CMakeLists.txt(+19 -0)📝
runtime/README.md(+21 -2)📝
runtime/shims/d3d12_xs_device.cpp(+37 -3)📝
runtime/shims/d3d12_xs_device.h(+13 -0)➕
runtime/src/assert_skip.h(+151 -0)📝
runtime/src/main.cpp(+14 -0)➕
runtime/test/assert_skip_test.cpp(+135 -0)📝
runtime/test/fixtures/tiny_game.cpp(+22 -1)📝
runtime/test/xs_proxy_mock_test.cpp(+117 -1)📝
tools/boot_trace.py(+2 -1)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Claimed in the coordination issue as: RT-526 (two RT-5 boot diagnostics)
Depends on: none
What and why
Two retail-boot diagnostics, as RT-526 specifies. Neither changes anything unless asked for.
LEONIDA_SKIP_ASSERTS=N(runtime/src/assert_skip.h, installed bymain.cppunder--init/--runbefore the first TLS callback). Without a debugger, a guest assert'sint3is an unhandledEXCEPTION_BREAKPOINTand the run ends there. This adds a vectored handler, registered last so every other handler sees the breakpoint first. It steps over up to Nint3(byte0xCC) at addresses in no host module, which means the Loader's mapped images and code a title wrote itself. Each one gets a log line:[rt] LEONIDA_SKIP_ASSERTS: int3 at game.exe+0x1234 stepped over (1 of 3)After N it says so once, and the next
int3ends the run as before. It passes on:int3in a host module (gta6rt, its shims, system DLLs);0xCCat its reported address;0xCCnor one byte past it.On x64 Windows, and measured here under Wine 10.0 (the test checks it), RIP is the
0xCC's own address, and the handler moves it one byte on. No--traceis needed. With a trace open, each skip is also anint3_skippedevent with askipcount, and the trace's own handler records the breakpoint and its stack first.0or unset installs nothing.0.LEONIDA_SKIP_INT3(trace-only, no limit, one log per address) stays as it is. The docs say how the two differ.Caller of each forwarded device slot. The first call of every device slot taken by the proxy's generic thunk now names its caller:
device slot 25 (GetResourceAllocationInfo) first call from game.exe+0x1234. Those are the PC slots passed through by number, the routed Xbox slots 48/73/78/79/80, and the refused tail. The caller is_ReturnAddress()in the thunk, described through a newset_caller_describer, which gta6rt points atrt::shims::module_offset. With no describer, the bare address is logged. Slots with handlers of their own keep their current line. Until now, finding a slot's call site took a debugger.Docs:
runtime/README.md(new "Guest asserts" section, the trace table row),docs/boot.md(useful switches) anddocs/d3d12_command_objects.md§5.2.tools/boot_trace.py's label forint3_skippednow names both switches.Tested
All tests are synthetic. No game files, no game data.
Cross-build: Linux, clang-cl 21 / lld-link 21 against an xwin
/winsysrootsplat (MSVC 14.44, SDK 10.0.26100),runtime/cmake/clang-cl-xwin.cmake, Ninja, RelWithDebInfo. Tests ran under Wine 10.0 (Ubuntu 10.0~repack-12ubuntu1) through ctest's crosscompiling emulator.assert_skip(new) passed. It covers value parsing; int3 in aVirtualAlloc'd page no host module owns; a limit of 2, where the third is passed on; a host-module__debugbreakpassed on; a two-byteint 3(CD 03) passed on; and RIP at the0xCCunder Wine.int3_skip(existing) passed.run_tiny_game_skip_asserts(new) passed.gta6rt --run tiny_game -- hello 42 int3runs withLEONIDA_SKIP_ASSERTS=2: two int3 in the mapped stand-in game are stepped over (tiny_game.exe+0x…), and the game reaches its normal exit 0.xs_proxy_mockwith the newcheck_slot_callerspassed, stderr captured. Checks:Current upstream
main(e56d9795) does not build gta6rt,xs_proxy_mock_testordevice_proxy_test, without this change too:shims/d3d12_xs_device.cppcallsrt::d3d12::create_console_descriptor_heapwith no declaration in scope. Its definition is in the Vulkan layer, which these targets don't link.shims/acphal.cpp'sSHAPE_XMA_CONTEXT/SHAPE_PCM_CONTEXTsizestatic_asserts fail.So on that base,
main.cppand the new test objects were compiled andassert_skip/int3_skipwere run.xs_proxy_mockwas run with a local, uncommitted declaration and stub forcreate_console_descriptor_heap: the new check passes, and the existingcheck_console_command_listthen fails at its slot-14 heap creation on that stub (not this change; the new check runs before it). The whole change was also built on the previousmain(867d922f), where everything links. There, gta6rt,xs_proxy_mock(all 6 tests),assert_skip,int3_skip,run_tiny_game_skip_assertsand the 18 gta6rt/loader/tiny_game tests all passed.Linux portable subset:
cmake -S runtime -B runtime/build/linux && cmake --build runtime/build/linux --parallel && ctest --test-dir runtime/build/linux --output-on-failure. 70/70 passed (2 skipped as usual:shader_library_corpus,vk_sync_validation).python -I tests/test_boot_trace.pyandpython -I tests/test_docs_links.pypass.python -I tests/test_docs_env_vars.py:LEONIDA_SKIP_ASSERTSis documented. The test still fails on upstreammainforLEONIDA_RNG_SEED(runtime/shims/bcrypt_rng.cpp), which no document names. That predates this change.python -I scripts/check_no_game_data.pyon every changed file: clean.Not run: native Windows/MSVC, and
device_proxy_test(WARP, needsd3d12.dll). No GPU is involved.AI-assisted: yes (Claude Code)
Checklist
docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.