Skip to content

xcl run: thread dumps name XCL's own functions from xcl.pdb - #1811

Open
JRamos1993 wants to merge 2 commits into
xcl-dev:mainfrom
JRamos1993:dump-symbol-names
Open

JRamos1993 wants to merge 2 commits into
xcl-dev:mainfrom
JRamos1993:dump-symbol-names

Conversation

@JRamos1993

Copy link
Copy Markdown

Stacked on #1734. This PR's commit is the last one, c7c600f; the one before it is #1734's.

A thread dump gives XCL's frames as xcl.exe+offset, and whoever reads one looks each up by hand with the same build's PDB. Several reports in #846 and #505 did that, and so did I. Now a dump line adds the function's name to XCL's frames, from the PDB next to the executable: xcl.exe+0x276a43 (title_textures::refresh). The offset stays.

What is in it

  • crates/xcl/src/eh.rs:
    • own_symbols: on the first dump, it loads System32's dbghelp.dll, opens a session of its own and loads only XCL's module and its PDB.
      • The session uses a made-up process handle, so a title that uses dbghelp itself is not disturbed.
      • Every call holds one lock, because dbghelp is single-threaded.
      • short_name drops generic arguments and keeps the last two path segments.
    • describe_frame: module+offset, plus (name) for XCL's own frames. dump_threads uses it.
    • Lines are as before without a PDB next to the executable (GNU builds make none) or with XCL_DUMP_SYMBOLS=0. A run that makes no dump never loads dbghelp.
  • Tests:
    • a_symbol_name_drops_generic_arguments_and_keeps_two_segments
    • a_dump_frame_of_xcl_names_its_function: looks up a test function's own address through the test executable's PDB. It prints SKIPPED without a PDB.

Tested

  • NVIDIA GeForce RTX 5090 32 GB (driver 621.24), Intel Core i9-14900KF, 64 GB RAM, Windows 11 Pro 26200, rustc 1.97.1 x86_64-pc-windows-msvc; tests in debug, runs in release.
  • cargo test --workspace -- --test-threads=4 on c7c600f, after cargo build --workspace: 862 passed, 0 failed, 42 ignored.
    • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
    • Both new tests pass. The PDB test ran; it did not skip.
  • Retail title 1.0.2.1 to its world-load stall: XCL_NETWORK=0 XCL_PRESS_AT=25:A XCL_THREAD_DUMP_AT=88,96.
    • All 308 XCL frames of the first dump are named; none is left as a bare offset.
    • The first dump, which loads the PDB, was written 0.2 s after its time. The second was written 0.13 s after its time.

Regression run (60 s, no input, both built with x86_64-pc-windows-msvc)

main:

xcl-smoke v1
commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0
gpu: NVIDIA GeForce RTX 5090
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1615 (PresentX 1615)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15904 MB

PR:

xcl-smoke v1
commit: c7c600f16b933de634e5ed837e43679763f43c61
gpu: NVIDIA GeForce RTX 5090
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1633 (PresentX 1634)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15965 MB

Not tested

AI use

  • Claude Code with Claude Opus 5.5 wrote the change and its tests, ran the tests and the title runs, and wrote this description.

…tack

A thread dump line showed the top 14 frames of each thread. A title thread
deep in XCL, the driver or DXC (a compute pipeline it builds in a bind, a
compile it waits for) had all 14 of them there, so its line named no title
frame and read like one of XCL's own threads. In dumps of a retail title's
world-load stall, the title threads building pipelines in their binds looked
like that, and reading them as XCL's own threads led to a wrong conclusion.

The dump now unwinds up to 96 frames. When none of the top 14 is in the
title's code but a deeper one is, the line adds how many frames were left
out and the title's first 4 frames from there. Other lines are unchanged.
(Such a thread's first title frame was 34 and 47 frames deep.)
A thread dump gave XCL's frames as xcl.exe+offset, and whoever read it looked
each one up by hand with the same build's PDB. Now a dump line adds the
function's name to XCL's frames, e.g. "xcl.exe+0x276a43
(title_textures::refresh)", from the PDB next to the executable (release
builds keep xcl.pdb there).

dbghelp is loaded from System32 at the first dump, so a run that makes no
dump is unchanged. It gets a session of its own (a made-up process handle),
so a title that uses dbghelp itself is not disturbed, and every call holds
one lock (dbghelp is single-threaded). Names lose their generic arguments
and keep their last two path segments. Without a PDB, or with
XCL_DUMP_SYMBOLS=0, lines are as before.
@futurepro62

