Repository navigation
Conversation
A run that ended in an unhandled exception saved the pipeline caches but said nothing about where the title faulted: the log had the exception code and no call chain. print_fault_stacks names the access and the address, walks the faulting thread's own chain from the exception context (the filter runs on that thread, so its stack is live), and snapshots the other threads as LEONIDA_STACKS does. On the retail package this unwound a faulting chain of six title frames out of the title's worker pool and named the read that faulted, which no earlier log did. thread_stacks_test covers it with a guarded null read captured to a file.
…kept in a crash log (RT-CRASH-LOG) On top of print_fault_stacks (ProjectLeonida#2276): - the faulting context's registers (rax..r15, rip, eflags) and a host line (Windows build from RtlGetVersion, CPU brand from CPUID), as [rt] fault lines; - for an exception other than an access violation, what its parameters say: a C++ throw's object, throw info and mangled type name (read under __try), an in-page error's status, or the raw parameters; - the whole report, after a dated header, is appended and flushed to %LOCALAPPDATA%\Leonida\crashes.log, or to LEONIDA_CRASH_LOG (0: no file), with Win32 calls only, so it outlives the console. The text is built in src/crash_report.h, pure and portable, and checked by crash_report_test on every platform. thread_stacks_test points the crash log at a temporary file and checks its content. Idea from Marvisak/VIctory (crates/victory-loader/src/crash.rs, GPL-3.0); no code of it is used. Changes made by Claude Code (AI-assisted). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JPqXc6svM4pbBagTsVEYA3
lixonik
left a comment
There was a problem hiding this comment.
Windows 11/MSVC: crash_report and thread_stacks both passed using the repo's fixtures. A title boot and actual title crash were outside this run.
AI-assisted.
kawaii-shakal
left a comment
There was a problem hiding this comment.
Reviewed by Claude Code (AI-assisted) on my behalf. Comment, not an approval: the code is my commit 4be6853,
unchanged. The diff against my crash-log branch is only the merge of main, so an approval from me would be
approving my own code.
Thanks for taking it over and for the Windows run, which was the part I could not do. MSVC 19.52 at
/W4 /permissive-, thread_stacks_test and crash_report_test passing, and the manual AV and C++-throw reports
checked in the log were exactly what was missing. lixonik's run confirms the tests too.
Two known limits:
- The filter allocates (
std::string, the module lookup, the thread snapshot), as #2276 already did. A fault inside
the process heap, or while the loader's lookup mutex is held, can hang there instead of ending the process. A
nested fault insidecall_oncewould block too. Not worse than #2276, but worth knowing when a crash "hangs". read_thrown_typefollows the throw info without checking the magic in parameter 0 (0x19930520..0x19930522). A
foreign 0xE06D7363 with garbage parameters is caught by__tryand gives no type, so it fails safe, but checking
the magic first would skip the reads.
Neither blocks. A maintainer or another reviewer should give the approval.
Generated by Claude Code
|
Verified on Windows 11 (
AI-assisted. |
|
Duplicate check (diff reading only, no build): not a duplicate of #2276. It is stacked on it (it contains #2276's commit) and adds the registers, the host and the crash log file ( Heads-up: this PR and #2276 both conflict in AI-assisted (Claude Code). |
Claimed in the coordination issue as: RT-CRASH-LOG (#1608 (comment))
Depends on: #2276
What and why
This is @kawaii-shakal's
crash-logbranch (commit 4be6853, their finding in #1608), built and tested on Windows. Their commits are kept as they are; this PR adds only a merge of currentmain.kawaii-shakal's work (4be6853, on top of #2276's
print_fault_stacks): a fatal fault's report from #2276 went to stderr only, so it was lost once the console closed, and it lacked the registers, the host and what a non-access-violation exception carries. With this:RtlGetVersion, CPU brand from CPUID) are printed as[rt] faultlines;__try), an in-page error's status, or the raw parameters;%LOCALAPPDATA%\Leonida\crashes.log(Win32 calls only), or to the fileLEONIDA_CRASH_LOGnames;LEONIDA_CRASH_LOG=0turns the file off;src/crash_report.hand checked bycrash_report_test;thread_stacks_testpoints the crash log at a temp file and checks its content; the variable is documented inruntime/README.md.Windows fixes on top: none were needed. MSVC 19.52 compiles
thread_stacks.cpp,thread_stacks_test.cpp,crash_report_test.cppandgta6rtwith no errors and no warnings in these files at/W4 /permissive-.Tested
Windows 11 (10.0.26300), MSVC 19.52.37029, Ninja RelWithDebInfo, AMD Ryzen 7 9800X3D:
ctest -R "thread_stacks|crash_report": 2/2 pass.thread_stacks_testtakes a real null read throughprint_fault_stacksand checks the temp crash log holds the dated header, the fault, the faulting thread's chain and the other threads.thread_stacks.cpp, with an unhandled-exception filter callingprint_fault_stacksand returningEXCEPTION_CONTINUE_SEARCH, run withLOCALAPPDATApointed at a temp folder:Leonida\crashes.logunder it with the header,read of 0x14 at host:fault.exe+0x..., the registers,host: Windows 10.0.26300, CPU AMD Ryzen 7 9800X3D 8-Core Processorand the chain;C++ exception: object ..., throw info ..., type .?AUMyError@@;LEONIDA_CRASH_LOG=0the report still goes to stderr and no file is created.tests/test_ctest_registration.pyandscripts/check_no_game_data.pypass.GPUs tested: n/a (CPU tests)
AI-assisted: yes (Claude Code). The original branch was also written with Claude Code, as kawaii-shakal noted in #1608.
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code