Skip to content

tools: minidump_summary.py attributes the title's own crash dumps to mapped modules - #8575

Open
Davidutz19 wants to merge 2 commits into
ItsNotRexed:mainfrom
Davidutz19:minidump-summary
Open

Davidutz19 wants to merge 2 commits into
ItsNotRexed:mainfrom
Davidutz19:minidump-summary

Conversation

@Davidutz19

Copy link
Copy Markdown

Claimed in the coordination issue as a new item (claim).

Depends on: none. It builds on main. #8161 moves T: into a per-process subfolder of .gta6rt-temp. The new docs/boot.md section only says that T: maps to the overlay's .gta6rt-temp folder, so it stays true either way.

What and why

The title has its own crash reporter. Under gta6rt it cannot upload anything, but it still writes a minidump through CreateFileW to T:\<guid>.dmp, which lands in <overlay>/.gta6rt-temp. The dump's ModuleList comes from the host loader. It names gta6rt.exe and the Wine or Windows DLLs, but not the executable and the four package DLLs that gta6rt's PE loader mapped by hand. A debugger therefore shows the fault and every guest frame as a bare address.

The startup trace (--trace) already has a map event with module, base and size for each mapped image. tools/minidump_summary.py reads a dump and the trace of the same run and prints, as module+0xRVA with both module lists:

  • the exception: code and name, thread, address, and for an access violation or in-page error the access type (read/write/execute) and target;
  • each thread's rip/rsp. For the faulting thread these come from the exception stream's own CONTEXT, because the thread's ThreadList context is the reporter's;
  • the faulting thread's saved stack slots (or every thread's with --all-threads) that point into a known module past its header page. This is a scan, not an unwind, and the docs and --help say so.

It warns when the dump's process id (MiscInfo) differs from the trace's trace_open pid, and when a mapped range overlaps one of the dump's modules. Thread names are counted, not printed. The tool uses only the standard library and follows the repo's conventions: python -I, a --help docstring, --json, and one ERROR: line with exit 2 for a missing or invalid input. docs/boot.md gets a short section, "The title's own crash dumps", and docs/README.md names the tool in the boot.md row.

I chose a tool over a runtime change, for example wrapping MiniDumpWriteDump to add the mapped modules through a callback. The trace already has everything the attribution needs, and the tool reads dumps from any build, including old ones.

Tested

NixOS, Python 3.12, CPU only for the tool. The dumps came from a clang-cl 21.1.8 cross build under Wine 11.21 Staging on a GTX 1060 / NVIDIA 580.

  • tests/test_minidump_summary.py (7 tests, OK). It builds a synthetic AMD64 minidump in memory with SystemInfo, MiscInfo, a one-module ModuleList, a ThreadList with a CONTEXT and saved stack, a MemoryList and an Exception stream with its own CONTEXT, and pairs it with a synthetic trace that has a map event and a truncated last line. The tests check the exception and access attribution, the use of the exception context for the faulting thread, the stack scan (skipping slots below the fault's rsp and values in a header page), bare addresses without --trace, the pid-mismatch warning, read access and other codes, the text report, and exit 2 with one ERROR: line for four bad inputs.
  • python -m compileall -q tools tests, test_ci_registration, test_docs_repo_paths, test_docs_table_rows: OK. test_docs_cli_flags and test_text_write_line_endings fail on main the same way with and without this change (docs/embedded_shaders.md flags; tools/leonida_tui.py, tools/wave_diff.py). Neither failure involves the files changed here.
  • scripts/check_no_game_data.py on the changed files: clean.
  • On my own machine I ran it on 16 real crash-reporter dump files from three overlays. 15 parse. The 16th is shorter than a minidump header and gets the one ERROR: line and exit 2. Of the 15, 9 guest faults (6 access violations, 3 breakpoints) resolve to the executable and 1 access violation to gta6rt.exe. 5 C++ exceptions resolve to the host's RaiseException. For the 4 dumps whose run trace I kept, the exception address matches the trace's exception event. The faulting thread's stack scan also contains every frame of the trace's unwound stack in the same order (15 of 15 in three runs, 4 of 4 in one), mixed with data-pointer candidates. Without --trace those addresses stay bare. The dumps, traces and outputs stayed local.

AI-assisted (Claude). Tested on NixOS / GTX 1060 / NVIDIA 580 / Wine 11.21 Staging.

  • No game data, keys or decryption, including in logs and reports.

🤖 Generated with Claude Code

…mapped modules

The title's crash reporter writes a minidump to T:\ under gta6rt (overlay
.gta6rt-temp). The dump's ModuleList comes from the host loader and names
gta6rt.exe and the host DLLs, not the images gta6rt maps itself, so the
fault and guest frames are bare addresses. The tool reads the dump and the
startup trace of the same run (its map events) and prints the exception,
each thread's instruction pointer and a scan of the faulting thread's saved
stack as module+RVA. docs/boot.md says where the dumps land and how to read
them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@svds12343 svds12343 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent Windows CPU review of 66c7719823306f1e1c1868db0f4667864e00ef50 (parent 867d922f09b86583859796a174df89555fb32da8). Two reproducible correctness issues are attached inline; requesting changes for those. Implementation stays with this PR's owner.

