Crash reports: show the bytes of an instruction the CPU refused #198
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!198
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/198/head"
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?
@Dufftwt on GitHub · 2026-11-24 01:21 UTC · original
Dufftwt:fix/crash-report-instruction-bytes→main· +53 −0 · 1 files · 1 commits · merged 2026-11-24 07:53 UTCWhat's wrong
When the CPU refuses an instruction (
0xc000001dillegal instruction,0xc0000096privileged instruction), the crash report gives only its address:The address doesn't say which instruction failed. On Intel hosts that is the first question every one of these reports raises, because the console's Zen 2 CPU has instructions Intel CPUs lack:
clwb,clzero,monitorx/mwaitx,rdpru, SSE4a. The loader emulates the ones it knows, and the next one it doesn't know shows up as exactly this line. So far reporters have had to guess (#103 suggests "SHA-NI, SSE4a, or RDPID" for what turned out to beclwb) or dump the bytes by hand (#7). The reply in #106 asks for the address and the CPU model "to tell which encoding" it was, and #85's local patch logged the bytes for the same reason.What the fix does
For these two exceptions,
reportincrash.rsnow adds the bytes at the faulting address to the end of the report's first line:emulate_amd_onlyalready reads instruction bytes under the same rule.Other exceptions, the register lines and the stack lines don't change.
How it behaves after the fix
The report names the instruction by itself, in the console output and in
crashes.logalike:0f 01 fdisrdpru,66 0f ae /6isclwb, and so on, so whoever reads the report can tell which instruction is missing without a debugger or the title's files.Tests
The new test
instruction_bytes_stop_at_the_end_of_their_pagecovers the byte reader:PAGE_NOACCESS, it gives exactly those 3 bytes and doesn't fault.I ran
cargo test --workspaceon GitHub'swindows-latestwith Rust 1.98.1 fromrust-toolchain.toml:victory-loaderhas 19 passed, the other crates have 0 failed.reportan illegal instruction at the bytes ofrdpru. Onmainit prints and with this PR--test-threads=1. With 4 threads, the shader crate's GPU tests sometimes crash on that runner (STATUS_ACCESS_VIOLATION), on unmodifiedmainas well.Not tested: a real illegal instruction on an Intel host, or the title.
Related: #7, #85, #102, #103, #106 (Intel hosts,
0xc000001d). #34 addsrdpruandclzeroloops; this change doesn't overlap it.@DaviTostes on GitHub · 2026-11-24 01:30 UTC · original
Tested
babe2dbunder Wine 11.22 + vkd3d-proton 3.1 (Arch Linux x86_64, AMD RX 9060 XT, RADV 26.3.1), Windows build of the loader:victory_loader(lib): 19 passed, 0 failed — one more than before, the new instruction-bytes test.tests/crash_log.rs: 1 passed (first_chance_breakpoint_logging).No game data used.