Skip to content

fix(native): resolve correct symbol names for crashes in multi-module apps on Windows#1811

Merged
tustanivsky merged 3 commits into
masterfrom
fix/client-side-stackwalk
Jun 22, 2026
Merged

fix(native): resolve correct symbol names for crashes in multi-module apps on Windows#1811
tustanivsky merged 3 commits into
masterfrom
fix/client-side-stackwalk

Conversation

@tustanivsky

@tustanivsky tustanivsky commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR fixes incorrect/irrelevant function names in crash callstacks captured by the Native backend on Windows for applications composed of many modules.

Problem

When the daemon walks the crashed process's stack (walk_stack_with_dbghelp) it resolves frame addresses to function names via dbghelp initialized with a NULL symbol search path. With no search path dbghelp can't 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 stays invisible for monolithic apps but breaks for multi-module apps where the relevant code is split across many DLLs scattered across different directories. dbghelp misses most of those PDBs so the frames that matter come back with unrelated names and a callstack looks irrelevant to the actual crash even though the frame addresses are correct.

A concrete example is the Unreal Engine Editor where code is split across many UnrealEditor-*.dll and plugin modules living in many separate Binaries/ directories so crashes there produced mislabeled stacks while packaged (monolithic) game builds did not.

Proposed fix

Build a symbol search path from the directory of every loaded module (already available in crash_ctx->modules[]) and pass it to dbghelp via SymInitializeW so it can find each module's PDB next to its DLL (the equivalent of cdb -y <dirs>).

  • Thread crash_ctx into walk_stack_with_dbghelp
  • Build a deduplicated ;-separated directory list (case-insensitive dedup; cached, since the walker runs once per thread)
  • Add SYMOPT_FAIL_CRITICAL_ERRORS | SYMOPT_NO_PROMPTS to keep the unattended daemon from blocking on dbghelp dialogs; keep SYMOPT_DEFERRED_LOADS so symbol loading stays cheap with many modules.

Windows-only; other Native-backend platforms resolve symbols through different paths and are unaffected.

Related items

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 95d13d0. Configure here.

Comment thread src/backends/native/sentry_crash_daemon.c Outdated
Comment thread src/backends/native/sentry_crash_daemon.c
@tustanivsky tustanivsky merged commit f09a0ad into master Jun 22, 2026
64 checks passed
@tustanivsky tustanivsky deleted the fix/client-side-stackwalk branch June 22, 2026 11:19
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