Skip to content

feat(native): Provide crash metadata to on_crash - #2174

Open
jpnurmi wants to merge 2 commits into
jpnurmi/ref/native-crashingfrom
jpnurmi/feat/native-crash-stack
Open

jpnurmi wants to merge 2 commits into
jpnurmi/ref/native-crashingfrom
jpnurmi/feat/native-crash-stack

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Reuse and extend the existing SDK unwinders already used by inproc to provide exception metadata, registers, and a basic crashing-thread stack for crash identification in native on_crash, matching inproc.

  • Capture up to 128 fault-context IPs and unwind source in shared memory. Retain the faulting IP when available.
  • Linux: SDK libunwind with signal-safe logging.
  • macOS: SDK frame-pointer walker, guarded Mach reads, PAC stripping, __DARWIN_OPAQUE_ARM_THREAD_STATE64 accessors, and instruction_addr_adjustment=none.
  • Android/Linux without libunwind: bounded frame-pointer capture via process_vm_readv; avoids libunwindstack's C++ allocation.
  • Windows: MSVC x64 RtlLookupFunctionEntry/RtlVirtualUnwind walking without DbgHelp; SP progress permits recursive frames. Frame-pointer capture on x86/ARM64 and other x64 builds.
  • ARM32 frame-pointer fallbacks retain only the faulting IP.

The daemon reuses partial captures and enriches existing frames. Preserve exception/register/frame edits and removals, and honor callback rejection.

Ref: #2102

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 800ead5

Comment thread src/backends/native/sentry_crash_context.h
@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 49.38272% with 164 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.06%. Comparing base (98293f1) to head (800ead5).

Additional details and impacted files
@@                       Coverage Diff                       @@
##           jpnurmi/ref/native-crashing    #2174      +/-   ##
===============================================================
- Coverage                        75.39%   75.06%   -0.33%     
===============================================================
  Files                              103      103              
  Lines                            28119    28314     +195     
  Branches                          5158     5202      +44     
===============================================================
+ Hits                             21199    21255      +56     
- Misses                            5587     5700     +113     
- Partials                          1333     1359      +26     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/backends/native/sentry_crash_context.h

@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 2 potential issues.

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 bcf18cf. Configure here.

Comment thread CHANGELOG.md Outdated
Comment thread src/backends/native/sentry_crash_handler.c
@jpnurmi
jpnurmi force-pushed the jpnurmi/feat/native-crash-stack branch from bcf18cf to 59a96d8 Compare October 8, 2026 18:46
@jpnurmi
jpnurmi changed the base branch from master to jpnurmi/ref/native-crashing October 8, 2026 18:47
@jpnurmi
jpnurmi added this pull request to stack #2181 October 8, 2026 18:47
Provide exception metadata, registers, and a basic crashing-thread stack
for crash identification in native `on_crash`, matching `inproc`.
Use the same payload for `before_send` when `on_crash` is unset.

- Capture up to 128 fault-context IPs and unwind source in shared memory.
  Retain the faulting IP when available.
- Linux: SDK `libunwind` with signal-safe logging.
- macOS: SDK frame-pointer walker, guarded Mach reads, PAC stripping,
  `__DARWIN_OPAQUE_ARM_THREAD_STATE64` accessors, and
  `instruction_addr_adjustment=none`.
- Android/Linux without `libunwind`: bounded frame-pointer capture via
  `process_vm_readv`; avoids `libunwindstack`'s C++ allocation.
- Windows: MSVC x64 `RtlLookupFunctionEntry`/`RtlVirtualUnwind` walking
  without DbgHelp; SP progress permits recursive frames.
  Frame-pointer capture on x86/ARM64 and other x64 builds.
- ARM32 frame-pointer fallbacks retain only the faulting IP.

The daemon reuses partial captures and enriches existing frames.
Preserve exception/register/frame edits and removals, and honor callback
rejection.
@jpnurmi
jpnurmi force-pushed the jpnurmi/feat/native-crash-stack branch from 59a96d8 to fda25c6 Compare October 9, 2026 07:49

This branch has not been deployed

No deployments
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