c - Getting cpu_subtype_t in process that runs under i386 arch -
i'm using c code generate coredump file out of mach-o based process. however, i'm getting parsing corruption while loading lldb debugger after generating coredump 32bits process : (lldb) target create --core "/tmp/core_pid_1354" core file '/tmp/x/core.1354' (unknown-mach-32) loaded. this, unknown 32 architecture issue, derived wrong cpu_subtype in struct mach_header. in order cpu_type + cpu_subtype in following method : struct current_arch cpuarch = {0}; int mib[ctl_maxname]; size_t miblen; size_t cputypesize; pid_t pid = getpid(); miblen = ctl_maxname; int err = sysctlnametomib("sysctl.proc_cputype", mib, &miblen); if (err) { log_error("coultn't mib cpu type using sysctlnametomib. err = %d ", err); return kern_failure; } mib[miblen] = pid; miblen += 0x1; cputypesize = sizeof(cpuarch.type); err = sysctl(mib, (u_int)miblen, &(cpuarch.type), &cputypesize, 0x0, 0x0); if (err) { log_error("coultn...