Crash reports: name the host's CPU and Windows build #213

Merged
Dufftwt merged 1 commit from upstream-pr/213 into main 2026-11-25 00:16:15 +00:00
Dufftwt commented 2026-11-24 01:28:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dufftwt on 2026-11-24T01:28:56Z.


What's wrong

Two facts about the host decide whether many crashes are bugs at all, and a crash report contains neither:

  • The CPU. The console's CPU is a Zen 2, and title code uses AMD-only instructions that Intel CPUs lack (clwb before Ice Lake, clzero, monitorx, SSE4a…). The loader emulates the ones it knows. Whether an 0xc000001d is a known case, an unknown instruction or something else depends entirely on the CPU.
  • The Windows build. It decides which D3D12 runtime and shader model are available (Windows 10's in-box runtime stops at SM 6.5, #84).

Neither is in the console output or in crashes.log. So every report needs a follow-up question, or reporters type their specs by hand, and some guess wrong (#103 guessed at the instruction without knowing it depended on the CPU generation).

What the fix does

In crash.rs:

  • When the crash log is set up (log_crashes_to, at title start), the loader reads two values once:
    • the CPU's brand string, from cpuid leaves 0x80000002–0x80000004;
    • the real Windows version, from RtlGetVersion. GetVersionEx would return whatever the executable's manifest declares instead.
  • Unhandled exceptions, panics and host GPU failures (log_crash) now end with one more line, host: <CPU>, Windows <major.minor.build>. It comes just before the title's last debug output, which those reports already end with.

At crash time nothing is queried: the line was formatted at startup. First-chance reports don't change.

victory-loader gets two more windows-sys features for RtlGetVersion and its structure: Wdk_System_SystemServices and Win32_System_SystemInformation. It already uses Wdk_System_Threading.

How it behaves after the fix

VIctory: unhandled exception 0xc000001d at victory-image-….dll+0x4ecc84a
  rax … rbx …
  …
  #0  victory-image-….dll+0x4ecc84a
  …
  host: Intel(R) Core(TM) i3-10100F CPU @ 3.60GHz, Windows 10.0.19045

The same line goes to crashes.log, so a pasted report or log file says by itself what machine it came from.

Tests

The new test the_host_line_names_the_cpu_and_windows checks that the line has the form host: <non-empty CPU name>, Windows <a>.<b>.<c> with a major version of 10 or more.

I ran cargo test --workspace on GitHub's windows-latest with Rust 1.98.1 from rust-toolchain.toml:

  • This PR: everything passes. victory-loader has 19 passed, the other crates have 0 failed. On that runner the new test's line is host: AMD EPYC 9V74 80-Core Processor, Windows 10.0.26100.
  • The end of an unhandled-exception report: a throwaway test, used only on my CI branch, reports a synthetic illegal instruction. On main the report ends with the stack:
    VIctory: unhandled exception 0xc000001d at victory_loader-….exe+0xf9cf0
      #0  victory_loader-….exe+0xf9cf0
    
    With this PR:
    VIctory: unhandled exception 0xc000001d at victory_loader-….exe+0x102a30
      #0  victory_loader-….exe+0x102a30
      host: AMD EPYC 9V74 80-Core Processor, Windows 10.0.26100
    
  • I ran with --test-threads=1. With 4 threads, the shader crate's GPU tests sometimes crash on that runner (STATUS_ACCESS_VIOLATION), on unmodified main as well.

Not tested: a crash in the title.

Related: #7, #84, #102, #103, #106. It touches different lines of crash.rs than #198 and #204 and merges cleanly with both.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6572522603 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/213). Originally posted by [Dufftwt](https://github.com/Dufftwt) on 2026-11-24T01:28:56Z. --- ## What's wrong Two facts about the host decide whether many crashes are bugs at all, and a crash report contains neither: - **The CPU.** The console's CPU is a Zen 2, and title code uses AMD-only instructions that Intel CPUs lack (`clwb` before Ice Lake, `clzero`, `monitorx`, SSE4a…). The loader emulates the ones it knows. Whether an `0xc000001d` is a known case, an unknown instruction or something else depends entirely on the CPU. - **The Windows build.** It decides which D3D12 runtime and shader model are available (Windows 10's in-box runtime stops at SM 6.5, #84). Neither is in the console output or in `crashes.log`. So every report needs a follow-up question, or reporters type their specs by hand, and some guess wrong (#103 guessed at the instruction without knowing it depended on the CPU generation). ## What the fix does In `crash.rs`: - When the crash log is set up (`log_crashes_to`, at title start), the loader reads two values once: - the CPU's brand string, from `cpuid` leaves `0x80000002`–`0x80000004`; - the real Windows version, from `RtlGetVersion`. `GetVersionEx` would return whatever the executable's manifest declares instead. - Unhandled exceptions, panics and host GPU failures (`log_crash`) now end with one more line, `host: <CPU>, Windows <major.minor.build>`. It comes just before the title's last debug output, which those reports already end with. At crash time nothing is queried: the line was formatted at startup. First-chance reports don't change. `victory-loader` gets two more `windows-sys` features for `RtlGetVersion` and its structure: `Wdk_System_SystemServices` and `Win32_System_SystemInformation`. It already uses `Wdk_System_Threading`. ## How it behaves after the fix ``` VIctory: unhandled exception 0xc000001d at victory-image-….dll+0x4ecc84a rax … rbx … … #0 victory-image-….dll+0x4ecc84a … host: Intel(R) Core(TM) i3-10100F CPU @ 3.60GHz, Windows 10.0.19045 ``` The same line goes to `crashes.log`, so a pasted report or log file says by itself what machine it came from. ## Tests The new test `the_host_line_names_the_cpu_and_windows` checks that the line has the form ` host: <non-empty CPU name>, Windows <a>.<b>.<c>` with a major version of 10 or more. I ran `cargo test --workspace` on GitHub's `windows-latest` with Rust 1.98.1 from `rust-toolchain.toml`: - **This PR:** everything passes. `victory-loader` has 19 passed, the other crates have 0 failed. On that runner the new test's line is `host: AMD EPYC 9V74 80-Core Processor, Windows 10.0.26100`. - **The end of an unhandled-exception report:** a throwaway test, used only on my CI branch, reports a synthetic illegal instruction. On `main` the report ends with the stack: ``` VIctory: unhandled exception 0xc000001d at victory_loader-….exe+0xf9cf0 #0 victory_loader-….exe+0xf9cf0 ``` With this PR: ``` VIctory: unhandled exception 0xc000001d at victory_loader-….exe+0x102a30 #0 victory_loader-….exe+0x102a30 host: AMD EPYC 9V74 80-Core Processor, Windows 10.0.26100 ``` - I ran with `--test-threads=1`. With 4 threads, the shader crate's GPU tests sometimes crash on that runner (`STATUS_ACCESS_VIOLATION`), on unmodified `main` as well. **Not tested:** a crash in the title. Related: #7, #84, #102, #103, #106. It touches different lines of `crash.rs` than #198 and #204 and merges cleanly with both.
jeremygold02 commented 2026-11-24 06:55:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T05:04:26Z.


Thanks @Dufftwt for making the host line in crash reports identify the CPU and Windows build.

I tested commit 7f00a62a4b861f0a051cc600470ce0570ab43c6f with:

cargo test --locked -p victory-loader --lib the_host_line_names_the_cpu_and_windows -- --test-threads=1

The targeted test passed (1 passed, 0 failed; 18 filtered). the_host_line_names_the_cpu_and_windows verifies the host: line framing and newline, requires a nonempty CPU name without surrounding whitespace or NULs, and checks for three numeric Windows version components with a major version of at least 10.

This validates the formatted host-information line. It does not generate or inspect a full crash report from an actual exception.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7122598714 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/213#issuecomment-7122598714). Originally posted by [jeremygold02](https://github.com/jeremygold02) on 2026-11-24T05:04:26Z. --- Thanks @Dufftwt for making the host line in crash reports identify the CPU and Windows build. I tested commit `7f00a62a4b861f0a051cc600470ce0570ab43c6f` with: ``` cargo test --locked -p victory-loader --lib the_host_line_names_the_cpu_and_windows -- --test-threads=1 ``` The targeted test passed (1 passed, 0 failed; 18 filtered). [`the_host_line_names_the_cpu_and_windows`](https://github.com/Marvisak/VIctory/blob/7f00a62a4b861f0a051cc600470ce0570ab43c6f/crates/victory-loader/src/crash.rs#L723) verifies the `host:` line framing and newline, requires a nonempty CPU name without surrounding whitespace or NULs, and checks for three numeric Windows version components with a major version of at least 10. This validates the formatted host-information line. It does not generate or inspect a full crash report from an actual exception.
mercuryVM commented 2026-11-24 09:55:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T09:55:11Z.

Review: APPROVED


Tested 7f00a62 on Windows 11, RTX 5070, MSVC: the workspace passes (196 outside victory-shader).

  • Safety screen: the Cargo.toml change only adds two windows-sys features (Wdk_System_SystemServices, Win32_System_SystemInformation) to the existing dependency, with no new crate.
  • RtlGetVersion is the right call, since GetVersionEx is manifest-shimmed. The CPUID brand string reads leaves 0x80000002–4 after checking the max extended leaf.
  • Computing both at log_crashes_to time, so the crash path only formats a stored string, is the right choice for a crash handler.
  • Worth knowing: the CPU model and Windows build end up in crashes.log, which users paste into public issues. Both are low-sensitivity and exactly what reports need, but the README's crash-log section could mention it.

No issues found.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6037073853 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/213#pullrequestreview-6037073853). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T09:55:11Z. **Review:** APPROVED --- Tested 7f00a62 on Windows 11, RTX 5070, MSVC: the workspace passes (196 outside `victory-shader`). - Safety screen: the `Cargo.toml` change only adds two `windows-sys` features (`Wdk_System_SystemServices`, `Win32_System_SystemInformation`) to the existing dependency, with no new crate. - `RtlGetVersion` is the right call, since `GetVersionEx` is manifest-shimmed. The CPUID brand string reads leaves 0x80000002–4 after checking the max extended leaf. - Computing both at `log_crashes_to` time, so the crash path only formats a stored string, is the right choice for a crash handler. - Worth knowing: the CPU model and Windows build end up in `crashes.log`, which users paste into public issues. Both are low-sensitivity and exactly what reports need, but the README's crash-log section could mention it. No issues found. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-25 01:03:00 +00:00
Marvisak commented 2026-11-25 01:07:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:23:16Z.


Automated triage for the maintainers.

Merge candidate. This adds a host: <CPU brand string>, Windows <major.minor.build> line to crash reports, panics and log_crash output in crates/victory-loader/src/crash.rs, computed once in log_crashes_to from cpuid leaves 0x80000002-4 and RtlGetVersion, so nothing is queried at crash time. The Cargo.toml change only enables two more features of windows-sys, which the loader already uses; no new dependency. Small note: first-chance breakpoint reports (VICTORY_CRASH_BREAKPOINTS=1) go through the same path and will carry the line too, contrary to the PR body; harmless.

CI: no check runs on the head commit.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148456351 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/213#issuecomment-7148456351). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:23:16Z. --- <!-- victory-triage v1 head=7f00a62a4b861f0a051cc600470ce0570ab43c6f verdict=merge-candidate at=2026-11-25T00:18:15Z --> Automated triage for the maintainers. **Merge candidate.** This adds a `host: <CPU brand string>, Windows <major.minor.build>` line to crash reports, panics and `log_crash` output in `crates/victory-loader/src/crash.rs`, computed once in `log_crashes_to` from `cpuid` leaves 0x80000002-4 and `RtlGetVersion`, so nothing is queried at crash time. The `Cargo.toml` change only enables two more features of `windows-sys`, which the loader already uses; no new dependency. Small note: first-chance breakpoint reports (`VICTORY_CRASH_BREAKPOINTS=1`) go through the same path and will carry the line too, contrary to the PR body; harmless. CI: no check runs on the head commit. --- _Generated by [Claude Code](https://claude.ai/code)_
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
Marvisak/VIctory!213
No description provided.