@@ -20,8 +20,6 @@ extension SentryMXCallStackTree {
2020 // it represents data that is sampled across many threads and aggregated, we do not
2121 // know which samples came from which thread. Instead we create just one fake thread
2222 // that just contains the most common callstack.
23- //
24- // We hope to add flamegraph support at some point and that is tracked here: https://github.com/getsentry/sentry-cocoa/issues/7062
2523 func sentryMXBacktrace( inAppLogic: SentryInAppLogic ? , handled: Bool ) -> [ SentryThread ] {
2624 callStacks. enumerated ( ) . map { index, callStack in
2725 let thread = SentryThread ( threadId: NSNumber ( value: index) )
@@ -53,7 +51,7 @@ extension SentryMXCallStackTree {
5351 }
5452
5553 /// Flattens the call stack tree into a single thread with all frames.
56- /// Each frame includes metadata in its `vars` field to allow reconstructing the original tree:
54+ /// Each frame includes metadata to allow reconstructing the original tree:
5755 /// - `parent_frame_index`: The index of the parent frame in the flat list (-1 for root frames)
5856 /// - `sample_count`: The number of samples at this frame
5957 ///
@@ -76,8 +74,12 @@ extension SentryMXCallStackTree {
7674
7775 private func flattenFrame( _ mxFrame: SentryMXFrame , parentIndex: Int , frames: inout [ Frame ] , inAppLogic: SentryInAppLogic ? ) {
7876 let currentIndex = frames. count
79- let frame = mxFrame. toSentryFrameWithTreeData ( frameIndex: currentIndex, parentFrameIndex: parentIndex)
80- frame. inApp = NSNumber ( value: inAppLogic? . is ( inApp: frame. package ) ?? false )
77+ let frame = mxFrame. toSentryFrameWithTreeData ( parentFrameIndex: parentIndex)
78+ if let package = frame. package {
79+ frame. inApp = NSNumber ( value: inAppLogic? . is ( inApp: package ) ?? false )
80+ } else {
81+ frame. inApp = true
82+ }
8183 frames. append ( frame)
8284
8385 // Recursively process child frames
@@ -120,9 +122,8 @@ extension SentryMXFrame {
120122 return result
121123 }
122124
123- /// Converts this frame to a SentryFrame with tree metadata in the `vars` field.
124- /// The metadata allows reconstructing the original tree structure from a flat list.
125- func toSentryFrameWithTreeData( frameIndex: Int , parentFrameIndex: Int ) -> Frame {
125+ /// Converts this frame to a SentryFrame.
126+ func toSentryFrameWithTreeData( parentFrameIndex: Int ) -> Frame {
126127 let frame = Frame ( )
127128 frame. package = binaryName
128129 frame. instructionAddress = sentry_formatHexAddressUInt64Swift ( address)
0 commit comments