]> git.saurik.com Git - apple/xnu.git/blobdiff - tools/tests/execperf/printexecinfo.c
xnu-2782.20.48.tar.gz
[apple/xnu.git] / tools / tests / execperf / printexecinfo.c
index 5dfcd6bb74dbc007ae5467d60d7b0c631b348373..1baefb9222c9efa134f3a1e815df59aa2155b38a 100644 (file)
@@ -5,6 +5,7 @@
 #include <mach/mach.h>
 #include <mach-o/ldsyms.h>
 #include <mach-o/dyld_images.h>
+#include <mach-o/arch.h>
 #include <stdlib.h>
 #include <sys/sysctl.h>
 
@@ -31,8 +32,14 @@ void printexecinfo(void)
        int ret;
        uint64_t stackaddr;
        size_t len = sizeof(stackaddr);
+       const NXArchInfo *arch = NXGetArchInfoFromCpuType(_mh_execute_header.cputype, _mh_execute_header.cpusubtype & ~CPU_SUBTYPE_MASK);
 
        printf("executable load address = 0x%016llx\n", (uint64_t)(uintptr_t)&_mh_execute_header);
+       printf("executable cputype 0x%08x cpusubtype 0x%08x (%s:%s)\n",
+                  _mh_execute_header.cputype,
+                  _mh_execute_header.cpusubtype,
+                  arch ? arch->name : "unknown",
+                  arch ? arch->description : "unknown");
 
        ret = sysctlbyname("kern.usrstack64", &stackaddr, &len, NULL, 0);
        if (ret == -1)