Skip to content

fix(win): resolve correct symbol names in client-side stack traces for multi-module apps#156

Merged
mujacica merged 1 commit into
getsentry:getsentryfrom
tustanivsky:fix/win-client-stackwalk
Jun 22, 2026
Merged

fix(win): resolve correct symbol names in client-side stack traces for multi-module apps#156
mujacica merged 1 commit into
getsentry:getsentryfrom
tustanivsky:fix/win-client-stackwalk

Conversation

@tustanivsky

Copy link
Copy Markdown

This PR fixes incorrect or irrelevant function names in client-side stack traces (CRASHPAD_ENABLE_STACKTRACE) on Windows for applications composed of many modules.

Problem

When the snapshot walks a crashed thread's stack (ProcessReaderWin::ReadThreadData → DoStackWalk), it resolves frame addresses to function names via dbghelp, initialized with a NULL symbol search path. Without a search path, dbghelp cannot locate each module’s PDB and falls back to the module’s export table, mislabeling internal (non-exported) functions with the nearest exported symbol.

This issue is mostly invisible in monolithic applications but breaks down in multi-module setups where code is split across many DLLs in different directories. In those cases, dbghelp cannot locate most PDB files, so frames resolve to unrelated or misleading symbols even though the underlying stack addresses are correct (x64/ARM64 unwinding still works via module unwind metadata and does not require PDBs).

A concrete example is the Unreal Engine Editor, where functionality is distributed across many UnrealEditor-*.dll modules and plugins located in separate Binaries/ directories. In these cases, crash reports showed misleading callstacks, while packaged monolithic game builds were unaffected.

Proposed fix

Build a symbol search path from the directories of all loaded modules (process_info_.Modules()) and pass it to dbghelp via SymInitializeW, allowing it to locate PDBs alongside their corresponding DLLs (equivalent to cdb -y <dirs>).

  • Build a deduplicated ;-separated directory list (case-insensitive deduplication).
  • Add SYMOPT_FAIL_CRITICAL_ERRORS | SYMOPT_NO_PROMPTS to prevent dbghelp from blocking on dialogs in unattended environments, while keeping SYMOPT_DEFERRED_LOADS so symbol loading remains lazy and efficient across many modules.

Scoped to CLIENT_STACKTRACES_ENABLED on Windows only. No behavior changes when the feature is disabled. Single-file change with no API or public interface modifications.

Related items

@mujacica mujacica merged commit 6a25bba into getsentry:getsentry Jun 22, 2026
24 checks passed
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.

3 participants