Skip to content

Commit

Permalink
Use cached methods SentryDebugImageProvider of the Cocoa SDK (#4194)
Browse files Browse the repository at this point in the history
* Updates sentry-cocoa to 8.39.0-beta.1

* Replaces getDebugImagesForAddresses:isCrash: with getDebugImagesForImageAddressesFromCache

* Updates changelog

* Updates sentry-cocoa to 8.39.0

* Remove private function declaration
  • Loading branch information
antonis authored Nov 7, 2024
1 parent f9c38c7 commit cdf2f33
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

- Skips ignoring require cycle logs for RN 0.70 or newer ([#4214](https://github.com/getsentry/sentry-react-native/pull/4214))
- Enhanced accuracy of time-to-display spans. ([#4189](https://github.com/getsentry/sentry-react-native/pull/4189))
- Speed up getBinaryImages for finishing transactions and capturing events ([#4194](https://github.com/getsentry/sentry-react-native/pull/4194))

### Features

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#import "RNSentryTests.h"
#import <OCMock/OCMock.h>
#import <RNSentry/RNSentry.h>
#import <Sentry/SentryDebugImageProvider+HybridSDKs.h>
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>

Expand Down Expand Up @@ -327,9 +328,9 @@ - (void)prepareNativeFrameMocksWithLocalSymbolication:(BOOL)debug
OCMStub([sentryDebugImageMock serialize]).andReturn(serializedDebugImage);

id sentryDebugImageProviderMock = OCMClassMock([SentryDebugImageProvider class]);
OCMStub([sentryDebugImageProviderMock
getDebugImagesForAddresses:[NSSet setWithObject:@"0x000000000001b669"]
isCrash:false])
OCMStub(
[sentryDebugImageProviderMock
getDebugImagesForImageAddressesFromCache:[NSSet setWithObject:@"0x000000000001b669"]])
.andReturn(@[ sentryDebugImageMock ]);

OCMStub([sentryDependencyContainerMock debugImageProvider])
Expand Down
7 changes: 0 additions & 7 deletions packages/core/ios/RNSentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@

typedef int (*SymbolicateCallbackType)(const void *, Dl_info *);

@interface
SentryDebugImageProvider ()
- (NSArray<SentryDebugMeta *> *_Nonnull)getDebugImagesForAddresses:
(NSSet<NSString *> *_Nonnull)addresses
isCrash:(BOOL)isCrash;
@end

@interface
SentrySDK (Private)
@property (nonatomic, nullable, readonly, class) SentryOptions *options;
Expand Down
7 changes: 4 additions & 3 deletions packages/core/ios/RNSentry.mm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#import <Sentry/PrivateSentrySDKOnly.h>
#import <Sentry/SentryAppStartMeasurement.h>
#import <Sentry/SentryBinaryImageCache.h>
#import <Sentry/SentryDebugImageProvider+HybridSDKs.h>
#import <Sentry/SentryDependencyContainer.h>
#import <Sentry/SentryFormatter.h>
#import <Sentry/SentryOptions+HybridSDKs.h>
Expand Down Expand Up @@ -368,9 +369,9 @@ - (NSDictionary *)fetchNativeStackFramesBy:(NSArray<NSNumber *> *)instructionsAd
NSMutableArray<NSDictionary<NSString *, id> *> *_Nonnull serializedDebugMetaImages =
[[NSMutableArray alloc] init];

NSArray<SentryDebugMeta *> *debugMetaImages = [[[SentryDependencyContainer sharedInstance]
debugImageProvider] getDebugImagesForAddresses:imagesAddrToRetrieveDebugMetaImages
isCrash:false];
NSArray<SentryDebugMeta *> *debugMetaImages =
[[[SentryDependencyContainer sharedInstance] debugImageProvider]
getDebugImagesForImageAddressesFromCache:imagesAddrToRetrieveDebugMetaImages];

for (SentryDebugMeta *debugImage in debugMetaImages) {
[serializedDebugMetaImages addObject:[debugImage serialize]];
Expand Down

0 comments on commit cdf2f33

Please sign in to comment.