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

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
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
sentry-native 0.15.2

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.

- [ ] `resource` blocks have been checked for updates.
<details>
  <summary>release notes</summary>
  <pre>**Fixes**:

- Native/Windows: Resolve correct symbol names for crashes in multi-module apps ([#1811](getsentry/sentry-native#1811))
- Crashpad: Resolve correct symbol names for crashes in multi-module apps ([#1813](getsentry/sentry-native#1813), [crashpad#156](getsentry/crashpad#156))

**Features**:

- Added an in-process app-hang detection. When enabled via `sentry_options_set_enable_app_hang_tracking`, a background thread monitors the application and captures an app-hang event if no heartbeat is received within `app_hang_timeout` (default `5000` ms). Call `sentry_app_hang_heartbeat()` regularly from the thread you want monitored. ([#1806](https://github.com/getsentry/sentry-native/pull/1806))</pre>
  <p>View the full release notes at <a href="https://github.com/getsentry/sentry-native/releases/tag/0.15.2">https://github.com/getsentry/sentry-native/releases/tag/0.15.2</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!12277
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