startup: run the debugger with the repository Python #1535

Manually merged
github merged 1 commit from gh-pr/1535/head into gh-pr/1535/base 2026-11-26 23:14:57 +00:00
Owner

@⁠lambirou on GitHub · 2026-11-24 13:44 UTC · original
lambirou:startup/run-venv-python → main · +6 −1 · 2 files · 1 commits · merged 2026-11-24 15:07 UTC

Problem

tools/startup/run.ps1 starts debug_launch.py with python from PATH. The documented setup creates out/pe-env from requirements-dev.txt, but the launcher did not use it.

That matters for -HostCpu. debug_launch.py imports host_cpu.py, which needs iced-x86 when a short rewritten instruction has to move the following bytes. With a system Python that lacks the package, the first illegal instruction is logged as host-cpu no replacement ... No module named 'iced_x86', no rewrite happens, and the process stops on the second chance instead of continuing.

Change

run.ps1 now uses out/pe-env/Scripts/python.exe when that interpreter exists, and keeps python from PATH as the fallback. No other launcher behaviour changes.

docs/startup-runtime.md states the interpreter selection and why -HostCpu needs the venv.

Validation

  • 25 s startup run on Windows 11 26H2 build 26300, Radeon RX 9060 XT (driver 32.0.32029.2010), release build. The run ended by timeout after 25.03 s with host-cpu sites rewritten: clzero x5, monitorx x1, mwaitx x1; it no longer stopped on the illegal instruction.
  • python -B tests/docs_links_check.py: 16 Markdown files and 339 links checked, self-test passed.
  • git diff --check: clean.

The run needs local package files, so it is a manual check rather than a CTest case. Without out/pe-env, the fallback is the previous python from PATH.

Follow-up to #1274.

**@⁠lambirou** on GitHub · 2026-11-24 13:44 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1535) `lambirou:startup/run-venv-python` → `main` · +6 −1 · 2 files · 1 commits · merged 2026-11-24 15:07 UTC ## Problem `tools/startup/run.ps1` starts `debug_launch.py` with `python` from `PATH`. The documented setup creates `out/pe-env` from `requirements-dev.txt`, but the launcher did not use it. That matters for `-HostCpu`. `debug_launch.py` imports `host_cpu.py`, which needs `iced-x86` when a short rewritten instruction has to move the following bytes. With a system Python that lacks the package, the first illegal instruction is logged as `host-cpu no replacement ... No module named 'iced_x86'`, no rewrite happens, and the process stops on the second chance instead of continuing. ## Change `run.ps1` now uses `out/pe-env/Scripts/python.exe` when that interpreter exists, and keeps `python` from `PATH` as the fallback. No other launcher behaviour changes. `docs/startup-runtime.md` states the interpreter selection and why `-HostCpu` needs the venv. ## Validation - 25 s startup run on Windows 11 26H2 build 26300, Radeon RX 9060 XT (driver `32.0.32029.2010`), release build. The run ended by timeout after 25.03 s with `host-cpu sites rewritten: clzero x5, monitorx x1, mwaitx x1`; it no longer stopped on the illegal instruction. - `python -B tests/docs_links_check.py`: 16 Markdown files and 339 links checked, self-test passed. - `git diff --check`: clean. The run needs local package files, so it is a manual check rather than a CTest case. Without `out/pe-env`, the fallback is the previous `python` from `PATH`. Follow-up to #1274.
run.ps1 invoked python from PATH. The -HostCpu path imports host_cpu, which needs iced-x86 from requirements-dev.txt; a system Python without that package could not rewrite the first illegal instruction and the run stopped on its second chance. Prefer out/pe-env/Scripts/python.exe when it exists and keep python from PATH as the fallback.

Checked with a 25 s startup run on Windows 11 and a Radeon RX 9060 XT: host-cpu sites rewritten: clzero x5, monitorx x1, mwaitx x1. python -B tests/docs_links_check.py passes (16 files, 339 links), as does git diff --check.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:14:56 +00:00
github manually merged commit 48a04876dd into gh-pr/1535/base 2026-11-26 23:14:57 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.