mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:30:53 +01:00
[PR #1363] [CLOSED] runtime: trace successful file opens (RT-TRACE-SUCCESSFUL-OPENS) #1393
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#1393
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/1363
Author: @Moriz82
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:split/rt-trace-successful-opens📝 Commits (1)
75731cfruntime: trace successful file opens (RT-TRACE-SUCCESSFUL-OPENS)📊 Changes
5 files changed (+91 additions, -21 deletions)
View changed files
📝
docs/boot.md(+3 -1)📝
runtime/CMakeLists.txt(+1 -0)📝
runtime/README.md(+1 -0)📝
runtime/shims/file_system.cpp(+23 -17)📝
runtime/test/file_system_test.cpp(+63 -3)📄 Description
Claimed in the coordination issue as: RT-TRACE-SUCCESSFUL-OPENS (claim).
Part of the split of #984 into small pull requests.
Depends on: none
Overlaps: #984 (integration source; there the success events were written without restoring the last error, here it is restored and tested). #41 (caller of a call through a null pointer), #638 (
LEONIDA_SKIP_INT3on title threads) and #994 (unhandled-exception log) add other startup-trace events. None records a successful open.What and why
gta6rt --trace FILEwrites afile_open_failedevent for a guest file open that fails. A run that stops making progress without a failed open leaves nothing in the trace about the files it had reached.With the trace on, a guest
CreateFileWorCreateFile2that succeeds now writes afile_openevent with the path the title passed, the requested access mask and the caller.CreateFileAgoes throughCreateFileWand is recorded as that.OPEN_ALWAYSandCREATE_ALWAYSreportERROR_ALREADY_EXISTSthrough the last error of a successful open. Writing the event changes the last error, so it is read before the event and put back after it.No new switch or environment variable: the events are written only when
--traceis on.docs/boot.mdand the event table inruntime/README.mdname the new event and both budgets.Tested
Cross-built on CachyOS Linux 7.3.5 with clang-cl 23.1.5 and the xwin SDK. Ran the Windows tests one at a time under Wine 11.22 (distribution package, a prefix of its own) on a Ryzen 5 5600X with 16 GB RAM.
file_system_test --trace-opensis the new form (CTest namefile_system_open_trace); it has a process of its own because the budgets are per process. Over temporary folders it opens a file before the trace is opened, then with the trace on opens one existing file throughCreateFile2withOPEN_ALWAYS, the same file 601 times throughCreateFileW, and one missing file, and reads the trace back.file_system_test --trace-opensCreateFile2success event, noCreateFileWsuccess events, not 600 events with path, access and caller.CreateFile2event, 599CreateFileWevents, 600 in all withGAME:\existing.txt, the access mask and a caller; all 601 further opens still succeed; 1file_open_failedevent; the file opened before the trace is not in it;OPEN_ALWAYSleavesERROR_ALREADY_EXISTS.file_system_test(trace off)6293c1c4f."Base implementation" is this branch with
runtime/shims/file_system.cppas it is on6293c1c4f.The 8 checks that fail in the plain form with and without the change are Wine differences: a host
ReadFileinto uncommitted pages, sixMAXIMUM_ALLOWEDopens and their overlay writes, and one long-listing wildcard (*.?.). None of them is in code this change touches.Mutation: with the
SetLastErrorafter the event removed,--trace-opensfailed 1 of 9 checks, "OPEN_ALWAYS preserves its success last-error". The restore is needed under Wine and the test sees it.The other test programs that compile
file_system.cppdo not open the startup trace, so the new function returns at its first line there:xgameruntime_test(158 checks),xgameruntime_user_test(42 checks, plain and bothLEONIDA_GAMERTAGforms),xgameruntime_gamesave_test(56),xgameruntime_store_test(27),xgameruntime_offline_test(69, plain andLEONIDA_HDR=1)dstorage_testE_PENDINGinstead of the expected error). Its sources are the base's exceptfile_system.cpp.python3 -I scripts/check_no_game_data.py,tests/test_docs_env_vars.py(4 tests),tests/test_ctest_registration.py(4 tests),git diff --checkcompileall, 520 files oftests/, the content guard)tests/test_imhex_patterns.py, as on the base. None added.Not run: native Windows (the 8 plain-form failures and the
dstorage_teststop are unverified there), Proton, CTest itself (the executables were started directly), theCREATE_ALWAYScase of the last error (onlyOPEN_ALWAYSis tested),CreateFileA, the translator's semantic suite (no Python or translator file changed) and a boot of the title.GPUs tested: none. The fixture uses files and the startup trace only.
AI-assisted: yes (Claude Code).
Checklist
6293c1c4f.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.