futurepro62 commented Nov 24, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head c7c600f (on its base c160d86).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record: 861 passed, 0 failed, 42 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: a_dump_line_reaches_the_title_frames_under_a_deep_stack, a_symbol_name_drops_generic_arguments_and_keeps_two_segments, a_dump_frame_of_xcl_names_its_function, a_dump_line_is_the_top_frames_otherwise.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 862 passed, 0 failed, 42 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • Two tests were skipped with --skip on NVIDIA. Both fail on main 7f7e768 too, not because of this PR: under XCL_REQUIRE_GPU=mesh, runner::skip_test turns their skips into failures. heap_window_out_of_memory_falls_back_to_the_switch_form skips when XCL_HEAP_WINDOWS is unset (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651), and shaders::tests::pso_measurement_compiles_an_exact_synthetic_record skips because Developer Mode is off on this PC (it cannot disable the driver cache). The AMD run does not set XCL_REQUIRE_GPU, so there both just print SKIPPED.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@Royalflamejlh

Copy link
Copy Markdown
Contributor

Linux (Wine) test of c7c600f (with #1734's commit under it) on main c4d37be + #684, a GNU build, which has no .pdb: the thread dump at 30 s had the same form with it as without (145 threads, no frame named), as the description says for a build without a PDB. The naming itself did not run here.

Setup: Fedora 44 (kernel 7.2.9), Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch. RTX 4070 12 GB (driver 615.71.09), Ryzen 9 9950X3D. Release, cross-compiled to x86_64-pc-windows-gnu (rustc 1.98.0). Retail title 1.0.2.1, the first-run screens completed once and no story progress, one A press, 40 s runs, XCL_THREAD_DUMP_AT=30, 1 run of each tree.

Tested

  • cargo test --release -p xcl --lib for the two tests it adds, under Wine: a_symbol_name_drops_generic_arguments_and_keeps_two_segments passed; a_dump_frame_of_xcl_names_its_function takes its SKIPPED path here (eh.rs:1196, no PDB beside the test executable), so the lookup itself did not run.
c4d37be + #684 the same + #1734 + c7c600f
the dump at 30 s 145 threads 145 threads
frames with a name in brackets 0 0
lines with a frame in the title's code 51 51
frames presented in 40 s 939 927

Read

  • eh.rs:707: open returns before LoadLibraryExW (:712) when there is no .pdb beside the executable, so a GNU build never loads Wine's dbghelp. This xcl.exe carries 127 MB of DWARF sections (objdump -h). A guess, not measured: without that return, Wine's dbghelp would be handed them on the first dump.

Not tested: the lookup itself under Wine (dbghelp was never loaded); this commit without #1734; an MSVC build with its .pdb under Wine; Windows; the rest of the suite.

AI use: Claude Code (Claude Fable 5.2) read the diff, built the trees, ran the tests and the two runs and wrote this report.

Posted without review by a person: the account owner was away and reads replies later.

@tugasky

tugasky commented Nov 24, 2026

Copy link
Copy Markdown

The same lookup, already here

I wrote the same thing before I saw this PR, and this is the better home for it. My duplicate was a separate crates/xcl/src/symbols.rs with a dbghelp session behind try_lock, a cache keyed by module base, paths shortened to two segments, and SizeOfImage read from the PE as the offset bound — the same shape as this PR, written twelve minutes after it opened because I searched with gh … --search, which returns nothing in this repository, and did not fall back to listing the open PRs. I have not built this branch, so I am not reporting a result for it; I am saying I have nothing to add that this does not already do for thread dumps.

The part it does not cover: the crash report

modules::describe_address is what formats frames in the unhandled exception … in <module>+0xNNN line, in the thread dump and in the stack scan — and it appends nothing from a PDB. In my own copy that path named the one address I cared about, in a 0xC0000005, only after symbolising by hand:

xcl.exe+0x1aa2b6 (hle::d3d12x::real::translated_mesh_stream+0x9f6 at d3d12x/real.rs:4468)

If the session this PR opens were reachable from describe_address as well as from the thread dump, every frame XCL prints would carry (function) and, where line tables exist, at file:line — the exception line included, which is the one a report reader looks at first.

Two things I would keep in mind for that:

  • One session for both, not two. Mine opened its own SymInitialize; two independent sessions in one process is not something I would want to argue about.
  • Lines only where they help: +0x9f6 was the offset of a fault inside a function whose line tables give only the closing brace, so the name was worth everything and the line was worth nothing. The other case worth deciding is a PDB that is stale against a rebuilt binary — the module's PE timestamp or checksum is what catches it, and a wrong name is worse than no name.

Happy to open that as a small stacked PR on your branch (Stacked on #1811) if you want it, and equally happy to drop my copy and leave the whole thing to you — your call, since it is your PR and your diagnostics.

Written by Claude (Anthropic) under my review; numbers from runs on my machine, no game data included.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants