Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
9ee3d32
feat: Add class loaded twice validator
itaybre May 26, 2025
9711cc0
Add basic test capturing print output
itaybre May 27, 2025
be079b1
Update changelog
itaybre May 27, 2025
adb2781
Update min target version
itaybre May 27, 2025
1cf9444
Remove headers
itaybre May 28, 2025
a32f36b
Update changelog
itaybre Jun 20, 2025
b7b5028
Add basic test capturing print output
itaybre May 27, 2025
ba46cbc
Update changelog
itaybre May 27, 2025
657d709
Update min target version
itaybre May 27, 2025
7f02981
Analyze images on image load
itaybre Jun 20, 2025
104adee
Fix changelog merge conflict
itaybre Jun 23, 2025
35e81d5
Use `SentryDefaultObjCRuntimeWrapper`
itaybre Jun 23, 2025
64ecce2
Add unit tests for `LoadValidator`
itaybre Jun 23, 2025
55c6cb4
Move `SentryBinaryImageInfo` into a new file
itaybre Jun 23, 2025
295eec7
Fix import
itaybre Jun 23, 2025
c43a493
Don't use class forwarding
itaybre Jun 23, 2025
1e1c988
Add import to Hybrid module
itaybre Jun 23, 2025
2d210bc
Increase validation timeout
itaybre Jun 24, 2025
5d379fd
Use a sync function for tests
itaybre Jun 24, 2025
523ae1b
Update test
itaybre Jun 24, 2025
d3e2ccc
Update sdk_api
itaybre Jun 24, 2025
76ee1fd
Move LoadValidator out of Swift Core folder
itaybre Jun 24, 2025
006cc8f
fix rebase issues
itaybre Jul 15, 2025
1c51476
Update changelog
itaybre Jul 15, 2025
fcca74a
Fix build issue
itaybre Jul 15, 2025
b968b80
Remove import
itaybre Jul 15, 2025
ac0a4e4
Update sdk_api jsons
itaybre Jul 15, 2025
91c2423
Fix dlopen guard
itaybre Jul 15, 2025
af8cf11
Change diagnostic level to debug in unit tests
itaybre Jul 15, 2025
08ddd62
Improve captude of stdout
itaybre Jul 15, 2025
5eba980
Update tests plan to run unit tests first
itaybre Jul 15, 2025
d7e0a25
Disable tests parallelization
itaybre Jul 16, 2025
fecaf1e
Increase timeout due to CI slowness
itaybre Jul 16, 2025
c949342
Reset sdk_api.json to main
itaybre Jul 16, 2025
b0039ae
Remove `SentryBinaryImageInfo` from modulemap
itaybre Jul 16, 2025
7d50f53
chore: add duplicated binary test harness to workspace (#5646)
armcknight Jul 17, 2025
044a4ab
Apply PR review suggestions
itaybre Jul 17, 2025
8525972
Move SentryBinaryImageInfo to HybridPublic
itaybre Jul 17, 2025
f518833
Add isDebug paramter to `SentryBinaryImageCache`
itaybre Jul 17, 2025
14845ce
Update broken tests
itaybre Jul 17, 2025
8a15d9d
Avoid nesting
itaybre Jul 17, 2025
824b8bb
Fix test
itaybre Jul 17, 2025
ecb266c
Fix SentryBinaryImageInfo not available for swift by receiving the pa…
itaybre Jul 17, 2025
6ca1401
Add comment referencing `SentrySubClassFinder`
itaybre Jul 17, 2025
cd22e23
Log an error instead of a warning
itaybre Jul 17, 2025
d93af26
Fix unit test
itaybre Jul 17, 2025
bc00b81
Set debug value before registering the callback
itaybre Jul 17, 2025
fdba521
Update stability jsons
itaybre Jul 17, 2025
6941b12
Remove import
itaybre Jul 17, 2025
75e0130
Remove unnecesarry impot
itaybre Jul 17, 2025
79b92b1
Revert extracting `SentryBinaryImageInfo` to a new file
itaybre Jul 18, 2025
7234ba6
Revert extracting `SentryBinaryImageInfo` to a new file
itaybre Jul 18, 2025
063959a
Use hasPrefix and update simulator ignored path to `/Library/Develope…
itaybre Jul 18, 2025
a61df55
Fix typo
itaybre Jul 18, 2025
f7f9eb8
Update tests
itaybre Jul 18, 2025
f740109
Fix support for Xcode 14.0
itaybre Jul 19, 2025
c0ab737
Pass dispatchQueueWrapper as an argument
itaybre Jul 21, 2025
47958f9
Update CHANGELOG and modify imports in SentryPrivate.h
itaybre Jul 21, 2025
6379a7a
Fix target module for `SomeWork` class
itaybre Jul 21, 2025
b6d2b2d
Add comments to clarify validation logic in SentryBinaryImageCache an…
itaybre Jul 22, 2025
62a7835
Bump diffMax to 885kb
itaybre Jul 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Features

- Add experimental support for capturing structured logs via `SentrySDK.logger` (#5532, #5593, #5639, #5628, #5637)
- The SDK will show a warning in the console if it detects it was loaded twice (#5298)

### Improvements

Expand Down
162 changes: 162 additions & 0 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,9 @@
F41362112E1C55AF00B84443 /* SentryScopePersistentStore+Tags.swift in Sources */ = {isa = PBXBuildFile; fileRef = F41362102E1C55AF00B84443 /* SentryScopePersistentStore+Tags.swift */; };
F41362132E1C566100B84443 /* SentryScopePersistentStore+User.swift in Sources */ = {isa = PBXBuildFile; fileRef = F41362122E1C566100B84443 /* SentryScopePersistentStore+User.swift */; };
F41362152E1C568400B84443 /* SentryScopePersistentStore+Context.swift in Sources */ = {isa = PBXBuildFile; fileRef = F41362142E1C568400B84443 /* SentryScopePersistentStore+Context.swift */; };
F443DB272E09BE8C009A9045 /* LoadValidatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F443DB262E09BE8C009A9045 /* LoadValidatorTests.swift */; };
F44858132E03579D0013E63B /* SentryCrashDynamicLinker+Test.h in Headers */ = {isa = PBXBuildFile; fileRef = F44858122E0357940013E63B /* SentryCrashDynamicLinker+Test.h */; };
F451FAA62E0B304E0050ACF2 /* LoadValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F451FAA52E0B304E0050ACF2 /* LoadValidator.swift */; };
F452437E2DE60B71003E8F50 /* SentryUseNSExceptionCallstackWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = F452437D2DE60B71003E8F50 /* SentryUseNSExceptionCallstackWrapper.m */; };
F45243882DE65968003E8F50 /* ExceptionCatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = F45243872DE65968003E8F50 /* ExceptionCatcher.m */; };
F45243892DE65968003E8F50 /* ExceptionCatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = F45243872DE65968003E8F50 /* ExceptionCatcher.m */; };
Expand Down Expand Up @@ -1127,6 +1129,41 @@
remoteGlobalIDString = 63AA759A1EB8AEF500D153DE;
remoteInfo = "Sentry-iOS";
};
846D3F262E286ECF00D4E7E3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 846D3F102E286ECF00D4E7E3 /* DuplicatedSDKTest.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = D8C030CE2CEF633A007FC5B4;
remoteInfo = DuplicatedSDKTest;
};
846D3F282E286ECF00D4E7E3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 846D3F102E286ECF00D4E7E3 /* DuplicatedSDKTest.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = D89DD6362CEF650A009C3509;
remoteInfo = ModuleA;
};
846D3F2A2E286ECF00D4E7E3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 846D3F102E286ECF00D4E7E3 /* DuplicatedSDKTest.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = D89DD6482CEF6516009C3509;
remoteInfo = ModuleB;
};
846D3F2C2E286ECF00D4E7E3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 846D3F102E286ECF00D4E7E3 /* DuplicatedSDKTest.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = D89DD6732CEF7ADF009C3509;
remoteInfo = "UITest-DuplicatedSDK";
};
846D3F2E2E286ECF00D4E7E3 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 846D3F102E286ECF00D4E7E3 /* DuplicatedSDKTest.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F45243122DE56862003E8F50;
remoteInfo = "Unit Tests";
};
84B7FA3729B2860500AD93B1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6327C5CA1EB8A783004E799B /* Project object */;
Expand Down Expand Up @@ -1941,6 +1978,13 @@
845CEAEE2D83F79500B6B325 /* SentryProfilingPublicAPITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryProfilingPublicAPITests.swift; sourceTree = "<group>"; };
845CEB162D8A979700B6B325 /* SentryAppStartProfilingConfigurationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryAppStartProfilingConfigurationTests.swift; sourceTree = "<group>"; };
846628B82DF0E52C00F11CD9 /* Brewfile-ci-format */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = "Brewfile-ci-format"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
846D3F092E286ECF00D4E7E3 /* DuplicatedSDKTest-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DuplicatedSDKTest-Bridging-Header.h"; sourceTree = "<group>"; };
846D3F0A2E286ECF00D4E7E3 /* DuplicatedSDKTestApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuplicatedSDKTestApp.swift; sourceTree = "<group>"; };
846D3F0B2E286ECF00D4E7E3 /* SomeWork.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SomeWork.swift; sourceTree = "<group>"; };
846D3F0C2E286ECF00D4E7E3 /* UITest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITest.swift; sourceTree = "<group>"; };
846D3F0E2E286ECF00D4E7E3 /* Unit_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Unit_Tests.swift; sourceTree = "<group>"; };
846D3F102E286ECF00D4E7E3 /* DuplicatedSDKTest.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = DuplicatedSDKTest.xcodeproj; sourceTree = "<group>"; };
846D3F112E286ECF00D4E7E3 /* DuplicatedSDKTest.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = DuplicatedSDKTest.xctestplan; sourceTree = "<group>"; };
846F90332D56F59D009E86C1 /* Brewfile-ci-deploy */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; path = "Brewfile-ci-deploy"; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
8482FA992DD7C397000E9283 /* SentryFeedbackAPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryFeedbackAPI.h; path = ../../../Sentry/Public/SentryFeedbackAPI.h; sourceTree = "<group>"; };
8482FA9A2DD7C397000E9283 /* SentryFeedbackAPI.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SentryFeedbackAPI.m; path = ../../../Sentry/SentryFeedbackAPI.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2320,7 +2364,9 @@
F41362102E1C55AF00B84443 /* SentryScopePersistentStore+Tags.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SentryScopePersistentStore+Tags.swift"; sourceTree = "<group>"; };
F41362122E1C566100B84443 /* SentryScopePersistentStore+User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SentryScopePersistentStore+User.swift"; sourceTree = "<group>"; };
F41362142E1C568400B84443 /* SentryScopePersistentStore+Context.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SentryScopePersistentStore+Context.swift"; sourceTree = "<group>"; };
F443DB262E09BE8C009A9045 /* LoadValidatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadValidatorTests.swift; sourceTree = "<group>"; };
F44858122E0357940013E63B /* SentryCrashDynamicLinker+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentryCrashDynamicLinker+Test.h"; sourceTree = "<group>"; };
F451FAA52E0B304E0050ACF2 /* LoadValidator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadValidator.swift; sourceTree = "<group>"; };
F452437D2DE60B71003E8F50 /* SentryUseNSExceptionCallstackWrapper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryUseNSExceptionCallstackWrapper.m; sourceTree = "<group>"; };
F45243862DE65968003E8F50 /* ExceptionCatcher.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExceptionCatcher.h; sourceTree = "<group>"; };
F45243872DE65968003E8F50 /* ExceptionCatcher.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExceptionCatcher.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2542,6 +2588,7 @@
62872B602BA1B84400A4FA7D /* Swift */ = {
isa = PBXGroup;
children = (
F443DB242E09BE61009A9045 /* Core */,
62872B612BA1B84C00A4FA7D /* Extensions */,
);
path = Swift;
Expand Down Expand Up @@ -2714,6 +2761,7 @@
6304360C1EC05CEF00C4D3FA /* Frameworks */,
6327C5D41EB8A783004E799B /* Products */,
7D826E3C2390840E00EED93D /* Utils */,
F474CB872E2EC5040001DF41 /* Recovered References */,
);
indentWidth = 4;
sourceTree = "<group>";
Expand Down Expand Up @@ -2909,6 +2957,7 @@
844DA7F6282435CD00E6B62E /* README.md */,
630C01951EC341D600C52CEF /* Resources */,
63AA76AA1EB9D5CD00D153DE /* Configuration */,
846D3F122E286ECF00D4E7E3 /* DuplicatedSDKTest */,
63AA75931EB8AEDB00D153DE /* SentryTests */,
8431EFDB29B27B3D00D8DC56 /* SentryProfilerTests */,
D8F01DE32A125D7B008F4996 /* HybridSDKTest */,
Expand Down Expand Up @@ -3976,6 +4025,48 @@
path = Feedback;
sourceTree = "<group>";
};
846D3F0D2E286ECF00D4E7E3 /* DuplicatedSDKTest */ = {
isa = PBXGroup;
children = (
846D3F092E286ECF00D4E7E3 /* DuplicatedSDKTest-Bridging-Header.h */,
846D3F0A2E286ECF00D4E7E3 /* DuplicatedSDKTestApp.swift */,
846D3F0B2E286ECF00D4E7E3 /* SomeWork.swift */,
846D3F0C2E286ECF00D4E7E3 /* UITest.swift */,
);
path = DuplicatedSDKTest;
sourceTree = "<group>";
};
846D3F0F2E286ECF00D4E7E3 /* Unit Tests */ = {
isa = PBXGroup;
children = (
846D3F0E2E286ECF00D4E7E3 /* Unit_Tests.swift */,
);
path = "Unit Tests";
sourceTree = "<group>";
};
846D3F122E286ECF00D4E7E3 /* DuplicatedSDKTest */ = {
isa = PBXGroup;
children = (
846D3F0D2E286ECF00D4E7E3 /* DuplicatedSDKTest */,
846D3F0F2E286ECF00D4E7E3 /* Unit Tests */,
846D3F102E286ECF00D4E7E3 /* DuplicatedSDKTest.xcodeproj */,
846D3F112E286ECF00D4E7E3 /* DuplicatedSDKTest.xctestplan */,
);
path = DuplicatedSDKTest;
sourceTree = "<group>";
};
846D3F132E286ECF00D4E7E3 /* Products */ = {
isa = PBXGroup;
children = (
846D3F272E286ECF00D4E7E3 /* DuplicatedSDKTest.app */,
846D3F292E286ECF00D4E7E3 /* ModuleA.framework */,
846D3F2B2E286ECF00D4E7E3 /* ModuleB.framework */,
846D3F2D2E286ECF00D4E7E3 /* UITest-DuplicatedSDK.xctest */,
846D3F2F2E286ECF00D4E7E3 /* Unit Tests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
847B1A002C618ACA002CB1F3 /* UserFeedback */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -4359,6 +4450,7 @@
children = (
92235CAD2E15549C00865983 /* SentryLogger.swift */,
92235CAB2E15369900865983 /* SentryLogBatcher.swift */,
F451FAA52E0B304E0050ACF2 /* LoadValidator.swift */,
FA90FAFC2E070A3B008CAAE8 /* SentryURLRequestFactory.swift */,
FA67DCC02DDBD4C800896B02 /* SentrySDKLog+Configure.swift */,
FA3734812E0EEA670091EF24 /* SentryScreenshot.swift */,
Expand Down Expand Up @@ -4586,6 +4678,30 @@
path = HybridSDKTest;
sourceTree = "<group>";
};
F443DB242E09BE61009A9045 /* Core */ = {
isa = PBXGroup;
children = (
F443DB252E09BE67009A9045 /* Tools */,
);
path = Core;
sourceTree = "<group>";
};
F443DB252E09BE67009A9045 /* Tools */ = {
isa = PBXGroup;
children = (
F443DB262E09BE8C009A9045 /* LoadValidatorTests.swift */,
);
path = Tools;
sourceTree = "<group>";
};
F474CB872E2EC5040001DF41 /* Recovered References */ = {
isa = PBXGroup;
children = (
926C89722E26A30C006F3154 /* SentryScope+PrivateSwift.h */,
);
name = "Recovered References";
sourceTree = "<group>";
};
FA67DCC62DDBD4EA00896B02 /* Extensions */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -5294,6 +5410,12 @@
);
productRefGroup = 6327C5D41EB8A783004E799B /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 846D3F132E286ECF00D4E7E3 /* Products */;
ProjectRef = 846D3F102E286ECF00D4E7E3 /* DuplicatedSDKTest.xcodeproj */;
},
);
projectRoot = "";
targets = (
63AA759A1EB8AEF500D153DE /* Sentry */,
Expand All @@ -5308,6 +5430,44 @@
};
/* End PBXProject section */

/* Begin PBXReferenceProxy section */
846D3F272E286ECF00D4E7E3 /* DuplicatedSDKTest.app */ = {
isa = PBXReferenceProxy;
fileType = wrapper.application;
path = DuplicatedSDKTest.app;
remoteRef = 846D3F262E286ECF00D4E7E3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
846D3F292E286ECF00D4E7E3 /* ModuleA.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = ModuleA.framework;
remoteRef = 846D3F282E286ECF00D4E7E3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
846D3F2B2E286ECF00D4E7E3 /* ModuleB.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = ModuleB.framework;
remoteRef = 846D3F2A2E286ECF00D4E7E3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
846D3F2D2E286ECF00D4E7E3 /* UITest-DuplicatedSDK.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = "UITest-DuplicatedSDK.xctest";
remoteRef = 846D3F2C2E286ECF00D4E7E3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
846D3F2F2E286ECF00D4E7E3 /* Unit Tests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = "Unit Tests.xctest";
remoteRef = 846D3F2E2E286ECF00D4E7E3 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
63AA75991EB8AEF500D153DE /* Resources */ = {
isa = PBXResourcesBuildPhase;
Expand Down Expand Up @@ -5462,6 +5622,7 @@
63AA769E1EB9C57A00D153DE /* SentryError.mm in Sources */,
7B8713B026415B22006D6004 /* SentryAppStartTrackingIntegration.m in Sources */,
8E133FA225E72DEF00ABD0BF /* SentrySamplingContext.m in Sources */,
F451FAA62E0B304E0050ACF2 /* LoadValidator.swift in Sources */,
D81988C02BEBFFF70020E36C /* SentryReplayRecording.swift in Sources */,
7B6C5F8726034395007F7DFF /* SentryWatchdogTerminationLogic.m in Sources */,
7BBC827125DFD039005F1ED8 /* SentryInAppLogic.m in Sources */,
Expand Down Expand Up @@ -6012,6 +6173,7 @@
7BDDE3CC2966BD4700EB9177 /* SentryMXManagerTests.swift in Sources */,
7BC6EC0C255C3DF80059822A /* SentryThreadTests.swift in Sources */,
D42E48572D48DF1600D251BC /* SentryBuildAppStartSpansTests.swift in Sources */,
F443DB272E09BE8C009A9045 /* LoadValidatorTests.swift in Sources */,
D884A20527C80F6300074664 /* SentryCoreDataTrackerTest.swift in Sources */,
8E70B10125CB8695002B3155 /* SentrySpanIdTests.swift in Sources */,
62E2119A2DAE99FC007D7262 /* SentryAsyncSafeLog.m in Sources */,
Expand Down
18 changes: 17 additions & 1 deletion Sources/Sentry/SentryBinaryImageCache.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#import "SentryBinaryImageCache.h"
#import "SentryCrashBinaryImageCache.h"
#include "SentryCrashUUIDConversion.h"
#import "SentryDefaultObjCRuntimeWrapper.h"
#import "SentryDependencyContainer.h"
#import "SentryInAppLogic.h"
#import "SentryLogC.h"
#import "SentrySDK+Private.h"
#import "SentrySwift.h"

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -16,15 +19,17 @@ @implementation SentryBinaryImageInfo

@interface SentryBinaryImageCache ()
@property (nonatomic, strong, nullable) NSMutableArray<SentryBinaryImageInfo *> *cache;
@property (nonatomic, assign) BOOL isDebug;
- (void)binaryImageAdded:(const SentryCrashBinaryImage *)image;
- (void)binaryImageRemoved:(const SentryCrashBinaryImage *)image;
@end

@implementation SentryBinaryImageCache

- (void)start
- (void)start:(BOOL)isDebug
{
@synchronized(self) {
_isDebug = isDebug;
_cache = [NSMutableArray array];
sentrycrashbic_registerAddedCallback(&binaryImageWasAdded);
sentrycrashbic_registerRemovedCallback(&binaryImageWasRemoved);
Expand Down Expand Up @@ -83,6 +88,17 @@ - (void)binaryImageAdded:(const SentryCrashBinaryImage *)image

[_cache insertObject:newImage atIndex:left];
}

if (self.isDebug) {
// This validation adds some overhead with each class present in the image, so we only
// run this when debug is enabled. A non main queue is used to avoid affecting the UI.
[LoadValidator
checkForDuplicatedSDKWithImageName:imageName
imageAddress:@(newImage.address)
imageSize:@(newImage.size)
dispatchQueueWrapper:[[SentryDependencyContainer sharedInstance]
dispatchQueueWrapper]];
}
}

+ (NSString *_Nullable)convertUUID:(const unsigned char *const)value
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentrySDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ + (void)startWithOptions:(SentryOptions *)options
[SentrySDK setCurrentHub:hub];

[SentryCrashWrapper.sharedInstance startBinaryImageCache];
[SentryDependencyContainer.sharedInstance.binaryImageCache start];
[SentryDependencyContainer.sharedInstance.binaryImageCache start:options.debug];

[SentrySDK installIntegrations];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
@interface SentryBinaryImageCache : NSObject

- (void)start;
- (void)start:(BOOL)isDebug;

- (void)stop;

Expand Down
1 change: 1 addition & 0 deletions Sources/Sentry/include/SentryPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#import "SentryCrashExceptionApplicationHelper.h"
#import "SentryEventSwiftHelper.h"
#import "SentryNSDataUtils.h"
#import "SentryObjCRuntimeWrapper.h"
#import "SentryRandom.h"
#import "SentryTime.h"
#import "SentryUserAccess.h"
Expand Down
Loading
Loading