Skip to content

Commit

Permalink
Fix crash log discovery
Browse files Browse the repository at this point in the history
Summary: IDB's search for crash logs has been failing because it's looking for files that have the wrong extension. This diff improves the search logic to look for multiple file extensions (including the more recent '.ips' extension). This fixes crash log discovery on newer versions of macOS.

Differential Revision: D67539229

fbshipit-source-id: 3849e7d1e965d6775127ad483fce436b59d8825c
  • Loading branch information
fbgerrit authored and facebook-github-bot committed Dec 20, 2024
1 parent 25d6f3f commit 2c82b7b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions FBControlCore/Crashes/FBCrashLog.m
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ - (nullable NSString *)loadRawCrashLogStringWithError:(NSError **)error;
for (NSString *basePath in self.diagnosticReportsPaths) {
NSArray<FBCrashLogInfo *> *crashInfos = [[FBConcurrentCollectionOperations
filterMap:[NSFileManager.defaultManager contentsOfDirectoryAtPath:basePath error:nil]
predicate:[FBCrashLogInfo predicateForFilesWithBasePath:basePath afterDate:date withExtension:@"crash"]
predicate:[FBCrashLogInfo predicateForFilesWithBasePath:basePath afterDate:date withExtensions:@[@"crash", @"ips"]]
map:^ FBCrashLogInfo * (NSString *fileName) {
NSString *path = [basePath stringByAppendingPathComponent:fileName];
NSError *error = nil;
Expand Down Expand Up @@ -377,7 +377,7 @@ + (FBCrashLogInfoProcessType)processTypeForExecutablePath:(NSString *)executable
return FBCrashLogInfoProcessTypeCustom;
}

+ (NSPredicate *)predicateForFilesWithBasePath:(NSString *)basePath afterDate:(NSDate *)date withExtension:(NSString *)extension
+ (NSPredicate *)predicateForFilesWithBasePath:(NSString *)basePath afterDate:(NSDate *)date withExtensions:(NSArray<NSString *> *)extensions
{
NSFileManager *fileManager = NSFileManager.defaultManager;
NSPredicate *datePredicate = [NSPredicate predicateWithValue:YES];
Expand All @@ -389,7 +389,7 @@ + (NSPredicate *)predicateForFilesWithBasePath:(NSString *)basePath afterDate:(N
}];
}
return [NSCompoundPredicate andPredicateWithSubpredicates:@[
[NSPredicate predicateWithFormat:@"pathExtension == %@", extension],
[NSPredicate predicateWithFormat:@"pathExtension in %@", extensions],
datePredicate
]];
}
Expand Down

0 comments on commit 2c82b7b

Please sign in to comment.