[Lldb-commits] [lldb] r213004 - lldb.LLDB_ARCH_DEFAULT now works correctly on Macs with haswell enabled kernels.

Greg Clayton gclayton at apple.com
Mon Jul 14 15:53:02 PDT 2014


Author: gclayton
Date: Mon Jul 14 17:53:02 2014
New Revision: 213004

URL: http://llvm.org/viewvc/llvm-project?rev=213004&view=rev
Log:
lldb.LLDB_ARCH_DEFAULT now works correctly on Macs with haswell enabled kernels.

<rdar://problem/17604133>


Modified:
    lldb/trunk/source/Core/ArchSpec.cpp
    lldb/trunk/source/Host/common/Host.cpp

Modified: lldb/trunk/source/Core/ArchSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ArchSpec.cpp?rev=213004&r1=213003&r2=213004&view=diff
==============================================================================
--- lldb/trunk/source/Core/ArchSpec.cpp (original)
+++ lldb/trunk/source/Core/ArchSpec.cpp Mon Jul 14 17:53:02 2014
@@ -962,6 +962,15 @@ cores_match (const ArchSpec::Core core1,
             try_inverse = false;
         }
         break;
+            
+    case ArchSpec::eCore_x86_64_x86_64h:
+        if (!enforce_exact_match)
+        {
+            try_inverse = false;
+            if (core2 == ArchSpec::eCore_x86_64_x86_64)
+                return true;
+        }
+        break;
 
     default:
         break;

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=213004&r1=213003&r2=213004&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Mon Jul 14 17:53:02 2014
@@ -344,26 +344,32 @@ Host::GetArchitecture (SystemDefaultArch
             
             if (is_64_bit_capable)
             {
-#if defined (__i386__) || defined (__x86_64__)
-                if (cpusubtype == CPU_SUBTYPE_486)
-                    cpusubtype = CPU_SUBTYPE_I386_ALL;
-#endif
                 if (cputype & CPU_ARCH_ABI64)
                 {
                     // We have a 64 bit kernel on a 64 bit system
-                    g_host_arch_32.SetArchitecture (eArchTypeMachO, ~(CPU_ARCH_MASK) & cputype, cpusubtype);
                     g_host_arch_64.SetArchitecture (eArchTypeMachO, cputype, cpusubtype);
                 }
                 else
                 {
-                    // We have a 32 bit kernel on a 64 bit system
-                    g_host_arch_32.SetArchitecture (eArchTypeMachO, cputype, cpusubtype);
-                    cputype |= CPU_ARCH_ABI64;
-                    g_host_arch_64.SetArchitecture (eArchTypeMachO, cputype, cpusubtype);
+                    // We have a 64 bit kernel that is returning a 32 bit cputype, the
+                    // cpusubtype will be correct as if it were for a 64 bit architecture
+                    g_host_arch_64.SetArchitecture (eArchTypeMachO, cputype | CPU_ARCH_ABI64, cpusubtype);
                 }
+                
+                // Now we need modify the cpusubtype for the 32 bit slices.
+                uint32_t cpusubtype32 = cpusubtype;
+#if defined (__i386__) || defined (__x86_64__)
+                if (cpusubtype == CPU_SUBTYPE_486 || cpusubtype == CPU_SUBTYPE_X86_64_H)
+                    cpusubtype32 = CPU_SUBTYPE_I386_ALL;
+#elif defined (__arm__) || defined (__arm64__) || defined (__aarch64__)
+                if (cputype == CPU_TYPE_ARM || cputype == CPU_TYPE_ARM64)
+                    cpusubtype32 = CPU_SUBTYPE_ARM_V7S;
+#endif
+                g_host_arch_32.SetArchitecture (eArchTypeMachO, cputype & ~(CPU_ARCH_MASK), cpusubtype32);
             }
             else
             {
+                // We have a 32 bit kernel on a 32 bit system
                 g_host_arch_32.SetArchitecture (eArchTypeMachO, cputype, cpusubtype);
                 g_host_arch_64.Clear();
             }





More information about the lldb-commits mailing list