Coordination claim: #8504 (comment)
Environment: Windows 11 25H2 build 26200.9457, CPython 3.12.5, redirected stdout cp1252. CPU only, GPU/driver unused. AI-assisted (OpenAI Codex). Only the PR's hand-written synthetic fixture and invented trace names were used; no game files, real dumps or external services.

Validation:

  • python -I tests/test_minidump_summary.py -v: 7/7 pass.
  • python -I tests/test_tool_stdout_encoding.py -q: its three executable checks pass; the audit fails with 13 unguarded programs. An audit of the actual parent files finds 12; tools/minidump_summary.py is the additional one.
  • python -I reports/codex-review-8575/probe.py: all reproduction/control assertions pass. Removing just the MemoryList directory entry while preserving the ThreadList stack descriptor and bytes changes the reported candidate count from 3 to 0. Supplying that descriptor as a memory range restores all 3. ASCII text output, JSON output and a stdout-reconfigure control exit 0; an invented non-ANSI module name in ordinary redirected text mode exits 1 with UnicodeEncodeError.
  • python -I tests/test_ci_registration.py -q: 14 passed; python -I tests/test_docs_repo_paths.py -q: 3 passed; python -I tests/test_docs_table_rows.py -q: 2 passed.
  • python -m compileall -q tools/minidump_summary.py tests/test_minidump_summary.py, python -I tools/minidump_summary.py --help, diff check and the no-game-data scanner pass.

The independent probe is local review code, not a competing implementation. No runtime, translator, GPU or real-dump execution. See inline comments for minimal reproductions and the relevant documented descriptor.

Comment thread tools/minidump_summary.py
def summarize(dump: Minidump, mapped: list, trace_pid, all_threads: bool, limit: int) -> dict:
own = dump.modules()
symbolize = Symbolizer(own + mapped)
ranges = dump.memory()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Include the stack range carried by each ThreadList entry

ranges includes only MemoryList/Memory64List entries, while stack_scan() discards the RVA from thread["stack"]. A dump can carry the saved stack through its MINIDUMP_THREAD.Stack descriptor; the bytes need not also be found through this separate list. With this PR's synthetic fixture, remove the MemoryList directory entry but preserve the ThreadList descriptor and saved bytes: the scan silently changes from 3 candidates to 0 and reports that no module address was found. Using [thread["stack"]] as the range restores all 3. Please use the thread's own descriptor (with bounds checks) or include it in the ranges, and add a test without the duplicate MemoryList entry. The current fixture always duplicates the stack there, hiding this path.

Comment thread tools/minidump_summary.py


if __name__ == "__main__":
sys.exit(main())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Apply the repository's stdout encoding guard

The new entry point lacks sys.stdout.reconfigure(errors="replace"). On Windows/Python 3.12 with redirected stdout (cp1252 here), a valid trace map event whose invented module name contains U+E9C3 makes python -I -X utf8=0 tools/minidump_summary.py <synthetic.dmp> --trace <synthetic.trace> exit 1 with UnicodeEncodeError while printing the mapped-module line. ASCII names, --json (which escapes the name), and a launcher applying the normal stdout guard all exit 0. The existing test_tool_stdout_encoding.py audit newly flags this file: 13 missing guards at this head versus 12 on its actual parent. Please add the same guarded reconfigure used by the other CLI tools and a subprocess regression with redirected stdout; the current StringIO-based text test cannot expose the encoding failure.

@davyvs

