From 2c82b7b10272e3335b76070fc437a77e69d97045 Mon Sep 17 00:00:00 2001 From: Gerrit Goossen Date: Fri, 20 Dec 2024 13:39:00 -0800 Subject: [PATCH] Fix crash log discovery 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 --- FBControlCore/Crashes/FBCrashLog.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FBControlCore/Crashes/FBCrashLog.m b/FBControlCore/Crashes/FBCrashLog.m index f7fc37b82..4be72a651 100644 --- a/FBControlCore/Crashes/FBCrashLog.m +++ b/FBControlCore/Crashes/FBCrashLog.m @@ -279,7 +279,7 @@ - (nullable NSString *)loadRawCrashLogStringWithError:(NSError **)error; for (NSString *basePath in self.diagnosticReportsPaths) { NSArray *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; @@ -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 *)extensions { NSFileManager *fileManager = NSFileManager.defaultManager; NSPredicate *datePredicate = [NSPredicate predicateWithValue:YES]; @@ -389,7 +389,7 @@ + (NSPredicate *)predicateForFilesWithBasePath:(NSString *)basePath afterDate:(N }]; } return [NSCompoundPredicate andPredicateWithSubpredicates:@[ - [NSPredicate predicateWithFormat:@"pathExtension == %@", extension], + [NSPredicate predicateWithFormat:@"pathExtension in %@", extensions], datePredicate ]]; }