Crash log contains \"Binary Images\" section with information about architecture (armv6/armv7) and identifier of all loaded modules. How to determine this information at run
We can use sysctl, sysctlbyname system call to get or set system information.
Sample code:
#import
#import
int32_t value = 0;
size_t length = sizeof(value);
sysctlbyname("hw.cputype", &value, &length, NULL, 0);
if (value == CPU_TYPE_ARM64) {
// arm64
}
else if (value == CPU_TYPE_ARM) {
// armv7/armv7s
}
else if (value == CPU_TYPE_X86) {
// simulator
}
I just list most common arch at 2016. Look for "hw.cpusubtype" to get more detial, like CPU_SUBTYPE_ARM_V6 CPU_SUBTYPE_ARM_V7 CPU_SUBTYPE_ARM_V7S