startup: say why --trace-calls 1 armed nothing, and pin the hooked export #2154

Merged
rasptum merged 1 commit from upstream-pr/2162 into main 2026-11-25 02:10:15 +00:00
rasptum commented 2026-11-25 01:59:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-25T01:59:36Z.


Follow-up to #2021, from the review in https://github.com/R0Y00/Xbox2Windows/pull/2021#issuecomment-7147449636.

The banner. debug_launch.py arms the gaming-runtime and movie-player call hooks together with the file hooks: trace_calls = trace and --trace-calls == "1". With file tracing off (--offline 0 without --trace-files 1), --trace-calls 1 therefore arms nothing. The summary printed trace_calls, so it already said call tracing: off in that case and was not wrong. But it gave no reason, so the flag looked silently ignored. The summary now prints call tracing: off: --trace-calls 1 needs file tracing (--trace-files 1, or offline mode, the default). The on and plain off lines are unchanged.

The hook list. The export names the launcher hooks move from two inline tuples into RUNTIME_CALL_HOOKS and MOVIE_CALL_HOOKS (with RUNTIME_MODULE and MOVIE_MODULE). Behavior is unchanged.

Tests (tests/startup_debug_check.py):

  • Guard: the fixture's module (bink2scarlett.dll) must be MOVIE_MODULE and its export (BinkNextFrame) must be in MOVIE_CALL_HOOKS. A renamed or unhooked export now fails the check, instead of passing because nothing was hit. A control drops the export from a copy of the list and checks that the guard rejects it.
  • New case calls-no-file-tracing: with --offline 0 --trace-calls 1, the probe's 7 export calls are not counted, and the summary carries the new reason.
  • Negative control (local, not committed): disabling the new reason line in debug_launch.py makes the check fail on calls-no-file-tracing.

docs/startup-runtime.md describes the conjunction and the new line.

Test (Windows 10 19045, dev and release, build targets startup_debug_probe startup_debug_calls startup_launch_probe):

