[Lldb-commits] [lldb] r218145 - Test suite runs better again after recent fixes that would select a platform if a "file a.out" auto selected a different platform than the selected one.

Greg Clayton gclayton at apple.com
Fri Sep 19 13:11:51 PDT 2014


Author: gclayton
Date: Fri Sep 19 15:11:50 2014
New Revision: 218145

URL: http://llvm.org/viewvc/llvm-project?rev=218145&view=rev
Log:
Test suite runs better again after recent fixes that would select a platform if a "file a.out" auto selected a different platform than the selected one.

Changes include:
- fix it so you can select the "host" platform using "platform select host"
- change all callbacks that create platforms to returns shared pointers
- fix TestImageListMultiArchitecture.py to restore the "host" platform by running "platform select host"
- Add a new "PlatformSP Platform::Find(const ConstString &name)" method to get a cached platform
- cache platforms that are created and re-use them instead of always creating a new one


Modified:
    lldb/trunk/include/lldb/Target/Platform.h
    lldb/trunk/include/lldb/lldb-private-interfaces.h
    lldb/trunk/source/API/SBDebugger.cpp
    lldb/trunk/source/API/SBPlatform.cpp
    lldb/trunk/source/Commands/CommandObjectPlatform.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Host/common/Host.cpp
    lldb/trunk/source/Host/macosx/Host.mm
    lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
    lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
    lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
    lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
    lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp
    lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.h
    lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
    lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
    lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
    lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
    lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h
    lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
    lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
    lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
    lldb/trunk/source/Target/Platform.cpp
    lldb/trunk/source/Target/TargetList.cpp
    lldb/trunk/test/functionalities/object-file/TestImageListMultiArchitecture.py
    lldb/trunk/tools/lldb-gdbserver/lldb-gdbserver.cpp

Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Fri Sep 19 15:11:50 2014
@@ -62,7 +62,7 @@ namespace lldb_private {
         /// or attaching to processes unless another platform is specified.
         //------------------------------------------------------------------
         static lldb::PlatformSP
-        GetDefaultPlatform ();
+        GetHostPlatform ();
 
         static lldb::PlatformSP
         GetPlatformForArchitecture (const ArchSpec &arch,
@@ -72,10 +72,14 @@ namespace lldb_private {
         GetHostPlatformName ();
 
         static void
-        SetDefaultPlatform (const lldb::PlatformSP &platform_sp);
+        SetHostPlatform (const lldb::PlatformSP &platform_sp);
 
+        // Find an existing platform plug-in by name
         static lldb::PlatformSP
-        Create (const char *platform_name, Error &error);
+        Find (const ConstString &name);
+
+        static lldb::PlatformSP
+        Create (const ConstString &name, Error &error);
 
         static lldb::PlatformSP
         Create (const ArchSpec &arch, ArchSpec *platform_arch_ptr, Error &error);
@@ -114,8 +118,8 @@ namespace lldb_private {
         ///     An optional name of a specific platform plug-in that
         ///     should be used. If NULL, pick the best plug-in.
         //------------------------------------------------------------------
-        static Platform*
-        FindPlugin (Process *process, const ConstString &plugin_name);
+//        static lldb::PlatformSP
+//        FindPlugin (Process *process, const ConstString &plugin_name);
 
         //------------------------------------------------------------------
         /// Set the target's executable based off of the existing 

Modified: lldb/trunk/include/lldb/lldb-private-interfaces.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-interfaces.h?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-interfaces.h (original)
+++ lldb/trunk/include/lldb/lldb-private-interfaces.h Fri Sep 19 15:11:50 2014
@@ -30,7 +30,7 @@ namespace lldb_private
     typedef OperatingSystem* (*OperatingSystemCreateInstance) (Process *process, bool force);
     typedef LanguageRuntime *(*LanguageRuntimeCreateInstance) (Process *process, lldb::LanguageType language);
     typedef SystemRuntime *(*SystemRuntimeCreateInstance) (Process *process);
-    typedef Platform* (*PlatformCreateInstance) (bool force, const ArchSpec *arch);
+    typedef lldb::PlatformSP (*PlatformCreateInstance) (bool force, const ArchSpec *arch);
     typedef lldb::ProcessSP (*ProcessCreateInstance) (Target &target, Listener &listener, const FileSpec *crash_file_path);
     typedef SymbolFile* (*SymbolFileCreateInstance) (ObjectFile* obj_file);
     typedef SymbolVendor* (*SymbolVendorCreateInstance) (const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm);   // Module can be NULL for default system symbol vendor

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Fri Sep 19 15:11:50 2014
@@ -1186,19 +1186,42 @@ SBDebugger::GetID()
 
 
 SBError
-SBDebugger::SetCurrentPlatform (const char *platform_name)
+SBDebugger::SetCurrentPlatform (const char *platform_name_cstr)
 {
     SBError sb_error;
     if (m_opaque_sp)
     {
-        PlatformSP platform_sp (Platform::Create (platform_name, sb_error.ref()));
-        
-        if (platform_sp)
+        if (platform_name_cstr && platform_name_cstr[0])
         {
-            bool make_selected = true;
-            m_opaque_sp->GetPlatformList().Append (platform_sp, make_selected);
+            ConstString platform_name (platform_name_cstr);
+            PlatformSP platform_sp (Platform::Find (platform_name));
+
+            if (platform_sp)
+            {
+                // Already have a platform with this name, just select it
+                m_opaque_sp->GetPlatformList().SetSelectedPlatform(platform_sp);
+            }
+            else
+            {
+                // We don't have a platform by this name yet, create one
+                platform_sp = Platform::Create (platform_name, sb_error.ref());
+                if (platform_sp)
+                {
+                    // We created the platform, now append and select it
+                    bool make_selected = true;
+                    m_opaque_sp->GetPlatformList().Append (platform_sp, make_selected);
+                }
+            }
+        }
+        else
+        {
+            sb_error.ref().SetErrorString("invalid platform name");
         }
     }
+    else
+    {
+        sb_error.ref().SetErrorString("invalid debugger");
+    }
     return sb_error;
 }
 

Modified: lldb/trunk/source/API/SBPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBPlatform.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/API/SBPlatform.cpp (original)
+++ lldb/trunk/source/API/SBPlatform.cpp Fri Sep 19 15:11:50 2014
@@ -269,7 +269,8 @@ SBPlatform::SBPlatform (const char *plat
     m_opaque_sp ()
 {
     Error error;
-    m_opaque_sp = Platform::Create (platform_name, error);
+    if (platform_name && platform_name[0])
+        m_opaque_sp = Platform::Create (ConstString(platform_name), error);
 }
 
 SBPlatform::~SBPlatform()

Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Fri Sep 19 15:11:50 2014
@@ -302,7 +302,7 @@ protected:
         Stream &ostrm = result.GetOutputStream();
         ostrm.Printf("Available platforms:\n");
         
-        PlatformSP host_platform_sp (Platform::GetDefaultPlatform());
+        PlatformSP host_platform_sp (Platform::GetHostPlatform());
         ostrm.Printf ("%s: %s\n", 
                       host_platform_sp->GetPluginName().GetCString(),
                       host_platform_sp->GetDescription());

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Fri Sep 19 15:11:50 2014
@@ -645,7 +645,7 @@ Debugger::Debugger(lldb::LogOutputCallba
         m_log_callback_stream_sp.reset (new StreamCallback (log_callback, baton));
     m_command_interpreter_ap->Initialize ();
     // Always add our default platform to the platform list
-    PlatformSP default_platform_sp (Platform::GetDefaultPlatform());
+    PlatformSP default_platform_sp (Platform::GetHostPlatform());
     assert (default_platform_sp.get());
     m_platform_list.Append (default_platform_sp, true);
     

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Fri Sep 19 15:11:50 2014
@@ -1039,7 +1039,7 @@ Host::LaunchProcess (ProcessLaunchInfo &
     Error error;
     char exe_path[PATH_MAX];
 
-    PlatformSP host_platform_sp (Platform::GetDefaultPlatform ());
+    PlatformSP host_platform_sp (Platform::GetHostPlatform ());
 
     const ArchSpec &arch_spec = launch_info.GetArchitecture();
 

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Fri Sep 19 15:11:50 2014
@@ -1305,7 +1305,7 @@ Host::LaunchProcess (ProcessLaunchInfo &
 {
     Error error;
     char exe_path[PATH_MAX];
-    PlatformSP host_platform_sp (Platform::GetDefaultPlatform ());
+    PlatformSP host_platform_sp (Platform::GetHostPlatform ());
     
     const ArchSpec &arch_spec = launch_info.GetArchitecture();
     

Modified: lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp Fri Sep 19 15:11:50 2014
@@ -33,7 +33,7 @@ OptionGroupPlatform::CreatePlatformWithO
     
     if (!m_platform_name.empty())
     {
-        platform_sp = Platform::Create (m_platform_name.c_str(), error);
+        platform_sp = Platform::Create (ConstString(m_platform_name.c_str()), error);
         if (platform_sp)
         {
             if (platform_arch.IsValid() && !platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch))

Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Fri Sep 19 15:11:50 2014
@@ -467,7 +467,8 @@ DynamicLoaderDarwinKernel::DynamicLoader
     m_mutex(Mutex::eMutexTypeRecursive),
     m_break_id (LLDB_INVALID_BREAK_ID)
 {
-    PlatformSP platform_sp(Platform::FindPlugin (process, PlatformDarwinKernel::GetPluginNameStatic ()));
+    Error error;
+    PlatformSP platform_sp(Platform::Create(PlatformDarwinKernel::GetPluginNameStatic(), error));
     // Only select the darwin-kernel Platform if we've been asked to load kexts.
     // It can take some time to scan over all of the kext info.plists and that
     // shouldn't be done if kext loading is explicitly disabled.

Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Fri Sep 19 15:11:50 2014
@@ -32,7 +32,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-Platform *
+PlatformSP
 PlatformFreeBSD::CreateInstance (bool force, const lldb_private::ArchSpec *arch)
 {
     // The only time we create an instance is when we are creating a remote
@@ -84,8 +84,8 @@ PlatformFreeBSD::CreateInstance (bool fo
         }
     }
     if (create)
-        return new PlatformFreeBSD (is_host);
-    return NULL;
+        return PlatformSP(new PlatformFreeBSD (is_host));
+    return PlatformSP();
 
 }
 
@@ -124,7 +124,7 @@ PlatformFreeBSD::Initialize ()
     	// Force a host flag to true for the default platform object.
         PlatformSP default_platform_sp (new PlatformFreeBSD(true));
         default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
-        Platform::SetDefaultPlatform (default_platform_sp);
+        Platform::SetHostPlatform (default_platform_sp);
 #endif
         PluginManager::RegisterPlugin(PlatformFreeBSD::GetPluginNameStatic(false),
                                       PlatformFreeBSD::GetDescriptionStatic(false),
@@ -404,7 +404,7 @@ PlatformFreeBSD::ConnectRemote (Args& ar
     else
     {
         if (!m_remote_platform_sp)
-            m_remote_platform_sp = Platform::Create ("remote-gdb-server", error);
+            m_remote_platform_sp = Platform::Create (ConstString("remote-gdb-server"), error);
 
         if (m_remote_platform_sp)
         {

Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h Fri Sep 19 15:11:50 2014
@@ -24,7 +24,7 @@ public:
     //------------------------------------------------------------
     // Class functions
     //------------------------------------------------------------
-    static lldb_private::Platform*
+    static lldb::PlatformSP
     CreateInstance (bool force, const lldb_private::ArchSpec *arch);
 
     static void

Modified: lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp Fri Sep 19 15:11:50 2014
@@ -32,7 +32,7 @@ using namespace lldb_private;
 
 static uint32_t g_initialize_count = 0;
 
-Platform *
+PlatformSP
 PlatformKalimba::CreateInstance (bool force, const ArchSpec *arch)
 {
     bool create = force;
@@ -50,8 +50,8 @@ PlatformKalimba::CreateInstance (bool fo
         }
     }
     if (create)
-        return new PlatformKalimba(false);
-    return NULL;
+        return PlatformSP(new PlatformKalimba(false));
+    return PlatformSP();
 }
 
 lldb_private::ConstString

Modified: lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.h?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.h (original)
+++ lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.h Fri Sep 19 15:11:50 2014
@@ -36,7 +36,7 @@ namespace lldb_private {
         //------------------------------------------------------------
         // lldb_private::PluginInterface functions
         //------------------------------------------------------------
-        static Platform *
+        static lldb::PlatformSP
         CreateInstance (bool force, const lldb_private::ArchSpec *arch);
 
         static lldb_private::ConstString

Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Fri Sep 19 15:11:50 2014
@@ -118,7 +118,7 @@ PlatformLinux::DebuggerInitialize (lldb_
 
 //------------------------------------------------------------------
 
-Platform *
+PlatformSP
 PlatformLinux::CreateInstance (bool force, const ArchSpec *arch)
 {
     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM));
@@ -183,13 +183,13 @@ PlatformLinux::CreateInstance (bool forc
     {
         if (log)
             log->Printf ("PlatformLinux::%s() creating remote-linux platform", __FUNCTION__);
-        return new PlatformLinux(false);
+        return PlatformSP(new PlatformLinux(false));
     }
 
     if (log)
         log->Printf ("PlatformLinux::%s() aborting creation of remote-linux platform", __FUNCTION__);
 
-    return NULL;
+    return PlatformSP();
 }
 
 
@@ -231,7 +231,7 @@ PlatformLinux::Initialize ()
 #if defined(__linux__)
         PlatformSP default_platform_sp (new PlatformLinux(true));
         default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
-        Platform::SetDefaultPlatform (default_platform_sp);
+        Platform::SetHostPlatform (default_platform_sp);
 #endif
         PluginManager::RegisterPlugin(PlatformLinux::GetPluginNameStatic(false),
                                       PlatformLinux::GetPluginDescriptionStatic(false),

Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h Fri Sep 19 15:11:50 2014
@@ -39,7 +39,7 @@ namespace lldb_private {
         //------------------------------------------------------------
         // lldb_private::PluginInterface functions
         //------------------------------------------------------------
-        static Platform *
+        static lldb::PlatformSP
         CreateInstance (bool force, const lldb_private::ArchSpec *arch);
 
         static lldb_private::ConstString

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Fri Sep 19 15:11:50 2014
@@ -72,14 +72,14 @@ PlatformDarwinKernel::Terminate ()
     }
 }
 
-Platform*
+PlatformSP
 PlatformDarwinKernel::CreateInstance (bool force, const ArchSpec *arch)
 {
     // This is a special plugin that we don't want to activate just based on an ArchSpec for normal
     // userlnad debugging.  It is only useful in kernel debug sessions and the DynamicLoaderDarwinPlugin
     // (or a user doing 'platform select') will force the creation of this Platform plugin.
     if (force == false)
-        return NULL;
+        return PlatformSP();
 
     bool create = force;
     LazyBool is_ios_debug_session = eLazyBoolCalculate;
@@ -143,8 +143,8 @@ PlatformDarwinKernel::CreateInstance (bo
         }
     }
     if (create)
-        return new PlatformDarwinKernel (is_ios_debug_session);
-    return NULL;
+        return PlatformSP(new PlatformDarwinKernel (is_ios_debug_session));
+    return PlatformSP();
 }
 
 

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h Fri Sep 19 15:11:50 2014
@@ -30,7 +30,7 @@ public:
     //------------------------------------------------------------
     // Class Functions
     //------------------------------------------------------------
-    static lldb_private::Platform*
+    static lldb::PlatformSP
     CreateInstance (bool force, const lldb_private::ArchSpec *arch);
 
     static void

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Fri Sep 19 15:11:50 2014
@@ -45,7 +45,7 @@ PlatformMacOSX::Initialize ()
 #if defined (__APPLE__)
         PlatformSP default_platform_sp (new PlatformMacOSX(true));
         default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
-        Platform::SetDefaultPlatform (default_platform_sp);
+        Platform::SetHostPlatform (default_platform_sp);
 #endif        
         PluginManager::RegisterPlugin (PlatformMacOSX::GetPluginNameStatic(false),
                                        PlatformMacOSX::GetDescriptionStatic(false),
@@ -66,7 +66,7 @@ PlatformMacOSX::Terminate ()
     }
 }
 
-Platform* 
+PlatformSP
 PlatformMacOSX::CreateInstance (bool force, const ArchSpec *arch)
 {
     // The only time we create an instance is when we are creating a remote
@@ -117,8 +117,8 @@ PlatformMacOSX::CreateInstance (bool for
         }
     }
     if (create)
-        return new PlatformMacOSX (is_host);
-    return NULL;
+        return PlatformSP(new PlatformMacOSX (is_host));
+    return PlatformSP();
 }
 
 lldb_private::ConstString

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.h?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.h Fri Sep 19 15:11:50 2014
@@ -23,7 +23,7 @@ public:
     //------------------------------------------------------------
     // Class functions
     //------------------------------------------------------------
-    static lldb_private::Platform* 
+    static lldb::PlatformSP
     CreateInstance (bool force, const lldb_private::ArchSpec *arch);
 
     static void

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp Fri Sep 19 15:11:50 2014
@@ -83,7 +83,7 @@ PlatformRemoteiOS::Terminate ()
     }
 }
 
-Platform* 
+PlatformSP
 PlatformRemoteiOS::CreateInstance (bool force, const ArchSpec *arch)
 {
     bool create = force;
@@ -144,8 +144,8 @@ PlatformRemoteiOS::CreateInstance (bool
     }
 
     if (create)
-        return new PlatformRemoteiOS ();
-    return NULL;
+        return lldb::PlatformSP(new PlatformRemoteiOS ());
+    return lldb::PlatformSP();
 }
 
 

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h Fri Sep 19 15:11:50 2014
@@ -25,7 +25,7 @@ public:
     //------------------------------------------------------------
     // Class Functions
     //------------------------------------------------------------
-    static lldb_private::Platform* 
+    static lldb::PlatformSP
     CreateInstance (bool force, const lldb_private::ArchSpec *arch);
 
     static void

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp Fri Sep 19 15:11:50 2014
@@ -61,7 +61,7 @@ PlatformiOSSimulator::Terminate ()
     }
 }
 
-Platform* 
+PlatformSP
 PlatformiOSSimulator::CreateInstance (bool force, const ArchSpec *arch)
 {
     bool create = force;
@@ -120,8 +120,8 @@ PlatformiOSSimulator::CreateInstance (bo
         }
     }
     if (create)
-        return new PlatformiOSSimulator ();
-    return NULL;
+        return PlatformSP(new PlatformiOSSimulator ());
+    return PlatformSP();
 }
 
 

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h Fri Sep 19 15:11:50 2014
@@ -23,7 +23,7 @@ public:
     //------------------------------------------------------------
     // Class Functions
     //------------------------------------------------------------
-    static lldb_private::Platform* 
+    static lldb::PlatformSP
     CreateInstance (bool force, const lldb_private::ArchSpec *arch);
 
     static void

Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Fri Sep 19 15:11:50 2014
@@ -699,7 +699,7 @@ PlatformPOSIX::ConnectRemote (Args& args
     else
     {
         if (!m_remote_platform_sp)
-            m_remote_platform_sp = Platform::Create ("remote-gdb-server", error);
+            m_remote_platform_sp = Platform::Create (ConstString("remote-gdb-server"), error);
 
         if (m_remote_platform_sp && error.Success())
             error = m_remote_platform_sp->ConnectRemote (args);

Modified: lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp Fri Sep 19 15:11:50 2014
@@ -66,7 +66,7 @@ namespace
     };
 }
 
-Platform *
+PlatformSP
 PlatformWindows::CreateInstance (bool force, const lldb_private::ArchSpec *arch)
 {
     // The only time we create an instance is when we are creating a remote
@@ -109,8 +109,8 @@ PlatformWindows::CreateInstance (bool fo
         }
     }
     if (create)
-        return new PlatformWindows (is_host);
-    return NULL;
+        return PlatformSP(new PlatformWindows (is_host));
+    return PlatformSP();
 
 }
 
@@ -154,7 +154,7 @@ PlatformWindows::Initialize(void)
         // Force a host flag to true for the default platform object.
         PlatformSP default_platform_sp (new PlatformWindows(true));
         default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
-        Platform::SetDefaultPlatform (default_platform_sp);
+        Platform::SetHostPlatform (default_platform_sp);
 #endif
         PluginManager::RegisterPlugin(PlatformWindows::GetPluginNameStatic(false),
                                       PlatformWindows::GetPluginDescriptionStatic(false),
@@ -417,7 +417,7 @@ PlatformWindows::ConnectRemote (Args& ar
     else
     {
         if (!m_remote_platform_sp)
-            m_remote_platform_sp = Platform::Create ("remote-gdb-server", error);
+            m_remote_platform_sp = Platform::Create (ConstString("remote-gdb-server"), error);
 
         if (m_remote_platform_sp)
         {

Modified: lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h (original)
+++ lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h Fri Sep 19 15:11:50 2014
@@ -37,7 +37,7 @@ public:
     //------------------------------------------------------------
     // lldb_private::PluginInterface functions
     //------------------------------------------------------------
-    static lldb_private::Platform*
+    static lldb::PlatformSP
     CreateInstance (bool force, const lldb_private::ArchSpec *arch);
 
 

Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Fri Sep 19 15:11:50 2014
@@ -56,7 +56,7 @@ PlatformRemoteGDBServer::Terminate ()
     }
 }
 
-Platform* 
+PlatformSP
 PlatformRemoteGDBServer::CreateInstance (bool force, const lldb_private::ArchSpec *arch)
 {
     bool create = force;
@@ -65,8 +65,8 @@ PlatformRemoteGDBServer::CreateInstance
         create = !arch->TripleVendorWasSpecified() && !arch->TripleOSWasSpecified();
     }
     if (create)
-        return new PlatformRemoteGDBServer ();
-    return NULL;
+        return PlatformSP(new PlatformRemoteGDBServer());
+    return PlatformSP();
 }
 
 

Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h (original)
+++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h Fri Sep 19 15:11:50 2014
@@ -29,7 +29,7 @@ public:
     static void
     Terminate ();
     
-    static lldb_private::Platform* 
+    static lldb::PlatformSP
     CreateInstance (bool force, const lldb_private::ArchSpec *arch);
 
     static lldb_private::ConstString

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Fri Sep 19 15:11:50 2014
@@ -1278,7 +1278,7 @@ NativeProcessLinux::AttachToProcess (
 
     // Grab the current platform architecture.  This should be Linux,
     // since this code is only intended to run on a Linux host.
-    PlatformSP platform_sp (Platform::GetDefaultPlatform ());
+    PlatformSP platform_sp (Platform::GetHostPlatform ());
     if (!platform_sp)
         return Error("failed to get a valid default platform");
 
@@ -1412,7 +1412,7 @@ NativeProcessLinux::AttachToInferior (ll
         log->Printf ("NativeProcessLinux::%s (pid = %" PRIi64 ")", __FUNCTION__, pid);
 
     // We can use the Host for everything except the ResolveExecutable portion.
-    PlatformSP platform_sp = Platform::GetDefaultPlatform ();
+    PlatformSP platform_sp = Platform::GetHostPlatform ();
     if (!platform_sp)
     {
         if (log)

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp Fri Sep 19 15:11:50 2014
@@ -71,7 +71,7 @@ namespace
 //----------------------------------------------------------------------
 GDBRemoteCommunicationServer::GDBRemoteCommunicationServer(bool is_platform) :
     GDBRemoteCommunication ("gdb-remote.server", "gdb-remote.server.rx_packet", is_platform),
-    m_platform_sp (Platform::GetDefaultPlatform ()),
+    m_platform_sp (Platform::GetHostPlatform ()),
     m_async_thread (LLDB_INVALID_HOST_THREAD),
     m_process_launch_info (),
     m_process_launch_error (),

Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Fri Sep 19 15:11:50 2014
@@ -32,26 +32,12 @@ using namespace lldb_private;
 // Use a singleton function for g_local_platform_sp to avoid init
 // constructors since LLDB is often part of a shared library
 static PlatformSP&
-GetDefaultPlatformSP ()
+GetHostPlatformSP ()
 {
-    static PlatformSP g_default_platform_sp;
-    return g_default_platform_sp;
+    static PlatformSP g_platform_sp;
+    return g_platform_sp;
 }
 
-static Mutex &
-GetConnectedPlatformListMutex ()
-{
-    static Mutex g_remote_connected_platforms_mutex (Mutex::eMutexTypeRecursive);
-    return g_remote_connected_platforms_mutex;
-}
-static std::vector<PlatformSP> &
-GetConnectedPlatformList ()
-{
-    static std::vector<PlatformSP> g_remote_connected_platforms;
-    return g_remote_connected_platforms;
-}
-
-
 const char *
 Platform::GetHostPlatformName ()
 {
@@ -69,17 +55,37 @@ Platform::GetHostPlatformName ()
 /// or attaching to processes unless another platform is specified.
 //------------------------------------------------------------------
 PlatformSP
-Platform::GetDefaultPlatform ()
+Platform::GetHostPlatform ()
+{
+    return GetHostPlatformSP ();
+}
+
+static std::vector<PlatformSP> &
+GetPlatformList()
 {
-    return GetDefaultPlatformSP ();
+    static std::vector<PlatformSP> g_platform_list;
+    return g_platform_list;
+}
+
+static Mutex &
+GetPlatformListMutex ()
+{
+    static Mutex g_mutex(Mutex::eMutexTypeRecursive);
+    return g_mutex;
 }
 
 void
-Platform::SetDefaultPlatform (const lldb::PlatformSP &platform_sp)
+Platform::SetHostPlatform (const lldb::PlatformSP &platform_sp)
 {
     // The native platform should use its static void Platform::Initialize()
     // function to register itself as the native platform.
-    GetDefaultPlatformSP () = platform_sp;
+    GetHostPlatformSP () = platform_sp;
+
+    if (platform_sp)
+    {
+        Mutex::Locker locker(GetPlatformListMutex ());
+        GetPlatformList().push_back(platform_sp);
+    }
 }
 
 Error
@@ -98,36 +104,36 @@ Platform::LocateExecutableScriptingResou
     return FileSpecList();
 }
 
-Platform*
-Platform::FindPlugin (Process *process, const ConstString &plugin_name)
-{
-    PlatformCreateInstance create_callback = NULL;
-    if (plugin_name)
-    {
-        create_callback  = PluginManager::GetPlatformCreateCallbackForPluginName (plugin_name);
-        if (create_callback)
-        {
-            ArchSpec arch;
-            if (process)
-            {
-                arch = process->GetTarget().GetArchitecture();
-            }
-            std::unique_ptr<Platform> instance_ap(create_callback(process, &arch));
-            if (instance_ap.get())
-                return instance_ap.release();
-        }
-    }
-    else
-    {
-        for (uint32_t idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex(idx)) != NULL; ++idx)
-        {
-            std::unique_ptr<Platform> instance_ap(create_callback(process, nullptr));
-            if (instance_ap.get())
-                return instance_ap.release();
-        }
-    }
-    return NULL;
-}
+//PlatformSP
+//Platform::FindPlugin (Process *process, const ConstString &plugin_name)
+//{
+//    PlatformCreateInstance create_callback = NULL;
+//    if (plugin_name)
+//    {
+//        create_callback  = PluginManager::GetPlatformCreateCallbackForPluginName (plugin_name);
+//        if (create_callback)
+//        {
+//            ArchSpec arch;
+//            if (process)
+//            {
+//                arch = process->GetTarget().GetArchitecture();
+//            }
+//            PlatformSP platform_sp(create_callback(process, &arch));
+//            if (platform_sp)
+//                return platform_sp;
+//        }
+//    }
+//    else
+//    {
+//        for (uint32_t idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex(idx)) != NULL; ++idx)
+//        {
+//            PlatformSP platform_sp(create_callback(process, nullptr));
+//            if (platform_sp)
+//                return platform_sp;
+//        }
+//    }
+//    return PlatformSP();
+//}
 
 Error
 Platform::GetSharedModule (const ModuleSpec &module_spec,
@@ -153,21 +159,50 @@ Platform::GetSharedModule (const ModuleS
 }
 
 PlatformSP
-Platform::Create (const char *platform_name, Error &error)
+Platform::Find (const ConstString &name)
+{
+    if (name)
+    {
+        static ConstString g_host_platform_name ("host");
+        if (name == g_host_platform_name)
+            return GetHostPlatform();
+
+        Mutex::Locker locker(GetPlatformListMutex ());
+        for (const auto &platform_sp : GetPlatformList())
+        {
+            if (platform_sp->GetName() == name)
+                return platform_sp;
+        }
+    }
+    return PlatformSP();
+}
+
+PlatformSP
+Platform::Create (const ConstString &name, Error &error)
 {
     PlatformCreateInstance create_callback = NULL;
     lldb::PlatformSP platform_sp;
-    if (platform_name && platform_name[0])
+    if (name)
     {
-        ConstString const_platform_name (platform_name);
-        create_callback = PluginManager::GetPlatformCreateCallbackForPluginName (const_platform_name);
+        static ConstString g_host_platform_name ("host");
+        if (name == g_host_platform_name)
+            return GetHostPlatform();
+
+        create_callback = PluginManager::GetPlatformCreateCallbackForPluginName (name);
         if (create_callback)
-            platform_sp.reset(create_callback(true, NULL));
+            platform_sp = create_callback(true, NULL);
         else
-            error.SetErrorStringWithFormat ("unable to find a plug-in for the platform named \"%s\"", platform_name);
+            error.SetErrorStringWithFormat ("unable to find a plug-in for the platform named \"%s\"", name.GetCString());
     }
     else
         error.SetErrorString ("invalid platform name");
+
+    if (platform_sp)
+    {
+        Mutex::Locker locker(GetPlatformListMutex ());
+        GetPlatformList().push_back(platform_sp);
+    }
+
     return platform_sp;
 }
 
@@ -178,28 +213,52 @@ Platform::Create (const ArchSpec &arch,
     lldb::PlatformSP platform_sp;
     if (arch.IsValid())
     {
-        uint32_t idx;
+        // Scope for locker
+        {
+            // First try exact arch matches across all platforms already created
+            Mutex::Locker locker(GetPlatformListMutex ());
+            for (const auto &platform_sp : GetPlatformList())
+            {
+                if (platform_sp->IsCompatibleArchitecture(arch, true, platform_arch_ptr))
+                    return platform_sp;
+            }
+
+            // Next try compatible arch matches across all platforms already created
+            for (const auto &platform_sp : GetPlatformList())
+            {
+                if (platform_sp->IsCompatibleArchitecture(arch, false, platform_arch_ptr))
+                    return platform_sp;
+            }
+        }
+
         PlatformCreateInstance create_callback;
         // First try exact arch matches across all platform plug-ins
-        bool exact = true;
+        uint32_t idx;
         for (idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex (idx)); ++idx)
         {
             if (create_callback)
             {
-                platform_sp.reset(create_callback(false, &arch));
-                if (platform_sp && platform_sp->IsCompatibleArchitecture(arch, exact, platform_arch_ptr))
+                platform_sp = create_callback(false, &arch);
+                if (platform_sp && platform_sp->IsCompatibleArchitecture(arch, true, platform_arch_ptr))
+                {
+                    Mutex::Locker locker(GetPlatformListMutex ());
+                    GetPlatformList().push_back(platform_sp);
                     return platform_sp;
+                }
             }
         }
         // Next try compatible arch matches across all platform plug-ins
-        exact = false;
         for (idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex (idx)); ++idx)
         {
             if (create_callback)
             {
-                platform_sp.reset(create_callback(false, &arch));
-                if (platform_sp && platform_sp->IsCompatibleArchitecture(arch, exact, platform_arch_ptr))
+                platform_sp = create_callback(false, &arch);
+                if (platform_sp && platform_sp->IsCompatibleArchitecture(arch, false, platform_arch_ptr))
+                {
+                    Mutex::Locker locker(GetPlatformListMutex ());
+                    GetPlatformList().push_back(platform_sp);
                     return platform_sp;
+                }
             }
         }
     }
@@ -211,25 +270,6 @@ Platform::Create (const ArchSpec &arch,
     return platform_sp;
 }
 
-uint32_t
-Platform::GetNumConnectedRemotePlatforms ()
-{
-    Mutex::Locker locker (GetConnectedPlatformListMutex ());
-    return GetConnectedPlatformList().size();
-}
-
-PlatformSP
-Platform::GetConnectedRemotePlatformAtIndex (uint32_t idx)
-{
-    PlatformSP platform_sp;
-    {
-        Mutex::Locker locker (GetConnectedPlatformListMutex ());
-        if (idx < GetConnectedPlatformList().size())
-            platform_sp = GetConnectedPlatformList ()[idx];
-    }
-    return platform_sp;
-}
-
 //------------------------------------------------------------------
 /// Default Constructor
 //------------------------------------------------------------------

Modified: lldb/trunk/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetList.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/source/Target/TargetList.cpp (original)
+++ lldb/trunk/source/Target/TargetList.cpp Fri Sep 19 15:11:50 2014
@@ -170,7 +170,7 @@ TargetList::CreateTarget (Debugger &debu
                     
                     typedef std::vector<PlatformSP> PlatformList;
                     PlatformList platforms;
-                    PlatformSP host_platform_sp = Platform::GetDefaultPlatform();
+                    PlatformSP host_platform_sp = Platform::GetHostPlatform();
                     for (size_t i=0; i<num_specs; ++i)
                     {
                         ModuleSpec module_spec;

Modified: lldb/trunk/test/functionalities/object-file/TestImageListMultiArchitecture.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/object-file/TestImageListMultiArchitecture.py?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/object-file/TestImageListMultiArchitecture.py (original)
+++ lldb/trunk/test/functionalities/object-file/TestImageListMultiArchitecture.py Fri Sep 19 15:11:50 2014
@@ -36,6 +36,8 @@ class TestImageListMultiArchitecture(Tes
 
             self.runCmd("file {}".format(file_name))
             self.match("image list -t -A", [expected_triple_and_arch_regex])
+        # Revert to the host platform after all of this is done
+        self.runCmd("platform select host")
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/tools/lldb-gdbserver/lldb-gdbserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-gdbserver/lldb-gdbserver.cpp?rev=218145&r1=218144&r2=218145&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-gdbserver/lldb-gdbserver.cpp (original)
+++ lldb/trunk/tools/lldb-gdbserver/lldb-gdbserver.cpp Fri Sep 19 15:11:50 2014
@@ -142,12 +142,12 @@ dump_available_platforms (FILE *output_f
         fprintf (output_file, "%s\t%s\n", plugin_name, plugin_desc);
     }
 
-    if ( Platform::GetDefaultPlatform () )
+    if ( Platform::GetHostPlatform () )
     {
         // add this since the default platform doesn't necessarily get registered by
         // the plugin name (e.g. 'host' doesn't show up as a
         // registered platform plugin even though it's the default).
-        fprintf (output_file, "%s\tDefault platform for this host.\n", Platform::GetDefaultPlatform ()->GetPluginName ().AsCString ());
+        fprintf (output_file, "%s\tDefault platform for this host.\n", Platform::GetHostPlatform ()->GetPluginName ().AsCString ());
     }
 }
 
@@ -174,7 +174,7 @@ setup_platform (const std::string platfo
     if (platform_name.empty())
     {
         printf ("using the default platform: ");
-        platform_sp = Platform::GetDefaultPlatform ();
+        platform_sp = Platform::GetHostPlatform ();
         printf ("%s\n", platform_sp->GetPluginName ().AsCString ());
         return platform_sp;
     }
@@ -186,9 +186,9 @@ setup_platform (const std::string platfo
         // the host platform isn't registered with that name (at
         // least, not always.  Check if the given name matches
         // the default platform name.  If so, use it.
-        if ( Platform::GetDefaultPlatform () && ( Platform::GetDefaultPlatform ()->GetPluginName () == ConstString (platform_name.c_str()) ) )
+        if ( Platform::GetHostPlatform () && ( Platform::GetHostPlatform ()->GetPluginName () == ConstString (platform_name.c_str()) ) )
         {
-            platform_sp = Platform::GetDefaultPlatform ();
+            platform_sp = Platform::GetHostPlatform ();
         }
         else
         {





More information about the lldb-commits mailing list