Skip to content

cmake: enable libunwind_mac only for inproc#1722

Closed
zhaowq32 wants to merge 1 commit into
getsentry:masterfrom
zhaowq32:master
Closed

cmake: enable libunwind_mac only for inproc#1722
zhaowq32 wants to merge 1 commit into
getsentry:masterfrom
zhaowq32:master

Conversation

@zhaowq32
Copy link
Copy Markdown
Contributor

Summary

Restrict SENTRY_WITH_LIBUNWIND_MAC to the inproc backend on Apple platforms.

Motivation

libunwind_mac is only needed for Sentry's local unwinding path used by the inproc backend. When building with breakpad on Apple targets, this file is still compiled today because the CMake condition enables it for all APPLE builds.

That creates unnecessary build exposure for Apple configurations that do not use this unwinder at runtime, including older iOS SDK / armv7 setups where libunwind_mac can fail to compile.

Changes

  • Update the top-level CMake unwinder selection logic so SENTRY_WITH_LIBUNWIND_MAC is enabled only when:
    • the target platform is APPLE
    • and SENTRY_BACKEND_INPROC is selected

Impact

  • macOS/iOS + breakpad: no longer compile sentry_unwinder_libunwind_mac.c
  • macOS/iOS + inproc: behavior unchanged
  • No functional changes to the Breakpad crash handling path

Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 4b145aa. Configure here.

Comment thread CMakeLists.txt
set(SENTRY_WITH_LIBUNWIND_MAC TRUE)
if(SENTRY_BACKEND_INPROC)
set(SENTRY_WITH_LIBUNWIND_MAC TRUE)
endif()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No unwinder on Apple with non-inproc backends

High Severity

On Apple platforms with non-inproc backends (e.g., macOS defaults to crashpad), no unwinder is compiled in. The public APIs sentry_value_new_stacktrace, sentry_value_set_stacktrace, and sentry_event_value_add_stacktrace all rely on sentry_unwind_stack via unwind_stack(), which now returns 0 on these configurations because no SENTRY_WITH_UNWINDER_* macro is defined. This silently produces empty stack traces when users pass ips == NULL.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4b145aa. Configure here.

@zhaowq32 zhaowq32 closed this May 14, 2026
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.

1 participant