getsentry / getsentry/sentry-cocoa

CreateStacktrace helper method

Open
#3,907 8 comments 2 reactions 0 assignees View on GitHub
Cocoa Errors Improvement
Dominant language
Swift
Stars
1.1k
Forks
418
Avg merge
2d 3h
Merged PRs (30d)
106

Description

### Description

Write a helper method that creates a SentryStacktrace by passing in a list of raw stack memory addresses similar to what native offers with [`sentry_value_new_stacktrace`](https://github.com/getsentry/sentry-native/blob/dc43150d35a4171634855f3c0dd915e78754f90b/include/sentry.h#L426-L438), so that users can build their own events with their custom stacktraces. This can be reused for https://github.com/getsentry/sentry-cocoa/issues/741.

This came up here https://github.com/getsentry/sentry-cocoa/issues/741#issuecomment-2077339070:
> Being able to attach a custom stack trace to events would be quite useful for some type of errors. In my project we're using Chromium's [zombie detector](https://source.chromium.org/chromium/chromium/src/+/main:components/crash/core/common/objc_zombie.h;l=30;drc=8ba1bad80dc22235693a0dd41fe55c0fd2dbdabd) to detect some security and stability issues. When a zombie access is detected we get a breadcrumb containing an array of stack address indicating where the dealloc happened. Being able to symbolize this stack trace and add it to the event would be incredibly useful as it'd give us crash reports that clearly indicate where an object has been dealloc'd and where it is being accessed.

We do something similar when creating converting the MetricKit payloads to SentryFrames in our SentryMetricKitIntegration:

https://github.com/getsentry/sentry-cocoa/blob/d6ff82cd1e1d0d263fb1a7358b09bd0a08df013e/Sources/Sentry/SentryMetricKitIntegration.m#L417-L435

We also need to ensure that the correct debug meta data is attached.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.