startup: arm the debugger's runtime and movie-player call hooks only with --trace-calls 1 #2014
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2021"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-24T23:14:14Z.
This builds on #1987 (merged), which stops the stand-ins' first-calls log counters at their limit. With the call hooks off, a consumer that polls a status in a loop runs fast enough to wrap the stand-ins' first-calls log counters, and from then on every call logs. That PR makes the counters stop at their limit.
tools/startup/debug_launch.pyarmed its gaming-runtime and movie-player call hooks whenever file tracing was on. File tracing is on by default, because offline mode needs the file hooks. Under the debugger, every hooked call stops the whole process.--trace-calls 1(tools/startup/run.ps1 -TraceCalls). With the flag, behavior is as before.call tracing: onoroff.bink callsand the frame data after it) needs the movie-player hooks, so it appears only with--trace-calls 1.docs/startup-runtime.mdsays so.Tests:
startup_debugcopies its probe and a new source-built DLL (tests/startup_debug_calls.cpp) into one folder, with the DLL renamed to the movie-player module name. The probe calls the DLL's export 7 times. The check expects no call count by default and exactlyx7with--trace-calls 1, plus the matchingcall tracing:line. Every case passes--console 0.startup_run_ps1checks that-TraceCallspasses--trace-calls 1.Test (build targets
startup_debug_probe startup_debug_calls startup_launch_probe):Results on the branch rebased onto
main(after the first-calls limiter fix merged):startup_debugfailed on the existingX2W_VALLOC_MINcase, which sometimes logs the 256 MiB reservation with an empty caller list (callers:). Unmodifiedmainfails it the same way. With that one assertion disabled, the whole check passes in dev and release, including the call-hook cases.startup_launchfailed once on its fast-fail assertion, while running in parallel with the other two tests. Run alone in release, it passed 3 of 3 on this branch and 3 of 3 on unmodifiedmain. This PR does not change the code that test covers.tests/docs_links_check.pyandtests/bidi_controls_check.pypass.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T23:28:57Z.
The PowerShell wiring is pinned by three mutations; the debugger half I could only read
Reviewed on the merge base rather than
main— your branch is 23 commits behind, sogit diff origin/mainshows 825 lines for a 122-line change,most of them other people's merged work.
git diff $(git merge-base origin/main HEAD)shows the real shape:What I could run
tools/startup/run.ps1$traceArgsstays emptydebug_launchcall[switch]$TraceCallsrenamed so the script no longer takes itSo the plumbing is pinned end to end on the script side, including the negative case — the check asserts that without the switch the argument list is
unchanged, which is the half people forget.
What I could not run, and why
That is a usage error, not a failure: the check takes the built
startup_debug_probe.exeand the built call-hook DLL, which CMake passes in. There isno
cl.exebuild tree on this machine, so the runtime half of this PR — the actual--trace-calls 1break-on-xgameruntime.dll/bink2scarlett.dllbehaviour, and
bink_report()— is not verified by me. Please read the rest of this review as static analysis only, and tell me if you want theinability recorded differently in the PR body.
Static reading of the debugger half
Three things I would want to see stated explicitly, because each is a decision rather than a transcription:
trace_calls = trace and opts.get("--trace-calls") == "1"— the hook is gated ontraceas well as on the flag. That means--trace-calls 1without
--trace 1silently does nothing except change the banner. The banner sayscall tracing: on, which would then be wrong. Either the gateshould be
opts.get(...) == "1"alone, or the banner should print the same conjunction it uses.Every hit stops the whole processin the comment is the reason for default-off, and it is the right reason. Worth also saying how muchslower: two extra breakpoints on every call into two modules turns a run into minutes, and the docs line says "slows the process" without a number.
I cannot measure it here, but you presumably have.
tests/startup_debug_calls.cppexportsBinkNextFrameand counts calls. Since the probe renames the DLL to the movie-player module name,the export must match a symbol
debug_launch.pyactually hooks — otherwise the check passes because nothing is hit. A guard that the export nameappears in the hook list would make that impossible to get wrong later.
None of those are blockers; they are the three places where a future reader has to guess.
Notes