ctest --preset dev --no-tests=error -R '^(startup_debug|startup_run_ps1|startup_launch)$' -V
  • dev: 3 passed, 0 failed, 0 skipped. startup_debug reports 9 controls.
  • release: 2 passed, 1 failed, 0 skipped.
    • The failure is the existing X2W_VALLOC_MIN case, which sometimes logs the 256 MiB reservation with an empty caller list (callers: ). main fails it the same way, and this PR does not touch it.
    • With that one assertion disabled, the whole check passes in release, including the three call-hook cases.
  • tests/docs_links_check.py passes.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6595400201 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2162). Originally posted by [rasptum](https://github.com/rasptum) on 2026-11-25T01:59:36Z. --- Follow-up to #2021, from the review in https://github.com/R0Y00/Xbox2Windows/pull/2021#issuecomment-7147449636. **The banner.** `debug_launch.py` arms the gaming-runtime and movie-player call hooks together with the file hooks: `trace_calls = trace and --trace-calls == "1"`. With file tracing off (`--offline 0` without `--trace-files 1`), `--trace-calls 1` therefore arms nothing. The summary printed `trace_calls`, so it already said `call tracing: off` in that case and was not wrong. But it gave no reason, so the flag looked silently ignored. The summary now prints `call tracing: off: --trace-calls 1 needs file tracing (--trace-files 1, or offline mode, the default)`. The `on` and plain `off` lines are unchanged. **The hook list.** The export names the launcher hooks move from two inline tuples into `RUNTIME_CALL_HOOKS` and `MOVIE_CALL_HOOKS` (with `RUNTIME_MODULE` and `MOVIE_MODULE`). Behavior is unchanged. **Tests** (`tests/startup_debug_check.py`): - **Guard:** the fixture's module (`bink2scarlett.dll`) must be `MOVIE_MODULE` and its export (`BinkNextFrame`) must be in `MOVIE_CALL_HOOKS`. A renamed or unhooked export now fails the check, instead of passing because nothing was hit. A control drops the export from a copy of the list and checks that the guard rejects it. - **New case `calls-no-file-tracing`:** with `--offline 0 --trace-calls 1`, the probe's 7 export calls are not counted, and the summary carries the new reason. - **Negative control** (local, not committed): disabling the new reason line in `debug_launch.py` makes the check fail on `calls-no-file-tracing`. `docs/startup-runtime.md` describes the conjunction and the new line. Test (Windows 10 19045, dev and release, build targets `startup_debug_probe startup_debug_calls startup_launch_probe`): ```powershell ctest --preset dev --no-tests=error -R '^(startup_debug|startup_run_ps1|startup_launch)$' -V ``` - dev: 3 passed, 0 failed, 0 skipped. `startup_debug` reports 9 controls. - release: 2 passed, 1 failed, 0 skipped. - The failure is the existing `X2W_VALLOC_MIN` case, which sometimes logs the 256 MiB reservation with an empty caller list (`callers: `). `main` fails it the same way, and this PR does not touch it. - With that one assertion disabled, the whole check passes in release, including the three call-hook cases. - `tests/docs_links_check.py` passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-25 03:01:13 +00:00
tedin7 commented 2026-11-25 03:01:13 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:08:37Z.

Review: COMMENTED


Review of head 0b9752a7283ce50d5173e157816bb757eefdced0 (3 files, +52/-15).

Summary: Small, behavior-preserving change. The hook names move into RUNTIME_CALL_HOOKS / MOVIE_CALL_HOOKS, the summary gets a reason line, and the check gets a guard and a new case. I found no P1 and no P2.

Checked by reading the diff

  • tools/startup/debug_launch.py: the banner has three branches (on, requested-but-unarmed, plain off). calls_requested is only true for --trace-calls 1, and trace_calls = trace and calls_requested. So the new reason line prints exactly when the flag was given and file tracing is off. The on and plain off texts are unchanged.
  • The hook loops now iterate the new constants. The names are identical to the old inline tuples, so there is no behavior change.
  • tests/startup_debug_check.py: the new banners map matches the three printed strings, and calls-default still matches call tracing: off (. The calls-no-file-tracing case expects no bink calls: line (want=None), which fits --offline 0 with no file hooks. The guard require_hooked plus its control fails if the module or export is renamed or dropped.
  • Docs text matches the code. The PASS line count (9 controls) is consistent with the added cases.
  • Clean-room and neutral title: fine. The PR is mergeable.

Commands executed locally (Linux)

  • gh pr checks 2162: Linux Python checks pass, gfx1013 fixtures pass, Windows build and test pass. The /O2 job and the chart job were skipped.
  • python3 -c "import ast; ast.parse(open('tools/startup/debug_launch.py').read())": syntax ok.
  • python3 tests/docs_links_check.py: Self-test passed. Checked 18 Markdown files and 398 links.
  • python3 tests/bidi_controls_check.py: Self-test passed. Checked 1440 files, no bidirectional controls.
  • git diff --check origin/main...HEAD: clean.

Not run: startup_debug_check.py needs Windows (ctypes.WinDLL; the launcher cannot even be imported on Linux). I did not run the Win2025 job. The PR changes only the Python launcher, and the Windows CI job passed. I tried a mutation (dropping BinkNextFrame from the list). The edit did not apply to the hook tuple, so I treat it as not exercised and make no claim about it. By reading, the guard raises in that case.

Nits (not blocking)

  • debug_launch.py banner: the reason line says "or offline mode, the default". That is right today, but it repeats the default in a string. If the default changes, the text goes stale. Consider deriving it or dropping the parenthetical.
  • tests/startup_debug_check.py require_hooked: the control re-implements the drop inline. It is fine, just a little long.

Verdict: no blocking findings. The merge decision is left to the maintainers.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6050589868 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2162#pullrequestreview-6050589868). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T02:08:37Z. **Review:** COMMENTED --- Review of head `0b9752a7283ce50d5173e157816bb757eefdced0` (3 files, +52/-15). **Summary:** Small, behavior-preserving change. The hook names move into `RUNTIME_CALL_HOOKS` / `MOVIE_CALL_HOOKS`, the summary gets a reason line, and the check gets a guard and a new case. I found no P1 and no P2. **Checked by reading the diff** - `tools/startup/debug_launch.py`: the banner has three branches (`on`, requested-but-unarmed, plain `off`). `calls_requested` is only true for `--trace-calls 1`, and `trace_calls = trace and calls_requested`. So the new reason line prints exactly when the flag was given and file tracing is off. The `on` and plain `off` texts are unchanged. - The hook loops now iterate the new constants. The names are identical to the old inline tuples, so there is no behavior change. - `tests/startup_debug_check.py`: the new `banners` map matches the three printed strings, and `calls-default` still matches `call tracing: off (`. The `calls-no-file-tracing` case expects no `bink calls:` line (`want=None`), which fits `--offline 0` with no file hooks. The guard `require_hooked` plus its control fails if the module or export is renamed or dropped. - Docs text matches the code. The PASS line count (9 controls) is consistent with the added cases. - Clean-room and neutral title: fine. The PR is mergeable. **Commands executed locally (Linux)** - `gh pr checks 2162`: Linux Python checks pass, gfx1013 fixtures pass, Windows build and test pass. The /O2 job and the chart job were skipped. - `python3 -c "import ast; ast.parse(open('tools/startup/debug_launch.py').read())"`: syntax ok. - `python3 tests/docs_links_check.py`: Self-test passed. Checked 18 Markdown files and 398 links. - `python3 tests/bidi_controls_check.py`: Self-test passed. Checked 1440 files, no bidirectional controls. - `git diff --check origin/main...HEAD`: clean. **Not run:** `startup_debug_check.py` needs Windows (`ctypes.WinDLL`; the launcher cannot even be imported on Linux). I did not run the Win2025 job. The PR changes only the Python launcher, and the Windows CI job passed. I tried a mutation (dropping `BinkNextFrame` from the list). The edit did not apply to the hook tuple, so I treat it as not exercised and make no claim about it. By reading, the guard raises in that case. **Nits (not blocking)** - `debug_launch.py` banner: the reason line says "or offline mode, the default". That is right today, but it repeats the default in a string. If the default changes, the text goes stale. Consider deriving it or dropping the parenthetical. - `tests/startup_debug_check.py` `require_hooked`: the control re-implements the drop inline. It is fine, just a little long. Verdict: no blocking findings. The merge decision is left to the maintainers. AI-assisted; commands listed were executed locally.
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
R0Y00/Xbox2Windows!2154
No description provided.