davyvs commented Nov 23, 2026

Copy link
Copy Markdown

Tested 66c771982 natively on Windows 11 Pro 10.0.26300, Python 3.11: pass, plus one doc nit.

  • python -I tests/test_minidump_summary.py: 7 tests OK on the PR. The base 867d922f0 has no tool or test.
  • test_ci_registration, test_docs_repo_paths, test_docs_table_rows and the other test_docs_* files pass. test_docs_cli_flags, test_docs_design_rows, test_docs_links and test_text_write_line_endings fail once each, the same on the base. None of those failures names the files this PR changes. check_no_game_data.py on the 4 files: exit 0. compileall: OK.
  • Negative control (mutations in tools/minidump_summary.py): removing the exception-context override fails test_faulting_thread_uses_exception_context_and_scans_stack and test_text_report. Removing the header-page skip fails test_faulting_thread_....
  • Gap: starting the stack scan at the stack base instead of the fault's rsp (lo = start) still passes all 7 tests, because the two fixture slots below FAULT_RSP are zero. The test comment says those slots are skipped, but nothing checks it. A module address in slots[0] or slots[1] would cover it. Reversing the trace-first Symbolizer order also passes, because the fixture has no overlapping ranges.
  • Doc nit: the module docstring (shown in --help) says "64 by default, --frames N", but --frames defaults to 32. The --help output shows both numbers.
  • The trace parsing matches the runtime's events: trace_open carries pid (startup_trace.h:258), and map writes base/size as quoted 0x... strings (pe_loader.cpp:1018).

No game files. AI-assisted (Claude).

@RAINighty

Copy link
Copy Markdown

Tested 66c771982 merged with main 867d922f0 (clean merge) on Windows 11 (10.0.26300), Python 3.13.15 in UTF-8 mode (PYTHONUTF8=1; venv with the pinned tests/requirements.txt), with llvm-mc 21.1.8 (AMDGPU) and SPIRV-Tools v2026.4 on PATH: pass.

  • python -I tests/test_minidump_summary.py with this PR: OK (Ran 7 tests).
  • tools/minidump_summary.py and its test are both new in this PR, so there is nothing on main to run a baseline or negative control against.
  • Code not reviewed beyond running it. No GPU or game files.

AI-assisted (Claude Code).

@garuspl

garuspl commented Nov 23, 2026

Copy link
Copy Markdown

Tested 66c7719 on Windows 11 (CPU only, no GPU needed): pass

Windows 11 Pro, Python 3.14.7, no GPU or game files involved; pytest/numpy/Pillow pinned from tests/requirements.txt in a fresh venv. Method: PR head merged onto main 867d922, the PR's test files run with python -m pytest before and after the merge, plus python -m compileall -q on the changed files (clean).

  • tests/test_minidump_summary.py (new): 7 passed.

AI-assisted (Claude Code, Claude Opus 5.5).

… guard stdout

Review of ItsNotRexed#8575 (svds12343):
- stack_scan now searches the ThreadList entry's own stack descriptor first, so a dump that does not repeat the
  saved stack in MemoryList/Memory64List still scans it. New test builds the dump without MemoryList.
- The entry point reconfigures stdout with errors="replace" like the other tools. New subprocess test runs the
  tool's __main__ with a strict cp1252 stdout and a mapped-module name it cannot encode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Davidutz19

Copy link
Copy Markdown
Author

@svds12343 thanks, both reproduced and fixed in 464fbbbe4:

  • Stack range: stack_scan now reads through the ThreadList entry's own stack descriptor first, then the memory lists. New test test_stack_read_through_the_thread_descriptor_without_memory_list builds the fixture without the MemoryList stream and gets the same 3 candidates as with it.
  • stdout guard: the entry point uses the same sys.stdout.reconfigure(errors="replace") guard as the other tools. New test test_redirected_strict_stdout_replaces_unencodable_names runs the tool's __main__ in a subprocess with a strict cp1252 stdout and a mapped-module name containing U+E9C3: exit 0, the name prints with ?.

Checked: both new tests fail on 66c771982 and pass now (9/9). test_tool_stdout_encoding.py no longer lists minidump_summary.py; its remaining failure names tools/world_drawable_lookup.py, which this PR doesn't touch. compileall clean. NixOS, Python 3.12, CPU only.

AI-assisted (Claude). No game data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants