Hi clayborg, vharron,

TargetList::CreateTargetInternal() will only select the current Platform. A 
previous patch always sets platform_sp to the current Platform, so a check 
later to see if platform_sp was not defined always failed, and the current 
Platform was used. This patch removes that check, so if the current Platform is 
not compatible with the target architecture, CreateTargetInternal() will call 
Platform::GetPlatformForArchitecture() to select a compatible Platform.

Vince, remote linux tests (Ubuntu -> remote Ubuntu) pass the same with and 
without this patch.

http://reviews.llvm.org/D8749

Files:
  source/Target/TargetList.cpp

Index: source/Target/TargetList.cpp
===================================================================
--- source/Target/TargetList.cpp
+++ source/Target/TargetList.cpp
@@ -293,32 +293,27 @@
         }
     }
 
-    if (!platform_sp)
+    // If we have a valid architecture, make sure the current platform is
+    // compatible with that architecture
+    if (!prefer_platform_arch && arch.IsValid())
     {
-        // Get the current platform and make sure it is compatible with the
-        // current architecture if we have a valid architecture.
-        platform_sp = debugger.GetPlatformList().GetSelectedPlatform ();
-        
-        if (!prefer_platform_arch && arch.IsValid())
+        if (!platform_sp->IsCompatibleArchitecture(arch, false, 
&platform_arch))
         {
-            if (!platform_sp->IsCompatibleArchitecture(arch, false, 
&platform_arch))
-            {
-                platform_sp = Platform::GetPlatformForArchitecture(arch, 
&platform_arch);
-                if (platform_sp)
-                    
debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
-            }
+            platform_sp = Platform::GetPlatformForArchitecture(arch, 
&platform_arch);
+            if (platform_sp)
+                debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
         }
-        else if (platform_arch.IsValid())
+    }
+    else if (platform_arch.IsValid())
+    {
+        // if "arch" isn't valid, yet "platform_arch" is, it means we have an 
executable file with
+        // a single architecture which should be used
+        ArchSpec fixed_platform_arch;
+        if (!platform_sp->IsCompatibleArchitecture(platform_arch, false, 
&fixed_platform_arch))
         {
-            // if "arch" isn't valid, yet "platform_arch" is, it means we have 
an executable file with
-            // a single architecture which should be used
-            ArchSpec fixed_platform_arch;
-            if (!platform_sp->IsCompatibleArchitecture(platform_arch, false, 
&fixed_platform_arch))
-            {
-                platform_sp = 
Platform::GetPlatformForArchitecture(platform_arch, &fixed_platform_arch);
-                if (platform_sp)
-                    
debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
-            }
+            platform_sp = Platform::GetPlatformForArchitecture(platform_arch, 
&fixed_platform_arch);
+            if (platform_sp)
+                debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
         }
     }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: source/Target/TargetList.cpp
===================================================================
--- source/Target/TargetList.cpp
+++ source/Target/TargetList.cpp
@@ -293,32 +293,27 @@
         }
     }
 
-    if (!platform_sp)
+    // If we have a valid architecture, make sure the current platform is
+    // compatible with that architecture
+    if (!prefer_platform_arch && arch.IsValid())
     {
-        // Get the current platform and make sure it is compatible with the
-        // current architecture if we have a valid architecture.
-        platform_sp = debugger.GetPlatformList().GetSelectedPlatform ();
-        
-        if (!prefer_platform_arch && arch.IsValid())
+        if (!platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch))
         {
-            if (!platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch))
-            {
-                platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch);
-                if (platform_sp)
-                    debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
-            }
+            platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch);
+            if (platform_sp)
+                debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
         }
-        else if (platform_arch.IsValid())
+    }
+    else if (platform_arch.IsValid())
+    {
+        // if "arch" isn't valid, yet "platform_arch" is, it means we have an executable file with
+        // a single architecture which should be used
+        ArchSpec fixed_platform_arch;
+        if (!platform_sp->IsCompatibleArchitecture(platform_arch, false, &fixed_platform_arch))
         {
-            // if "arch" isn't valid, yet "platform_arch" is, it means we have an executable file with
-            // a single architecture which should be used
-            ArchSpec fixed_platform_arch;
-            if (!platform_sp->IsCompatibleArchitecture(platform_arch, false, &fixed_platform_arch))
-            {
-                platform_sp = Platform::GetPlatformForArchitecture(platform_arch, &fixed_platform_arch);
-                if (platform_sp)
-                    debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
-            }
+            platform_sp = Platform::GetPlatformForArchitecture(platform_arch, &fixed_platform_arch);
+            if (platform_sp)
+                debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
         }
     }
     
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to