|  | 
| 20 | 20 | #import "RNSentryId.h" | 
| 21 | 21 | #import <Sentry/PrivateSentrySDKOnly.h> | 
| 22 | 22 | #import <Sentry/SentryAppStartMeasurement.h> | 
| 23 |  | -#import <Sentry/SentryBinaryImageCache.h> | 
| 24 | 23 | #import <Sentry/SentryBreadcrumb.h> | 
| 25 | 24 | #import <Sentry/SentryDebugImageProvider+HybridSDKs.h> | 
| 26 | 25 | #import <Sentry/SentryDebugMeta.h> | 
|  | 
| 30 | 29 | #import <Sentry/SentryFormatter.h> | 
| 31 | 30 | #import <Sentry/SentryOptions.h> | 
| 32 | 31 | #import <Sentry/SentryUser.h> | 
|  | 32 | + | 
| 33 | 33 | #if __has_include(<Sentry/SentryOptions+HybridSDKs.h>) | 
| 34 | 34 | #    define USE_SENTRY_OPTIONS 1 | 
| 35 | 35 | #    import <Sentry/SentryOptions+HybridSDKs.h> | 
| @@ -358,85 +358,6 @@ - (void)stopObserving | 
| 358 | 358 |     return packageName; | 
| 359 | 359 | } | 
| 360 | 360 | 
 | 
| 361 |  | -- (NSDictionary *)fetchNativeStackFramesBy:(NSArray<NSNumber *> *)instructionsAddr | 
| 362 |  | -                               symbolicate:(SymbolicateCallbackType)symbolicate | 
| 363 |  | -{ | 
| 364 |  | -#if CROSS_PLATFORM_TEST | 
| 365 |  | -    BOOL shouldSymbolicateLocally = [SentrySDKInternal.options debug]; | 
| 366 |  | -#else | 
| 367 |  | -    BOOL shouldSymbolicateLocally = [SentrySDK.options debug]; | 
| 368 |  | -#endif | 
| 369 |  | -    NSString *appPackageName = [[NSBundle mainBundle] executablePath]; | 
| 370 |  | - | 
| 371 |  | -    NSMutableSet<NSString *> *_Nonnull imagesAddrToRetrieveDebugMetaImages = | 
| 372 |  | -        [[NSMutableSet alloc] init]; | 
| 373 |  | -    NSMutableArray<NSDictionary<NSString *, id> *> *_Nonnull serializedFrames = | 
| 374 |  | -        [[NSMutableArray alloc] init]; | 
| 375 |  | - | 
| 376 |  | -    for (NSNumber *addr in instructionsAddr) { | 
| 377 |  | -        SentryBinaryImageInfo *_Nullable image = [[[SentryDependencyContainer sharedInstance] | 
| 378 |  | -            binaryImageCache] imageByAddress:[addr unsignedLongLongValue]]; | 
| 379 |  | -        if (image != nil) { | 
| 380 |  | -            NSString *imageAddr = sentry_formatHexAddressUInt64([image address]); | 
| 381 |  | -            [imagesAddrToRetrieveDebugMetaImages addObject:imageAddr]; | 
| 382 |  | - | 
| 383 |  | -            NSDictionary<NSString *, id> *_Nonnull nativeFrame = @{ | 
| 384 |  | -                @"platform" : @"cocoa", | 
| 385 |  | -                @"instruction_addr" : sentry_formatHexAddress(addr), | 
| 386 |  | -                @"package" : [image name], | 
| 387 |  | -                @"image_addr" : imageAddr, | 
| 388 |  | -                @"in_app" : [NSNumber numberWithBool:[appPackageName isEqualToString:[image name]]], | 
| 389 |  | -            }; | 
| 390 |  | - | 
| 391 |  | -            if (shouldSymbolicateLocally) { | 
| 392 |  | -                Dl_info symbolsBuffer; | 
| 393 |  | -                bool symbols_succeed = false; | 
| 394 |  | -                symbols_succeed | 
| 395 |  | -                    = symbolicate((void *)[addr unsignedLongLongValue], &symbolsBuffer) != 0; | 
| 396 |  | -                if (symbols_succeed) { | 
| 397 |  | -                    NSMutableDictionary<NSString *, id> *_Nonnull symbolicated | 
| 398 |  | -                        = nativeFrame.mutableCopy; | 
| 399 |  | -                    symbolicated[@"symbol_addr"] | 
| 400 |  | -                        = sentry_formatHexAddressUInt64((uintptr_t)symbolsBuffer.dli_saddr); | 
| 401 |  | -                    symbolicated[@"function"] = [NSString stringWithCString:symbolsBuffer.dli_sname | 
| 402 |  | -                                                                   encoding:NSUTF8StringEncoding]; | 
| 403 |  | - | 
| 404 |  | -                    nativeFrame = symbolicated; | 
| 405 |  | -                } | 
| 406 |  | -            } | 
| 407 |  | - | 
| 408 |  | -            [serializedFrames addObject:nativeFrame]; | 
| 409 |  | -        } else { | 
| 410 |  | -            [serializedFrames addObject:@{ | 
| 411 |  | -                @"platform" : @"cocoa", | 
| 412 |  | -                @"instruction_addr" : sentry_formatHexAddress(addr), | 
| 413 |  | -            }]; | 
| 414 |  | -        } | 
| 415 |  | -    } | 
| 416 |  | - | 
| 417 |  | -    if (shouldSymbolicateLocally) { | 
| 418 |  | -        return @{ | 
| 419 |  | -            @"frames" : serializedFrames, | 
| 420 |  | -        }; | 
| 421 |  | -    } else { | 
| 422 |  | -        NSMutableArray<NSDictionary<NSString *, id> *> *_Nonnull serializedDebugMetaImages = | 
| 423 |  | -            [[NSMutableArray alloc] init]; | 
| 424 |  | - | 
| 425 |  | -        NSArray<SentryDebugMeta *> *debugMetaImages = | 
| 426 |  | -            [[[SentryDependencyContainer sharedInstance] debugImageProvider] | 
| 427 |  | -                getDebugImagesForImageAddressesFromCache:imagesAddrToRetrieveDebugMetaImages]; | 
| 428 |  | - | 
| 429 |  | -        for (SentryDebugMeta *debugImage in debugMetaImages) { | 
| 430 |  | -            [serializedDebugMetaImages addObject:[debugImage serialize]]; | 
| 431 |  | -        } | 
| 432 |  | - | 
| 433 |  | -        return @{ | 
| 434 |  | -            @"frames" : serializedFrames, | 
| 435 |  | -            @"debugMetaImages" : serializedDebugMetaImages, | 
| 436 |  | -        }; | 
| 437 |  | -    } | 
| 438 |  | -} | 
| 439 |  | - | 
| 440 | 361 | RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSDictionary *, fetchNativeStackFramesBy | 
| 441 | 362 |                                     : (NSArray *)instructionsAddr) | 
| 442 | 363 | { | 
|  | 
0 commit comments