Skip to content

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

Open
ufoptg wants to merge 2 commits into
mainfrom
upstream-pr/1811
Open

ufoptg wants to merge 2 commits into
mainfrom
upstream-pr/1811

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Stacked on xcl-dev#1734. This PR's commit is the last one, c7c600f; the one before it is xcl-dev#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 xcl-dev#846 and xcl-dev#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.

Mirror of xcl-dev#1811 (auto-synced, do not edit).

…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.
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.

2 participants