mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-25 01:22:41 +00:00
Pulled architecture detection out into a separate method to eliminate duplicate code.
Added break for CPU_SUBTYPE_ARM_V8 to avoid falling through to the default case.
This commit is contained in:
parent
955fe9c2eb
commit
aeb64a7da4
@ -360,59 +360,7 @@ NSInteger binaryImageSort(id binary1, id binary2, void *context);
|
||||
uuid = @"???";
|
||||
|
||||
/* Determine the architecture string */
|
||||
NSString *archName = @"???";
|
||||
if (imageInfo.codeType != nil && imageInfo.codeType.typeEncoding == PLCrashReportProcessorTypeEncodingMach) {
|
||||
switch (imageInfo.codeType.type) {
|
||||
case CPU_TYPE_ARM:
|
||||
/* Apple includes subtype for ARM binaries. */
|
||||
switch (imageInfo.codeType.subtype) {
|
||||
case CPU_SUBTYPE_ARM_V6:
|
||||
archName = @"armv6";
|
||||
break;
|
||||
|
||||
case CPU_SUBTYPE_ARM_V7:
|
||||
archName = @"armv7";
|
||||
break;
|
||||
|
||||
case CPU_SUBTYPE_ARM_V7S:
|
||||
archName = @"armv7s";
|
||||
break;
|
||||
|
||||
default:
|
||||
archName = @"arm-unknown";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case CPU_TYPE_ARM64:
|
||||
/* Apple includes subtype for ARM64 binaries. */
|
||||
switch (imageInfo.codeType.subtype) {
|
||||
case CPU_SUBTYPE_ARM_V8:
|
||||
archName = @"arm64";
|
||||
|
||||
default:
|
||||
archName = @"arm64-unknown";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case CPU_TYPE_X86:
|
||||
archName = @"i386";
|
||||
break;
|
||||
|
||||
case CPU_TYPE_X86_64:
|
||||
archName = @"x86_64";
|
||||
break;
|
||||
|
||||
case CPU_TYPE_POWERPC:
|
||||
archName = @"powerpc";
|
||||
break;
|
||||
|
||||
default:
|
||||
// Use the default archName value (initialized above).
|
||||
break;
|
||||
}
|
||||
}
|
||||
NSString *archName = [self archNameFromImageInfo:imageInfo];
|
||||
|
||||
/* Determine if this is the main executable or an app specific framework*/
|
||||
NSString *binaryDesignator = @" ";
|
||||
@ -472,6 +420,30 @@ NSInteger binaryImageSort(id binary1, id binary2, void *context);
|
||||
uuid = @"???";
|
||||
|
||||
/* Determine the architecture string */
|
||||
NSString *archName = [self archNameFromImageInfo:imageInfo];
|
||||
|
||||
/* Determine if this is the app executable or app specific framework */
|
||||
NSString *imagePath = [imageInfo.imageName stringByStandardizingPath];
|
||||
NSString *appBundleContentsPath = [[report.processInfo.processPath stringByDeletingLastPathComponent] stringByDeletingLastPathComponent];
|
||||
NSString *imageType = @"";
|
||||
|
||||
if ([imageInfo.imageName isEqual: report.processInfo.processPath]) {
|
||||
imageType = @"app";
|
||||
} else {
|
||||
imageType = @"framework";
|
||||
}
|
||||
|
||||
if ([imagePath isEqual: report.processInfo.processPath] || [imagePath hasPrefix:appBundleContentsPath]) {
|
||||
[appUUIDs addObject:@{kBITBinaryImageKeyUUID: uuid, kBITBinaryImageKeyArch: archName, kBITBinaryImageKeyType: imageType}];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return appUUIDs;
|
||||
}
|
||||
|
||||
+ (NSString *)archNameFromImageInfo:(BITPLCrashReportBinaryImageInfo *)imageInfo
|
||||
{
|
||||
NSString *archName = @"???";
|
||||
if (imageInfo.codeType != nil && imageInfo.codeType.typeEncoding == PLCrashReportProcessorTypeEncodingMach) {
|
||||
switch (imageInfo.codeType.type) {
|
||||
@ -501,6 +473,7 @@ NSInteger binaryImageSort(id binary1, id binary2, void *context);
|
||||
switch (imageInfo.codeType.subtype) {
|
||||
case CPU_SUBTYPE_ARM_V8:
|
||||
archName = @"arm64";
|
||||
break;
|
||||
|
||||
default:
|
||||
archName = @"arm64-unknown";
|
||||
@ -526,24 +499,7 @@ NSInteger binaryImageSort(id binary1, id binary2, void *context);
|
||||
}
|
||||
}
|
||||
|
||||
/* Determine if this is the app executable or app specific framework */
|
||||
NSString *imagePath = [imageInfo.imageName stringByStandardizingPath];
|
||||
NSString *appBundleContentsPath = [[report.processInfo.processPath stringByDeletingLastPathComponent] stringByDeletingLastPathComponent];
|
||||
NSString *imageType = @"";
|
||||
|
||||
if ([imageInfo.imageName isEqual: report.processInfo.processPath]) {
|
||||
imageType = @"app";
|
||||
} else {
|
||||
imageType = @"framework";
|
||||
}
|
||||
|
||||
if ([imagePath isEqual: report.processInfo.processPath] || [imagePath hasPrefix:appBundleContentsPath]) {
|
||||
[appUUIDs addObject:@{kBITBinaryImageKeyUUID: uuid, kBITBinaryImageKeyArch: archName, kBITBinaryImageKeyType: imageType}];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return appUUIDs;
|
||||
return archName;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user