LLDB now has "Platform" plug-ins. Platform plug-ins are plug-ins that provide
an interface to a local or remote debugging platform. By default each host OS
that supports LLDB should be registering a "default" platform that will be
used unless a new platform is selected. Platforms are responsible for things
such as:
- getting process information by name or by processs ID
- finding platform files. This is useful for remote debugging where there is 
  an SDK with files that might already or need to be cached for debug access.
- getting a list of platform supported architectures in the exact order they
  should be selected. This helps the native x86 platform on MacOSX select the
  correct x86_64/i386 slice from universal binaries.
- Connect to remote platforms for remote debugging
- Resolving an executable including finding an executable inside platform
  specific bundles (macosx uses .app bundles that contain files) and also
  selecting the appropriate slice of universal files for a given platform.

So by default there is always a local platform, but remote platforms can be
connected to. I will soon be adding a new "platform" command that will support
the following commands:
(lldb) platform connect --name machine1 macosx connect://host:port
Connected to "machine1" platform.
(lldb) platform disconnect macosx

This allows LLDB to be well setup to do remote debugging and also once 
connected process listing and finding for things like:
(lldb) process attach --name x<TAB>

The currently selected platform plug-in can now auto complete any available
processes that start with "x". The responsibilities for the platform plug-in
will soon grow and expand.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@127286 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp
index 2adf796..f871524 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -425,7 +425,7 @@
         FileSpec file_spec (filename, true);
         arch.SetTriple (target_triple);
         TargetSP target_sp;
-        Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file_spec, arch, NULL, true, target_sp));
+        Error error (m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file_spec, arch, true, target_sp));
         target.reset (target_sp);
     }
     
@@ -454,23 +454,8 @@
 
         if (arch_cstr)
             arch.SetTriple (arch_cstr);
-        else
-            arch = lldb_private::Target::GetDefaultArchitecture ();
 
-        if (!arch.IsValid())
-            arch.SetTriple (LLDB_ARCH_DEFAULT);
-
-        error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
-
-        if (error.Fail())
-        {
-            if (strcmp (LLDB_ARCH_DEFAULT, LLDB_ARCH_DEFAULT_32BIT) == 0)
-                arch.SetTriple (LLDB_ARCH_DEFAULT_64BIT);
-            else
-                arch.SetTriple (LLDB_ARCH_DEFAULT_32BIT);
-
-            error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
-        }
+        error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, true, target_sp);
 
         if (error.Success())
         {
@@ -499,20 +484,7 @@
         TargetSP target_sp;
         Error error;
 
-        if (!arch.IsValid())
-            arch.SetTriple (LLDB_ARCH_DEFAULT);
-
-        error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
-
-        if (error.Fail())
-        {
-            if (strcmp (LLDB_ARCH_DEFAULT, LLDB_ARCH_DEFAULT_32BIT) == 0)
-                arch.SetTriple (LLDB_ARCH_DEFAULT_64BIT);
-            else
-                arch.SetTriple (LLDB_ARCH_DEFAULT_32BIT);
-
-            error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, NULL, true, target_sp);
-        }
+        error = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp, file, arch, true, target_sp);
 
         if (error.Success())
         {
diff --git a/source/Commands/CommandObjectFile.cpp b/source/Commands/CommandObjectFile.cpp
index 50f3394..fa62bad 100644
--- a/source/Commands/CommandObjectFile.cpp
+++ b/source/Commands/CommandObjectFile.cpp
@@ -138,9 +138,8 @@
 
         TargetSP target_sp;
 
-        ArchSpec arch = m_options.m_arch;
         Debugger &debugger = m_interpreter.GetDebugger();
-        Error error = debugger.GetTargetList().CreateTarget (debugger, file_spec, m_options.m_arch, NULL, true, target_sp);
+        Error error = debugger.GetTargetList().CreateTarget (debugger, file_spec, m_options.m_arch, true, target_sp);
 
         if (target_sp)
         {
diff --git a/source/Commands/CommandObjectProcess.cpp b/source/Commands/CommandObjectProcess.cpp
index 9b2b2a4..0dbc9b8 100644
--- a/source/Commands/CommandObjectProcess.cpp
+++ b/source/Commands/CommandObjectProcess.cpp
@@ -18,8 +18,9 @@
 #include "lldb/Core/State.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
-#include "./CommandObjectThread.h"
+#include "CommandObjectThread.h"
 #include "lldb/Host/Host.h"
+#include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
@@ -518,38 +519,24 @@
                 
                 // Look to see if there is a -P argument provided, and if so use that plugin, otherwise
                 // use the default plugin.
-                Process *process = interpeter.GetDebugger().GetExecutionContext().process;
-                bool need_to_delete_process = false;
                 
                 const char *partial_name = NULL;
                 partial_name = input.GetArgumentAtIndex(opt_arg_pos);
-                
-                if (process && process->IsAlive())
-                    return true;
-                    
-                Target *target = interpeter.GetDebugger().GetSelectedTarget().get();
-                if (target == NULL)
+
+                PlatformSP platform_sp (Platform::GetSelectedPlatform ());
+                if (platform_sp)
                 {
-                    // No target has been set yet, for now do host completion.  Otherwise I don't know how we would
-                    // figure out what the right target to use is...
-                    std::vector<lldb::pid_t> pids;
-                    Host::ListProcessesMatchingName (partial_name, matches, pids);
-                    return true;
-                }
-                if (!process)
-                {
-                    process = target->CreateProcess (interpeter.GetDebugger().GetListener(), partial_name).get();
-                    need_to_delete_process = true;
-                }
-                
-                if (process)
-                {
-                    matches.Clear();
-                    std::vector<lldb::pid_t> pids;
-                    process->ListProcessesMatchingName (NULL, matches, pids);
-                    if (need_to_delete_process)
-                        target->DeleteCurrentProcess();
-                    return true;
+                    ProcessInfoList process_infos;
+                    platform_sp->FindProcessesByName (partial_name, partial_name ? lldb::eNameMatchStartsWith : lldb::eNameMatchIgnore, process_infos);
+                    const uint32_t num_matches = process_infos.GetSize();
+                    if (num_matches > 0)
+                    {
+                        for (uint32_t i=0; i<num_matches; ++i)
+                        {
+                            matches.AppendString (process_infos.GetProcessNameAtIndex(i), 
+                                                  process_infos.GetProcessNameLengthAtIndex(i));
+                        }
+                    }
                 }
             }
             
@@ -612,7 +599,6 @@
             error = m_interpreter.GetDebugger().GetTargetList().CreateTarget (m_interpreter.GetDebugger(), 
                                                                               emptyFileSpec,
                                                                               emptyArchSpec, 
-                                                                              NULL, 
                                                                               false,
                                                                               new_target_sp);
             target = new_target_sp.get();
@@ -716,17 +702,19 @@
                     
                     if (attach_pid == LLDB_INVALID_PROCESS_ID && wait_name != NULL)
                     {
-                        std::vector<lldb::pid_t> pids;
-                        StringList matches;
-                        
-                        process->ListProcessesMatchingName(wait_name, matches, pids);
-                        if (matches.GetSize() > 1)
+                        ProcessInfoList process_infos;
+                        PlatformSP platform_sp (Platform::GetSelectedPlatform ());
+                        if (platform_sp)
+                        {
+                            platform_sp->FindProcessesByName (wait_name, eNameMatchEquals, process_infos);
+                        }
+                        if (process_infos.GetSize() > 1)
                         {
                             result.AppendErrorWithFormat("More than one process named %s\n", wait_name);
                             result.SetStatus (eReturnStatusFailed);
                             return false;
                         }
-                        else if (matches.GetSize() == 0)
+                        else if (process_infos.GetSize() == 0)
                         {
                             result.AppendErrorWithFormat("Could not find a process named %s\n", wait_name);
                             result.SetStatus (eReturnStatusFailed);
@@ -734,9 +722,8 @@
                         }
                         else 
                         {
-                            attach_pid = pids[0];
+                            attach_pid = process_infos.GetProcessIDAtIndex (0);
                         }
-
                     }
 
                     if (attach_pid != LLDB_INVALID_PROCESS_ID)
@@ -1085,7 +1072,6 @@
             error = m_interpreter.GetDebugger().GetTargetList().CreateTarget (m_interpreter.GetDebugger(), 
                                                                               emptyFileSpec,
                                                                               emptyArchSpec, 
-                                                                              NULL, 
                                                                               false,
                                                                               target_sp);
             if (!target_sp || error.Fail())
diff --git a/source/Core/ArchSpec.cpp b/source/Core/ArchSpec.cpp
index 3d59d28..f15f02a 100644
--- a/source/Core/ArchSpec.cpp
+++ b/source/Core/ArchSpec.cpp
@@ -456,36 +456,6 @@
     return IsValid();
 }
 
-//bool
-//ArchSpec::SetArchitecture (const char *arch_name)
-//{
-//    return SetArchitecture(llvm::StringRef (arch_name));
-//}
-//
-//bool
-//ArchSpec::SetArchitecture (const llvm::StringRef& arch_name)
-//{
-//    // All default architecture names start with LLDB_ARCH_DEFAULT.
-//    if (arch_name.startswith (LLDB_ARCH_DEFAULT))
-//    {
-//        // Special case for the current host default architectures...
-//        if (arch_name.equals (LLDB_ARCH_DEFAULT_32BIT))
-//            *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
-//        else if (arch_name.equals (LLDB_ARCH_DEFAULT_64BIT))
-//            *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture64);
-//        else
-//            *this = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
-//    }
-//    else
-//    {
-//        const CoreDefinition *core_def = FindCoreDefinition (arch_name);
-//        if (core_def)
-//            m_core = core_def->core;
-//        CoreUpdated(true);
-//    }
-//    return IsValid();
-//}
-//
 bool
 ArchSpec::SetArchitecture (lldb::ArchitectureType arch_type, uint32_t cpu, uint32_t sub)
 {
diff --git a/source/Core/Error.cpp b/source/Core/Error.cpp
index da13717..6614769 100644
--- a/source/Core/Error.cpp
+++ b/source/Core/Error.cpp
@@ -100,7 +100,7 @@
         switch (m_type)
         {
         case eErrorTypeMachKernel:
-#ifdef __APPLE__
+#if defined (__APPLE__)
             s = ::mach_error_string (m_code);
 #endif
             break;
diff --git a/source/Core/PluginManager.cpp b/source/Core/PluginManager.cpp
index 3c2907e..12bb486 100644
--- a/source/Core/PluginManager.cpp
+++ b/source/Core/PluginManager.cpp
@@ -1194,17 +1194,153 @@
     return NULL;
 }
 
-#pragma mark Process
+#pragma mark Platform
 
-struct ProcessInstance
+struct PlatformInstance
 {
-    ProcessInstance() :
+    PlatformInstance() :
         name(),
         description(),
         create_callback(NULL)
     {
     }
+    
+    std::string name;
+    std::string description;
+    PlatformCreateInstance create_callback;
+};
 
+typedef std::vector<PlatformInstance> PlatformInstances;
+
+static bool
+AccessPlatformInstances (PluginAction action, PlatformInstance &instance, uint32_t index)
+{
+    static PlatformInstances g_plugin_instances;
+    
+    switch (action)
+    {
+        case ePluginRegisterInstance:
+            if (instance.create_callback)
+            {
+                g_plugin_instances.push_back (instance);
+                return true;
+            }
+            break;
+            
+        case ePluginUnregisterInstance:
+            if (instance.create_callback)
+            {
+                PlatformInstances::iterator pos, end = g_plugin_instances.end();
+                for (pos = g_plugin_instances.begin(); pos != end; ++ pos)
+                {
+                    if (pos->create_callback == instance.create_callback)
+                    {
+                        g_plugin_instances.erase(pos);
+                        return true;
+                    }
+                }
+            }
+            break;
+            
+        case ePluginGetInstanceAtIndex:
+            if (index < g_plugin_instances.size())
+            {
+                instance = g_plugin_instances[index];
+                return true;
+            }
+            break;
+            
+        default:
+            break;
+    }
+    return false;
+}
+
+
+bool
+PluginManager::RegisterPlugin (const char *name,
+                               const char *description,
+                               PlatformCreateInstance create_callback)
+{
+    if (create_callback)
+    {
+        PlatformInstance instance;
+        assert (name && name[0]);
+        instance.name = name;
+        if (description && description[0])
+            instance.description = description;
+        instance.create_callback = create_callback;
+        return AccessPlatformInstances (ePluginRegisterInstance, instance, 0);
+    }
+    return false;
+}
+
+const char *
+PluginManager::GetPlatformPluginNameAtIndex (uint32_t idx)
+{
+    PlatformInstance instance;
+    if (AccessPlatformInstances (ePluginGetInstanceAtIndex, instance, idx))
+        return instance.name.c_str();
+    return NULL;
+}
+
+const char *
+PluginManager::GetPlatformPluginDescriptionAtIndex (uint32_t idx)
+{
+    PlatformInstance instance;
+    if (AccessPlatformInstances (ePluginGetInstanceAtIndex, instance, idx))
+        return instance.description.c_str();
+    return NULL;
+}
+
+bool
+PluginManager::UnregisterPlugin (PlatformCreateInstance create_callback)
+{
+    if (create_callback)
+    {
+        PlatformInstance instance;
+        instance.create_callback = create_callback;
+        return AccessPlatformInstances (ePluginUnregisterInstance, instance, 0);
+    }
+    return false;
+}
+
+PlatformCreateInstance
+PluginManager::GetPlatformCreateCallbackAtIndex (uint32_t idx)
+{
+    PlatformInstance instance;
+    if (AccessPlatformInstances (ePluginGetInstanceAtIndex, instance, idx))
+        return instance.create_callback;
+    return NULL;
+}
+
+PlatformCreateInstance
+PluginManager::GetPlatformCreateCallbackForPluginName (const char *name)
+{
+    if (name && name[0])
+    {
+        PlatformInstance instance;
+        std::string ss_name(name);
+        for (uint32_t idx = 0; AccessPlatformInstances (ePluginGetInstanceAtIndex, instance, idx); ++idx)
+        {
+            if (instance.name == ss_name)
+                return instance.create_callback;
+        }
+    }
+    return NULL;
+}
+
+#pragma mark Process
+
+struct ProcessInstance
+{
+    ProcessInstance() :
+    name(),
+    description(),
+    create_callback(NULL)
+    {
+    }
+    
     std::string name;
     std::string description;
     ProcessCreateInstance create_callback;
@@ -1216,42 +1352,42 @@
 AccessProcessInstances (PluginAction action, ProcessInstance &instance, uint32_t index)
 {
     static ProcessInstances g_plugin_instances;
-
+    
     switch (action)
     {
-    case ePluginRegisterInstance:
-        if (instance.create_callback)
-        {
-            g_plugin_instances.push_back (instance);
-            return true;
-        }
-        break;
-
-    case ePluginUnregisterInstance:
-        if (instance.create_callback)
-        {
-            ProcessInstances::iterator pos, end = g_plugin_instances.end();
-            for (pos = g_plugin_instances.begin(); pos != end; ++ pos)
+        case ePluginRegisterInstance:
+            if (instance.create_callback)
             {
-                if (pos->create_callback == instance.create_callback)
+                g_plugin_instances.push_back (instance);
+                return true;
+            }
+            break;
+            
+        case ePluginUnregisterInstance:
+            if (instance.create_callback)
+            {
+                ProcessInstances::iterator pos, end = g_plugin_instances.end();
+                for (pos = g_plugin_instances.begin(); pos != end; ++ pos)
                 {
-                    g_plugin_instances.erase(pos);
-                    return true;
+                    if (pos->create_callback == instance.create_callback)
+                    {
+                        g_plugin_instances.erase(pos);
+                        return true;
+                    }
                 }
             }
-        }
-        break;
-
-    case ePluginGetInstanceAtIndex:
-        if (index < g_plugin_instances.size())
-        {
-            instance = g_plugin_instances[index];
-            return true;
-        }
-        break;
-
-    default:
-        break;
+            break;
+            
+        case ePluginGetInstanceAtIndex:
+            if (index < g_plugin_instances.size())
+            {
+                instance = g_plugin_instances[index];
+                return true;
+            }
+            break;
+            
+        default:
+            break;
     }
     return false;
 }
@@ -1260,10 +1396,10 @@
 bool
 PluginManager::RegisterPlugin
 (
-    const char *name,
-    const char *description,
-    ProcessCreateInstance create_callback
-)
+ const char *name,
+ const char *description,
+ ProcessCreateInstance create_callback
+ )
 {
     if (create_callback)
     {
diff --git a/source/Host/common/Host.cpp b/source/Host/common/Host.cpp
index cb6a3cf..37516ba 100644
--- a/source/Host/common/Host.cpp
+++ b/source/Host/common/Host.cpp
@@ -11,14 +11,16 @@
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/Error.h"
-#include "lldb/Host/FileSpec.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Host/Config.h"
 #include "lldb/Host/Endian.h"
+#include "lldb/Host/FileSpec.h"
 #include "lldb/Host/Mutex.h"
+#include "lldb/Target/Process.h"
 
 #include "llvm/Support/Host.h"
+#include "llvm/Support/MachO.h"
 
 #include <dlfcn.h>
 #include <errno.h>
@@ -1027,11 +1029,66 @@
     return false;
 }
 
-uint32_t
-Host::ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids)
-{
-    uint32_t num_matches = 0;
+#if defined (__APPLE__)
 
+static bool
+GetMacOSXProcessName (lldb::pid_t pid, 
+                      NameMatchType name_match_type,
+                      const char *name_match, 
+                      ProcessInfo &proc_info)
+{
+    char process_name[MAXCOMLEN * 2 + 1];
+    int name_len = ::proc_name(pid, process_name, MAXCOMLEN * 2);
+    if (name_len == 0)
+        return false;
+    
+    if (NameMatches(process_name, name_match_type, name_match))
+    {
+        proc_info.SetName (process_name);
+        return true;
+    }
+    else
+    {
+        proc_info.SetName (NULL);
+        return false;
+    }
+}
+
+
+static bool
+GetMacOSXProcessCPUType (lldb::pid_t pid, ProcessInfo &proc_info)
+{
+        // Make a new mib to stay thread safe
+    int mib[CTL_MAXNAME]={0,};
+    size_t mib_len = CTL_MAXNAME;
+    if (::sysctlnametomib("sysctl.proc_cputype", mib, &mib_len)) 
+        return false;
+    
+    mib[mib_len] = pid;
+    mib_len++;
+    
+    cpu_type_t cpu, sub;
+    size_t cpu_len = sizeof(cpu);
+    if (::sysctl (mib, mib_len, &cpu, &cpu_len, 0, 0) == 0)
+    {
+        switch (cpu)
+        {
+            case llvm::MachO::CPUTypeI386:      sub = llvm::MachO::CPUSubType_I386_ALL;     break;
+            case llvm::MachO::CPUTypeX86_64:    sub = llvm::MachO::CPUSubType_X86_64_ALL;   break;
+            default: break;
+        }
+        proc_info.GetArchitecture ().SetArchitecture (lldb::eArchTypeMachO, cpu, sub);
+        return true;
+    }
+    return false;
+}
+
+#endif
+
+uint32_t
+Host::FindProcessesByName (const char *name, NameMatchType name_match_type, ProcessInfoList &process_infos)
+{
+    process_infos.Clear();
 #if defined (__APPLE__)
     int num_pids;
     int size_of_pids;
@@ -1064,56 +1121,35 @@
              || (bsd_info.pbi_status == SZOMB)
              || (bsd_info.pbi_pid == our_pid))
              continue;
-        char pid_name[MAXCOMLEN * 2 + 1];
-        int name_len;
-        name_len = proc_name(bsd_info.pbi_pid, pid_name, MAXCOMLEN * 2);
-        if (name_len == 0)
-            continue;
         
-        if (strstr(pid_name, name) != pid_name)
-            continue;
-        matches.AppendString (pid_name);
-        pids.push_back (bsd_info.pbi_pid);
-        num_matches++;        
+        ProcessInfo process_info;
+        if (GetMacOSXProcessName (bsd_info.pbi_pid, name_match_type, name, process_info))
+        {
+            process_info.SetProcessID (bsd_info.pbi_pid);
+            GetMacOSXProcessCPUType (bsd_info.pbi_pid, process_info);
+            process_infos.Append (process_info);
+        }
     }
 #endif
     
-    return num_matches;
+    return process_infos.GetSize();
 }
 
-ArchSpec
-Host::GetArchSpecForExistingProcess (lldb::pid_t pid)
+bool
+Host::GetProcessInfo (lldb::pid_t pid, ProcessInfo &process_info)
 {
-    ArchSpec return_spec;
-
 #if defined (__APPLE__)
-    struct proc_bsdinfo bsd_info;
-    int error = proc_pidinfo (pid, PROC_PIDTBSDINFO, (uint64_t) 0, &bsd_info, PROC_PIDTBSDINFO_SIZE);
-    if (error == 0)
-        return return_spec;
-    if (bsd_info.pbi_flags & PROC_FLAG_LP64)
-        return_spec.SetTriple (LLDB_ARCH_DEFAULT_64BIT);
-    else 
-        return_spec.SetTriple (LLDB_ARCH_DEFAULT_32BIT);
-#endif
-        
-    return return_spec;
-}
 
-ArchSpec
-Host::GetArchSpecForExistingProcess (const char *process_name)
-{
-    ArchSpec returnSpec;
-    StringList matches;
-    std::vector<lldb::pid_t> pids;
-    if (ListProcessesMatchingName(process_name, matches, pids))
+    if (GetMacOSXProcessName (pid, eNameMatchIgnore, NULL, process_info))
     {
-        if (matches.GetSize() == 1)
-        {
-            return GetArchSpecForExistingProcess(pids[0]);
-        }
-    }
-    return returnSpec;
+        process_info.SetProcessID (pid);
+        if (GetMacOSXProcessCPUType (pid, process_info) == false)
+            process_info.GetArchitecture().Clear();
+        return true;
+    }    
+#endif
+    process_info.Clear();
+    return false;
 }
 
 #if !defined (__APPLE__) // see macosx/Host.mm
diff --git a/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp b/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
index 4fb96ce..a65a2ef 100644
--- a/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
+++ b/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
@@ -595,21 +595,3 @@
     return 1;
 }
 
-void
-ABIMacOSX_i386::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ABIMacOSX_i386::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-ABIMacOSX_i386::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
diff --git a/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h b/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
index 140b8af..20dbc4a 100644
--- a/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
+++ b/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
@@ -77,14 +77,6 @@
         virtual uint32_t
         GetPluginVersion();
         
-        virtual void
-        GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-        
-        virtual lldb_private::Error
-        ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-        
-        virtual lldb_private::Log *
-        EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
     protected:
     private:
         ABIMacOSX_i386() : lldb_private::ABI() { } // Call CreateInstance instead.
diff --git a/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
index 93537cf..5c2cd74 100644
--- a/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
+++ b/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
@@ -481,21 +481,3 @@
     return 1;
 }
 
-void
-ABISysV_x86_64::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ABISysV_x86_64::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-ABISysV_x86_64::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
diff --git a/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h b/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
index fa2e924..beb6178 100644
--- a/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
+++ b/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
@@ -76,14 +76,6 @@
     virtual uint32_t
     GetPluginVersion();
 
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
 protected:
 private:
     ABISysV_x86_64() : lldb_private::ABI() { } // Call CreateInstance instead.
diff --git a/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
index edecaa1..dd3491c 100644
--- a/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
+++ b/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
@@ -469,22 +469,3 @@
     return 1;
 }
 
-void
-DisassemblerLLVM::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-DisassemblerLLVM::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-DisassemblerLLVM::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
diff --git a/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h b/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h
index 515814d..69ac743 100644
--- a/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h
+++ b/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h
@@ -92,15 +92,6 @@
     virtual uint32_t
     GetPluginVersion();
 
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
 protected:
     bool
     IsValid() const
diff --git a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
index 67958c9..7493667 100644
--- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -1298,23 +1298,3 @@
     return 1;
 }
 
-void
-DynamicLoaderMacOSXDYLD::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-DynamicLoaderMacOSXDYLD::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-DynamicLoaderMacOSXDYLD::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
-
diff --git a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
index d557510..9655b4b 100644
--- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
+++ b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
@@ -81,17 +81,6 @@
     virtual uint32_t
     GetPluginVersion();
 
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
-
-
 protected:
     void
     PrivateInitialize (lldb_private::Process *process);
diff --git a/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp b/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
index 75482a8..290619e 100644
--- a/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
+++ b/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
@@ -194,23 +194,3 @@
     return 1;
 }
 
-void
-DynamicLoaderStatic::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-DynamicLoaderStatic::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-DynamicLoaderStatic::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
-
diff --git a/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h b/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h
index 66c0971..3bdb016 100644
--- a/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h
+++ b/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h
@@ -81,15 +81,6 @@
     virtual uint32_t
     GetPluginVersion();
 
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
 private:
     void
     LoadAllImagesAtFileAddresses ();
diff --git a/source/Plugins/Instruction/ARM/EmulateInstructionARM.h b/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
index e420d0c..9729974 100644
--- a/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
+++ b/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
@@ -85,25 +85,6 @@
         return 1;
     }
 
-    virtual void
-    GetPluginCommandHelp (const char *command, Stream *strm)
-    {
-    }
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (Args &command, Stream *strm)
-    {
-        Error error;
-        error.SetErrorString("no plug-in commands are supported");
-        return error;
-    }
-
-    virtual Log *
-    EnablePluginLogging (Stream *strm, Args &command)
-    {
-        return NULL;
-    }
-
     enum Mode
     {
         eModeInvalid,
diff --git a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
index 8a7cfc2..4f6c129 100644
--- a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -101,25 +101,6 @@
 }
 
 void
-ItaniumABILanguageRuntime::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ItaniumABILanguageRuntime::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-ItaniumABILanguageRuntime::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
-void
 ItaniumABILanguageRuntime::SetExceptionBreakpoints ()
 {
     if (!m_process)
diff --git a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
index 113ed51..580d2d6 100644
--- a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
+++ b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
@@ -58,15 +58,6 @@
         GetPluginVersion();
         
         virtual void
-        GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-        
-        virtual lldb_private::Error
-        ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-        
-        virtual lldb_private::Log *
-        EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-        
-        virtual void
         SetExceptionBreakpoints ();
         
         virtual void
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index 892b4bd..75eb468 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -274,28 +274,6 @@
     return lldb::eObjC_VersionUnknown;
 }
 
-//------------------------------------------------------------------
-// PluginInterface protocol
-//------------------------------------------------------------------
-void
-AppleObjCRuntime::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-AppleObjCRuntime::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-AppleObjCRuntime::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
 void
 AppleObjCRuntime::ClearExceptionBreakpoints ()
 {
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
index baf735d..1577434 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
@@ -74,15 +74,7 @@
     // PluginInterface protocol
     //------------------------------------------------------------------
 public:
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-    
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-    
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-    
+
     virtual void
     ClearExceptionBreakpoints ();
     
diff --git a/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
index 7ff54c7..757d0d1 100644
--- a/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
+++ b/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
@@ -405,24 +405,3 @@
     return 1;
 }
 
-void
-ObjectContainerBSDArchive::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ObjectContainerBSDArchive::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-ObjectContainerBSDArchive::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
-
-
diff --git a/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h b/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
index 8173029..2b45a13 100644
--- a/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
+++ b/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
@@ -81,16 +81,6 @@
     virtual uint32_t
     GetPluginVersion();
 
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
-
 protected:
 
     struct Object
diff --git a/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp b/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
index 7ff1943..4fe6489 100644
--- a/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
+++ b/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
@@ -248,24 +248,4 @@
     return 1;
 }
 
-void
-ObjectContainerUniversalMachO::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ObjectContainerUniversalMachO::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-ObjectContainerUniversalMachO::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
-
 
diff --git a/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h b/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
index 8f0b231..8cc0fbd 100644
--- a/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
+++ b/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
@@ -83,16 +83,6 @@
     virtual uint32_t
     GetPluginVersion();
 
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
-
 protected:
     llvm::MachO::fat_header m_header;
     std::vector<llvm::MachO::fat_arch> m_fat_archs;
diff --git a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 2d5471d..67b6a5e 100644
--- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -107,26 +107,6 @@
 {
     return m_plugin_version;
 }
-
-void
-ObjectFileELF::GetPluginCommandHelp(const char *command, Stream *strm)
-{
-}
-
-Error
-ObjectFileELF::ExecutePluginCommand(Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in commands are currently supported.");
-    return error;
-}
-
-Log *
-ObjectFileELF::EnablePluginLogging(Stream *strm, Args &command)
-{
-    return NULL;
-}
-
 //------------------------------------------------------------------
 // ObjectFile protocol
 //------------------------------------------------------------------
diff --git a/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
index ebfde89..2ac4a63 100644
--- a/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
+++ b/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -63,17 +63,6 @@
     virtual uint32_t
     GetPluginVersion();
 
-    virtual void
-    GetPluginCommandHelp(const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand(lldb_private::Args &command,
-                         lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging(lldb_private::Stream *strm, 
-                        lldb_private::Args &command);
-
     //------------------------------------------------------------------
     // ObjectFile Protocol.
     //------------------------------------------------------------------
diff --git a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index fa88b18..56d3daf 100644
--- a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1598,25 +1598,3 @@
     return 1;
 }
 
-void
-ObjectFileMachO::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ObjectFileMachO::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-ObjectFileMachO::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
-
-
-
diff --git a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
index 1289b9d..c079fe4 100644
--- a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
+++ b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
@@ -104,15 +104,6 @@
     virtual uint32_t
     GetPluginVersion();
 
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
     virtual lldb_private::Address
     GetEntryPointAddress ();
 
diff --git a/source/Plugins/Platform/Linux/PlatformLinux.cpp b/source/Plugins/Platform/Linux/PlatformLinux.cpp
new file mode 100644
index 0000000..a118a2b
--- /dev/null
+++ b/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -0,0 +1,186 @@
+//===-- PlatformLinux.cpp ---------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PlatformLinux.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Core/Error.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleList.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/Host/FileSpec.h"
+#include "lldb/Host/Host.h"
+#include "lldb/Target/Process.h"
+
+using namespace lldb;
+using namespace lldb_private;
+    
+void
+PlatformLinux::Initialize ()
+{
+#if defined (__linux__)
+    PlatformSP default_platform_sp (new PlatformLinux());
+    Platform::SetDefaultPlatform (default_platform_sp);
+#endif
+}
+
+void
+PlatformLinux::Terminate ()
+{
+}
+
+
+Error
+PlatformLinux::ResolveExecutable (const FileSpec &exe_file,
+                                  const ArchSpec &exe_arch,
+                                  lldb::ModuleSP &exe_module_sp)
+{
+    Error error;
+    // Nothing special to do here, just use the actual file and architecture
+
+    FileSpec resolved_exe_file (exe_file);
+    
+    // If we have "ls" as the exe_file, resolve the executable loation based on
+    // the current path variables
+    if (!resolved_exe_file.Exists())
+        resolved_exe_file.ResolveExecutableLocation ();
+
+    // Resolve any executable within a bundle on MacOSX
+    Host::ResolveExecutableInBundle (resolved_exe_file);
+
+    if (resolved_exe_file.Exists())
+    {
+        if (exe_arch.IsValid())
+        {
+            error = ModuleList::GetSharedModule (resolved_exe_file, 
+                                                 exe_arch, 
+                                                 NULL,
+                                                 NULL, 
+                                                 0, 
+                                                 exe_module_sp, 
+                                                 NULL, 
+                                                 NULL);
+        
+            if (exe_module_sp->GetObjectFile() == NULL)
+            {
+                exe_module_sp.reset();
+                error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain the architecture %s",
+                                                exe_file.GetDirectory().AsCString(""),
+                                                exe_file.GetDirectory() ? "/" : "",
+                                                exe_file.GetFilename().AsCString(""),
+                                                exe_arch.GetArchitectureName());
+            }
+        }
+        else
+        {
+            // No valid architecture was specified, ask the platform for
+            // the architectures that we should be using (in the correct order)
+            // and see if we can find a match that way
+            StreamString arch_names;
+            ArchSpec platform_arch;
+            for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
+            {
+                error = ModuleList::GetSharedModule (resolved_exe_file, 
+                                                     platform_arch, 
+                                                     NULL,
+                                                     NULL, 
+                                                     0, 
+                                                     exe_module_sp, 
+                                                     NULL, 
+                                                     NULL);
+                // Did we find an executable using one of the 
+                if (error.Success())
+                {
+                    if (exe_module_sp && exe_module_sp->GetObjectFile())
+                        break;
+                    else
+                        error.SetErrorToGenericError();
+                }
+                
+                if (idx > 0)
+                    arch_names.PutCString (", ");
+                arch_names.PutCString (platform_arch.GetArchitectureName());
+            }
+            
+            if (error.Fail() || !exe_module_sp)
+            {
+                error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain any '%s' platform architectures: %s",
+                                                exe_file.GetDirectory().AsCString(""),
+                                                exe_file.GetDirectory() ? "/" : "",
+                                                exe_file.GetFilename().AsCString(""),
+                                                GetShortPluginName(),
+                                                arch_names.GetString().c_str());
+            }
+        }
+    }
+    else
+    {
+        error.SetErrorStringWithFormat ("'%s%s%s' does not exist",
+                                        exe_file.GetDirectory().AsCString(""),
+                                        exe_file.GetDirectory() ? "/" : "",
+                                        exe_file.GetFilename().AsCString(""));
+    }
+
+    return error;
+}
+
+Error
+PlatformLinux::GetFile (const FileSpec &platform_file, FileSpec &local_file)
+{
+    // Default to the local case
+    local_file = platform_file;
+    return Error();
+}
+
+
+//------------------------------------------------------------------
+/// Default Constructor
+//------------------------------------------------------------------
+PlatformLinux::PlatformLinux () :
+    Platform()
+{
+}
+
+//------------------------------------------------------------------
+/// Destructor.
+///
+/// The destructor is virtual since this class is designed to be
+/// inherited from by the plug-in instance.
+//------------------------------------------------------------------
+PlatformLinux::~PlatformLinux()
+{
+}
+
+uint32_t
+PlatformLinux::FindProcessesByName (const char *name_match, 
+                                    lldb::NameMatchType name_match_type,
+                                    ProcessInfoList &process_infos)
+{
+    return Host::FindProcessesByName (name_match, name_match_type, process_infos);
+}
+
+bool
+PlatformLinux::GetProcessInfo (lldb::pid_t pid, ProcessInfo &process_info)
+{
+    return Host::GetProcessInfo (pid, process_info);
+}
+
+bool
+PlatformLinux::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
+{
+    if (idx == 0)
+    {
+        arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+        return arch.IsValid();
+    }
+    return false;
+}
diff --git a/source/Plugins/Platform/Linux/PlatformLinux.h b/source/Plugins/Platform/Linux/PlatformLinux.h
new file mode 100644
index 0000000..c6ede76
--- /dev/null
+++ b/source/Plugins/Platform/Linux/PlatformLinux.h
@@ -0,0 +1,89 @@
+//===-- PlatformLinux.h -----------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_PlatformLinux_h_
+#define liblldb_PlatformLinux_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Target/Platform.h"
+
+namespace lldb_private {
+
+    class PlatformLinux : public Platform
+    {
+    public:
+
+        static void
+        Initialize ();
+
+        static void
+        Terminate ();
+        
+        PlatformLinux ();
+
+        virtual
+        ~PlatformLinux();
+
+        //------------------------------------------------------------
+        // lldb_private::PluginInterface functions
+        //------------------------------------------------------------
+        virtual const char *
+        GetPluginName()
+        {
+            return "PlatformLinux";
+        }
+        
+        virtual const char *
+        GetShortPluginName()
+        {
+            return "platform.linux";
+        }
+        
+        virtual uint32_t
+        GetPluginVersion()
+        {
+            return 1;
+        }
+        
+
+        //------------------------------------------------------------
+        // lldb_private::Platform functions
+        //------------------------------------------------------------
+        virtual Error
+        ResolveExecutable (const FileSpec &exe_file,
+                           const ArchSpec &arch,
+                           lldb::ModuleSP &module_sp);
+
+        virtual Error
+        GetFile (const FileSpec &platform_file, FileSpec &local_file);
+
+        virtual uint32_t
+        FindProcessesByName (const char *name_match, 
+                             lldb::NameMatchType name_match_type,
+                             ProcessInfoList &process_infos);
+
+        virtual bool
+        GetProcessInfo (lldb::pid_t pid, ProcessInfo &proc_info);
+
+        virtual bool
+        GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch);
+
+    protected:
+        
+        
+    private:
+        DISALLOW_COPY_AND_ASSIGN (PlatformLinux);
+
+    };
+} // namespace lldb_private
+
+#endif  // liblldb_PlatformLinux_h_
diff --git a/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
new file mode 100644
index 0000000..b1df7ba
--- /dev/null
+++ b/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -0,0 +1,199 @@
+//===-- Platform.cpp --------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "PlatformMacOSX.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Core/Error.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleList.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/Host/FileSpec.h"
+#include "lldb/Host/Host.h"
+#include "lldb/Target/Process.h"
+
+using namespace lldb;
+using namespace lldb_private;
+    
+void
+PlatformMacOSX::Initialize ()
+{
+#if defined (__APPLE__)
+    PlatformSP default_platform_sp (new PlatformMacOSX());
+    Platform::SetDefaultPlatform (default_platform_sp);
+#endif
+}
+
+void
+PlatformMacOSX::Terminate ()
+{
+}
+
+
+Error
+PlatformMacOSX::ResolveExecutable (const FileSpec &exe_file,
+                                   const ArchSpec &exe_arch,
+                                   lldb::ModuleSP &exe_module_sp)
+{
+    Error error;
+    // Nothing special to do here, just use the actual file and architecture
+
+    FileSpec resolved_exe_file (exe_file);
+    
+    // If we have "ls" as the exe_file, resolve the executable loation based on
+    // the current path variables
+    if (!resolved_exe_file.Exists())
+        resolved_exe_file.ResolveExecutableLocation ();
+
+    // Resolve any executable within a bundle on MacOSX
+    Host::ResolveExecutableInBundle (resolved_exe_file);
+
+    if (resolved_exe_file.Exists())
+    {
+        if (exe_arch.IsValid())
+        {
+            error = ModuleList::GetSharedModule (resolved_exe_file, 
+                                                 exe_arch, 
+                                                 NULL,
+                                                 NULL, 
+                                                 0, 
+                                                 exe_module_sp, 
+                                                 NULL, 
+                                                 NULL);
+        
+            if (exe_module_sp->GetObjectFile() == NULL)
+            {
+                exe_module_sp.reset();
+                error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain the architecture %s",
+                                                exe_file.GetDirectory().AsCString(""),
+                                                exe_file.GetDirectory() ? "/" : "",
+                                                exe_file.GetFilename().AsCString(""),
+                                                exe_arch.GetArchitectureName());
+            }
+        }
+        else
+        {
+            // No valid architecture was specified, ask the platform for
+            // the architectures that we should be using (in the correct order)
+            // and see if we can find a match that way
+            StreamString arch_names;
+            ArchSpec platform_arch;
+            for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
+            {
+                error = ModuleList::GetSharedModule (resolved_exe_file, 
+                                                     platform_arch, 
+                                                     NULL,
+                                                     NULL, 
+                                                     0, 
+                                                     exe_module_sp, 
+                                                     NULL, 
+                                                     NULL);
+                // Did we find an executable using one of the 
+                if (error.Success())
+                {
+                    if (exe_module_sp && exe_module_sp->GetObjectFile())
+                        break;
+                    else
+                        error.SetErrorToGenericError();
+                }
+                
+                if (idx > 0)
+                    arch_names.PutCString (", ");
+                arch_names.PutCString (platform_arch.GetArchitectureName());
+            }
+            
+            if (error.Fail() || !exe_module_sp)
+            {
+                error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain any '%s' platform architectures: %s",
+                                                exe_file.GetDirectory().AsCString(""),
+                                                exe_file.GetDirectory() ? "/" : "",
+                                                exe_file.GetFilename().AsCString(""),
+                                                GetShortPluginName(),
+                                                arch_names.GetString().c_str());
+            }
+        }
+    }
+    else
+    {
+        error.SetErrorStringWithFormat ("'%s%s%s' does not exist",
+                                        exe_file.GetDirectory().AsCString(""),
+                                        exe_file.GetDirectory() ? "/" : "",
+                                        exe_file.GetFilename().AsCString(""));
+    }
+
+    return error;
+}
+
+Error
+PlatformMacOSX::GetFile (const FileSpec &platform_file, FileSpec &local_file)
+{
+    // Default to the local case
+    local_file = platform_file;
+    return Error();
+}
+
+
+//------------------------------------------------------------------
+/// Default Constructor
+//------------------------------------------------------------------
+PlatformMacOSX::PlatformMacOSX () :
+    Platform()
+{
+}
+
+//------------------------------------------------------------------
+/// Destructor.
+///
+/// The destructor is virtual since this class is designed to be
+/// inherited from by the plug-in instance.
+//------------------------------------------------------------------
+PlatformMacOSX::~PlatformMacOSX()
+{
+}
+
+uint32_t
+PlatformMacOSX::FindProcessesByName (const char *name_match, 
+                                     lldb::NameMatchType name_match_type,
+                                     ProcessInfoList &process_infos)
+{
+    return Host::FindProcessesByName (name_match, name_match_type, process_infos);
+}
+
+bool
+PlatformMacOSX::GetProcessInfo (lldb::pid_t pid, ProcessInfo &process_info)
+{
+    return Host::GetProcessInfo (pid, process_info);
+}
+
+bool
+PlatformMacOSX::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
+{
+    if (idx == 0)
+    {
+        arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
+        return arch.IsValid();
+    }
+    else if (idx == 1)
+    {
+        ArchSpec platform_arch (Host::GetArchitecture (Host::eSystemDefaultArchitecture));
+        ArchSpec platform_arch64 (Host::GetArchitecture (Host::eSystemDefaultArchitecture64));
+        if (platform_arch == platform_arch64)
+        {
+            // This macosx platform supports both 32 and 64 bit. Since we already
+            // returned the 64 bit arch for idx == 0, return the 32 bit arch 
+            // for idx == 1
+            arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+            return arch.IsValid();
+        }
+    }
+    return false;
+}
diff --git a/source/Plugins/Platform/MacOSX/PlatformMacOSX.h b/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
new file mode 100644
index 0000000..037cac2
--- /dev/null
+++ b/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
@@ -0,0 +1,89 @@
+//===-- PlatformMacOSX.h ----------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_PlatformMacOSX_h_
+#define liblldb_PlatformMacOSX_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Target/Platform.h"
+
+namespace lldb_private {
+
+    class PlatformMacOSX : public Platform
+    {
+    public:
+
+        static void
+        Initialize ();
+
+        static void
+        Terminate ();
+        
+        PlatformMacOSX ();
+
+        virtual
+        ~PlatformMacOSX();
+
+        //------------------------------------------------------------
+        // lldb_private::PluginInterface functions
+        //------------------------------------------------------------
+        virtual const char *
+        GetPluginName()
+        {
+            return "PlatformMacOSX";
+        }
+        
+        virtual const char *
+        GetShortPluginName()
+        {
+            return "platform.macosx";
+        }
+        
+        virtual uint32_t
+        GetPluginVersion()
+        {
+            return 1;
+        }
+        
+
+        //------------------------------------------------------------
+        // lldb_private::Platform functions
+        //------------------------------------------------------------
+        virtual Error
+        ResolveExecutable (const FileSpec &exe_file,
+                           const ArchSpec &arch,
+                           lldb::ModuleSP &module_sp);
+
+        virtual Error
+        GetFile (const FileSpec &platform_file, FileSpec &local_file);
+
+        virtual uint32_t
+        FindProcessesByName (const char *name_match, 
+                             lldb::NameMatchType name_match_type,
+                             ProcessInfoList &process_infos);
+
+        virtual bool
+        GetProcessInfo (lldb::pid_t pid, ProcessInfo &proc_info);
+
+        virtual bool
+        GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch);
+
+    protected:
+        
+        
+    private:
+        DISALLOW_COPY_AND_ASSIGN (PlatformMacOSX);
+
+    };
+} // namespace lldb_private
+
+#endif  // liblldb_Platform_h_
diff --git a/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp b/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
index 464500c..3106e34 100644
--- a/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
+++ b/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp
@@ -269,40 +269,6 @@
     return 1;
 }
 
-void
-ProcessMacOSX::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-    strm->Printf("The following arguments can be supplied to the 'log %s' command:\n", GetShortPluginName());
-    strm->PutCString("\tverbose - enable verbose logging\n");
-    strm->PutCString("\tprocess - enable process logging\n");
-    strm->PutCString("\tthread - enable thread logging\n");
-    strm->PutCString("\texceptions - enable exception logging\n");
-    strm->PutCString("\tdynamic - enable DynamicLoader logging\n");
-    strm->PutCString("\tmemory-calls - enable memory read and write call logging\n");
-    strm->PutCString("\tmemory-data-short - log short memory read and write byte data\n");
-    strm->PutCString("\tmemory-data-long - log all memory read and write byte data\n");
-    strm->PutCString("\tmemory-protections - log memory protection calls\n");
-    strm->PutCString("\tbreakpoints - log breakpoint calls\n");
-    strm->PutCString("\twatchpoints - log watchpoint calls\n");
-    strm->PutCString("\tevents - log event and event queue status\n");
-    strm->PutCString("\tstep - log step related activity\n");
-    strm->PutCString("\ttask - log task functions\n");
-}
-
-Error
-ProcessMacOSX::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-ProcessMacOSX::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
 //----------------------------------------------------------------------
 // Process Control
 //----------------------------------------------------------------------
@@ -2178,10 +2144,10 @@
     }
 }
 
-uint32_t
-ProcessMacOSX::ListProcessesMatchingName (const char *name, lldb_private::StringList &matches, std::vector<lldb::pid_t> &pids)
-{
-    return Host::ListProcessesMatchingName (name, matches, pids);
-}
+//uint32_t
+//ProcessMacOSX::ListProcessesMatchingName (const char *name, lldb_private::StringList &matches, std::vector<lldb::pid_t> &pids)
+//{
+//    return Host::ListProcessesMatchingName (name, matches, pids);
+//}
 
 
diff --git a/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h b/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
index f2ab6cf..85ce151 100644
--- a/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
+++ b/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h
@@ -114,8 +114,8 @@
     virtual void
     DidAttach ();
     
-    virtual uint32_t
-    ListProcessesMatchingName (const char *name, lldb_private::StringList &matches, std::vector<lldb::pid_t> &pids);
+//    virtual uint32_t
+//    ListProcessesMatchingName (const char *name, lldb_private::StringList &matches, std::vector<lldb::pid_t> &pids);
 
     //------------------------------------------------------------------
     // PluginInterface protocol
@@ -129,15 +129,6 @@
     virtual uint32_t
     GetPluginVersion();
 
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
     //------------------------------------------------------------------
     // Process Control
     //------------------------------------------------------------------
diff --git a/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.cpp b/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.cpp
index 20e3ef7..f73bdde 100644
--- a/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.cpp
+++ b/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.cpp
@@ -68,26 +68,6 @@
 {
     return 1;
 }
-
-void
-ArchDefaultUnwindPlan_x86_64::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ArchDefaultUnwindPlan_x86_64::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-ArchDefaultUnwindPlan_x86_64::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
 void
 ArchDefaultUnwindPlan_x86_64::Initialize()
 {
@@ -178,25 +158,6 @@
 }
 
 void
-ArchDefaultUnwindPlan_i386::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ArchDefaultUnwindPlan_i386::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-ArchDefaultUnwindPlan_i386::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
-void
 ArchDefaultUnwindPlan_i386::Initialize()
 {
     PluginManager::RegisterPlugin (GetPluginNameStatic(),
diff --git a/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h b/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h
index d3f4b26..a0d315c 100644
--- a/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h
+++ b/source/Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h
@@ -53,15 +53,6 @@
     virtual uint32_t
     GetPluginVersion();
     
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-    
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-    
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
 private:
     ArchDefaultUnwindPlan_x86_64();        // Call CreateInstance instead.
 
@@ -104,15 +95,6 @@
     virtual uint32_t
     GetPluginVersion();
     
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-    
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-    
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
 private:
     ArchDefaultUnwindPlan_i386();        // Call CreateInstance instead.
 
diff --git a/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp b/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp
index 19eda66..b47f54a 100644
--- a/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp
+++ b/source/Plugins/Process/Utility/ArchVolatileRegs-x86.cpp
@@ -121,25 +121,6 @@
 }
 
 void
-ArchVolatileRegs_x86::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-ArchVolatileRegs_x86::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-ArchVolatileRegs_x86::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
-void
 ArchVolatileRegs_x86::Initialize()
 {
     PluginManager::RegisterPlugin (GetPluginNameStatic(),
diff --git a/source/Plugins/Process/Utility/ArchVolatileRegs-x86.h b/source/Plugins/Process/Utility/ArchVolatileRegs-x86.h
index 516f126..4aa5828 100644
--- a/source/Plugins/Process/Utility/ArchVolatileRegs-x86.h
+++ b/source/Plugins/Process/Utility/ArchVolatileRegs-x86.h
@@ -53,15 +53,6 @@
     virtual uint32_t
     GetPluginVersion();
     
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-    
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-    
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
 private:
     ArchVolatileRegs_x86(llvm::Triple::ArchType cpu);        // Call CreateInstance instead.
 
diff --git a/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp b/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
index 8f0f7d4..83255e2 100644
--- a/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
+++ b/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.cpp
@@ -880,25 +880,6 @@
 }
 
 void
-UnwindAssemblyProfiler_x86::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-UnwindAssemblyProfiler_x86::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-UnwindAssemblyProfiler_x86::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
-void
 UnwindAssemblyProfiler_x86::Initialize()
 {
     PluginManager::RegisterPlugin (GetPluginNameStatic(),
diff --git a/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.h b/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.h
index 2e99ebd..637c504 100644
--- a/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.h
+++ b/source/Plugins/Process/Utility/UnwindAssemblyProfiler-x86.h
@@ -60,15 +60,6 @@
     virtual uint32_t
     GetPluginVersion();
     
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-    
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-    
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
 private:
     UnwindAssemblyProfiler_x86(int cpu) : 
           lldb_private::UnwindAssemblyProfiler(), m_cpu(cpu) { } // Call CreateInstance instead.
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index df09bf3..ab6c915 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -164,26 +164,6 @@
 }
 
 void
-ProcessGDBRemote::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-    strm->Printf("TODO: fill this in\n");
-}
-
-Error
-ProcessGDBRemote::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in commands are currently supported.");
-    return error;
-}
-
-Log *
-ProcessGDBRemote::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
-void
 ProcessGDBRemote::BuildDynamicRegisterInfo (bool force)
 {
     if (!force && m_register_info.GetNumRegisters() > 0)
@@ -2456,23 +2436,23 @@
     return dispatch_queue_name.c_str();
 }
 
-uint32_t
-ProcessGDBRemote::ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids)
-{
-    // If we are planning to launch the debugserver remotely, then we need to fire up a debugserver
-    // process and ask it for the list of processes. But if we are local, we can let the Host do it.
-    if (m_local_debugserver)
-    {
-        return Host::ListProcessesMatchingName (name, matches, pids);
-    }
-    else 
-    {
-        // FIXME: Implement talking to the remote debugserver.
-        return 0;
-    }
-
-}
-
+//uint32_t
+//ProcessGDBRemote::ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids)
+//{
+//    // If we are planning to launch the debugserver remotely, then we need to fire up a debugserver
+//    // process and ask it for the list of processes. But if we are local, we can let the Host do it.
+//    if (m_local_debugserver)
+//    {
+//        return Host::ListProcessesMatchingName (name, matches, pids);
+//    }
+//    else 
+//    {
+//        // FIXME: Implement talking to the remote debugserver.
+//        return 0;
+//    }
+//
+//}
+//
 bool
 ProcessGDBRemote::NewThreadNotifyBreakpointHit (void *baton,
                              lldb_private::StoppointCallbackContext *context,
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index bd61ed2..c8fb6fc 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -68,8 +68,8 @@
     virtual bool
     CanDebug (lldb_private::Target &target);
 
-    virtual uint32_t
-    ListProcessesMatchingName (const char *name, lldb_private::StringList &matches, std::vector<lldb::pid_t> &pids);
+//    virtual uint32_t
+//    ListProcessesMatchingName (const char *name, lldb_private::StringList &matches, std::vector<lldb::pid_t> &pids);
 
     //------------------------------------------------------------------
     // Creating a new process, or attaching to an existing one
@@ -123,15 +123,6 @@
     virtual uint32_t
     GetPluginVersion();
 
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
     //------------------------------------------------------------------
     // Process Control
     //------------------------------------------------------------------
diff --git a/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp b/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
index d053def..9e9f644 100644
--- a/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
+++ b/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
@@ -90,28 +90,6 @@
 
 
 void
-LogChannelDWARF::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-
-Error
-LogChannelDWARF::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorStringWithFormat("No commands are supported.\n");
-    return error;
-}
-
-
-Log *
-LogChannelDWARF::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
-
-void
 LogChannelDWARF::Delete ()
 {
     g_log_channel = NULL;
diff --git a/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h b/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
index 6105651..b1d8597 100644
--- a/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
+++ b/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
@@ -58,15 +58,6 @@
     GetPluginVersion();
 
     virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
-    virtual void
     Disable (lldb_private::Args &args, lldb_private::Stream *feedback_strm);
 
     void
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 83dd42f..54b627f 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -4271,25 +4271,6 @@
 }
 
 void
-SymbolFileDWARF::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-SymbolFileDWARF::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-SymbolFileDWARF::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
-void
 SymbolFileDWARF::CompleteTagDecl (void *baton, clang::TagDecl *decl)
 {
     SymbolFileDWARF *symbol_file_dwarf = (SymbolFileDWARF *)baton;
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index f2acbf7..8585d01 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -140,15 +140,6 @@
     virtual uint32_t
     GetPluginVersion();
 
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
     // Approach 2 - count + accessor
     // Index compile units would scan the initial compile units and register
     // them with the module. This would only be done on demand if and only if
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 2a2dd63..59b0feb 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -1087,26 +1087,6 @@
 }
 
 void
-SymbolFileDWARFDebugMap::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-SymbolFileDWARFDebugMap::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-SymbolFileDWARFDebugMap::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
-
-void
 SymbolFileDWARFDebugMap::SetCompileUnit (SymbolFileDWARF *oso_dwarf, const CompUnitSP &cu_sp)
 {
     const uint32_t cu_count = GetNumCompileUnits();
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
index 742fb06..9a95ac8 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -100,15 +100,6 @@
     virtual uint32_t
     GetPluginVersion();
 
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
 protected:
     enum
     {
diff --git a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index f524a51..d055062 100644
--- a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -381,23 +381,3 @@
 {
     return 1;
 }
-
-void
-SymbolFileSymtab::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-SymbolFileSymtab::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-SymbolFileSymtab::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
diff --git a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
index fc6a52c..f95e0ce 100644
--- a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
+++ b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
@@ -117,17 +117,6 @@
     virtual uint32_t
     GetPluginVersion();
 
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
-
-
 protected:
     std::vector<uint32_t>   m_source_indexes;
     std::vector<uint32_t>   m_func_indexes;
diff --git a/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
index 516093b..3dd4a4d 100644
--- a/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ b/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -316,22 +316,3 @@
     return 1;
 }
 
-void
-SymbolVendorMacOSX::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-SymbolVendorMacOSX::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-SymbolVendorMacOSX::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
diff --git a/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h b/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h
index adbf648..66509c7 100644
--- a/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h
+++ b/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h
@@ -54,16 +54,6 @@
     virtual uint32_t
     GetPluginVersion();
 
-    virtual void
-    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Error
-    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
-
-    virtual lldb_private::Log *
-    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
-
-
 private:
     DISALLOW_COPY_AND_ASSIGN (SymbolVendorMacOSX);
 };
diff --git a/source/Symbol/SymbolVendor.cpp b/source/Symbol/SymbolVendor.cpp
index 361a276..391d225 100644
--- a/source/Symbol/SymbolVendor.cpp
+++ b/source/Symbol/SymbolVendor.cpp
@@ -346,23 +346,3 @@
     return 1;
 }
 
-void
-SymbolVendor::GetPluginCommandHelp (const char *command, Stream *strm)
-{
-}
-
-Error
-SymbolVendor::ExecutePluginCommand (Args &command, Stream *strm)
-{
-    Error error;
-    error.SetErrorString("No plug-in command are currently supported.");
-    return error;
-}
-
-Log *
-SymbolVendor::EnablePluginLogging (Stream *strm, Args &command)
-{
-    return NULL;
-}
-
-
diff --git a/source/Target/Platform.cpp b/source/Target/Platform.cpp
new file mode 100644
index 0000000..497df24
--- /dev/null
+++ b/source/Target/Platform.cpp
@@ -0,0 +1,230 @@
+//===-- Platform.cpp --------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Target/Platform.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Core/Error.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Host/FileSpec.h"
+#include "lldb/Target/Target.h"
+
+using namespace lldb;
+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 ()
+{
+    static PlatformSP g_default_platform_sp;
+    return g_default_platform_sp;
+}
+
+static PlatformSP&
+GetSelectedPlatformSP ()
+{
+    static PlatformSP g_selected_platform_sp;
+    return g_selected_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;
+}
+
+//------------------------------------------------------------------
+/// Get the native host platform plug-in. 
+///
+/// There should only be one of these for each host that LLDB runs
+/// upon that should be statically compiled in and registered using
+/// preprocessor macros or other similar build mechanisms.
+///
+/// This platform will be used as the default platform when launching
+/// or attaching to processes unless another platform is specified.
+//------------------------------------------------------------------
+PlatformSP
+Platform::GetDefaultPlatform ()
+{
+    return GetDefaultPlatformSP ();
+}
+
+void
+Platform::SetDefaultPlatform (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;
+}
+
+PlatformSP
+Platform::GetSelectedPlatform ()
+{
+    PlatformSP platform_sp (GetSelectedPlatformSP ());
+    if (!platform_sp)
+        platform_sp = GetDefaultPlatform (); 
+    return platform_sp;
+}
+
+void
+Platform::SetSelectedPlatform (const lldb::PlatformSP &platform_sp)
+{
+    // The native platform should use its static void Platform::Initialize()
+    // function to register itself as the native platform.
+    GetSelectedPlatformSP () = platform_sp;
+}
+
+
+Error
+Platform::GetFile (const FileSpec &platform_file, FileSpec &local_file)
+{
+    // Default to the local case
+    local_file = platform_file;
+    return Error();
+}
+
+
+PlatformSP
+Platform::ConnectRemote (const char *platform_name, const char *remote_connect_url, Error &error)
+{
+    PlatformCreateInstance create_callback = NULL;
+    lldb::PlatformSP platform_sp;
+    if (platform_name)
+    {
+        create_callback = PluginManager::GetPlatformCreateCallbackForPluginName (platform_name);
+        if (create_callback)
+        {
+            platform_sp.reset(create_callback());
+            if (platform_sp)
+                error = platform_sp->ConnectRemote (remote_connect_url);
+            else
+                error.SetErrorStringWithFormat ("unable to create a platform instance of \"%s\"", platform_name);
+        }
+        else
+            error.SetErrorStringWithFormat ("invalid platform name \"%s\"", platform_name);
+    }
+    else
+        error.SetErrorString ("Empty platform name");
+    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
+//------------------------------------------------------------------
+Platform::Platform () :
+    m_remote_url ()
+{
+}
+
+//------------------------------------------------------------------
+/// Destructor.
+///
+/// The destructor is virtual since this class is designed to be
+/// inherited from by the plug-in instance.
+//------------------------------------------------------------------
+Platform::~Platform()
+{
+}
+
+Error
+Platform::ResolveExecutable (const FileSpec &exe_file,
+                             const ArchSpec &exe_arch,
+                             lldb::ModuleSP &exe_module_sp)
+{
+    Error error;
+    if (exe_file.Exists())
+    {
+        if (exe_arch.IsValid())
+        {
+            error = ModuleList::GetSharedModule (exe_file, 
+                                                 exe_arch, 
+                                                 NULL,
+                                                 NULL, 
+                                                 0, 
+                                                 exe_module_sp, 
+                                                 NULL, 
+                                                 NULL);
+        }
+        else
+        {
+            // No valid architecture was specified, ask the platform for
+            // the architectures that we should be using (in the correct order)
+            // and see if we can find a match that way
+            ArchSpec platform_arch;
+            for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
+            {
+                error = ModuleList::GetSharedModule (exe_file, 
+                                                     platform_arch, 
+                                                     NULL,
+                                                     NULL, 
+                                                     0, 
+                                                     exe_module_sp, 
+                                                     NULL, 
+                                                     NULL);
+                // Did we find an executable using one of the 
+                if (error.Success() && exe_module_sp)
+                    break;
+            }
+        }
+    }
+    else
+    {
+        error.SetErrorStringWithFormat ("'%s%s%s' does not exist",
+                                        exe_file.GetDirectory().AsCString(""),
+                                        exe_file.GetDirectory() ? "/" : "",
+                                        exe_file.GetFilename().AsCString(""));
+    }
+    return error;
+}
+
+Error
+Platform::ConnectRemote (const char *remote_url)
+{
+    Error error;
+    error.SetErrorStringWithFormat ("Platform::ConnectRemote() is not supported by %s", GetShortPluginName());
+    return error;
+}
+
+Error
+Platform::DisconnectRemote (const lldb::PlatformSP &platform_sp)
+{
+    Error error;
+    error.SetErrorStringWithFormat ("Platform::DisconnectRemote() is not supported by %s", GetShortPluginName());
+    return error;
+}
diff --git a/source/Target/Process.cpp b/source/Target/Process.cpp
index 6d2861d..f1fb3bb 100644
--- a/source/Target/Process.cpp
+++ b/source/Target/Process.cpp
@@ -27,6 +27,7 @@
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
+#include "lldb/Target/Platform.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/StopInfo.h"
 #include "lldb/Target/Target.h"
@@ -1659,11 +1660,16 @@
     // Find the process and its architecture.  Make sure it matches the architecture
     // of the current Target, and if not adjust it.
     
-    ArchSpec attach_spec = GetArchSpecForExistingProcess (attach_pid);
-    if (attach_spec != GetTarget().GetArchitecture())
+    ProcessInfo process_info;
+    PlatformSP platform_sp (Platform::GetSelectedPlatform ());
+    if (platform_sp)
     {
-        // Set the architecture on the target.
-        GetTarget().SetArchitecture(attach_spec);
+        if (platform_sp->GetProcessInfo (attach_pid, process_info))
+        {
+            const ArchSpec &process_arch = process_info.GetArchitecture();
+            if (process_arch.IsValid())
+                GetTarget().SetArchitecture(process_arch);
+        }
     }
 
     m_dyld_ap.reset();
@@ -1703,40 +1709,69 @@
     
     // Find the process and its architecture.  Make sure it matches the architecture
     // of the current Target, and if not adjust it.
+    Error error;
     
     if (!wait_for_launch)
     {
-        ArchSpec attach_spec = GetArchSpecForExistingProcess (process_name);
-        if (attach_spec.IsValid() && attach_spec != GetTarget().GetArchitecture())
+        ProcessInfoList process_infos;
+        PlatformSP platform_sp (Platform::GetSelectedPlatform ());
+        if (platform_sp)
         {
-            // Set the architecture on the target.
-            GetTarget().SetArchitecture(attach_spec);
-        }
-    }
-
-    m_dyld_ap.reset();
-    
-    Error error (WillAttachToProcessWithName(process_name, wait_for_launch));
-    if (error.Success())
-    {
-        SetPublicState (eStateAttaching);
-        error = DoAttachToProcessWithName (process_name, wait_for_launch);
-        if (error.Fail())
-        {
-            if (GetID() != LLDB_INVALID_PROCESS_ID)
+            platform_sp->FindProcessesByName (process_name, eNameMatchEquals, process_infos);
+            if (process_infos.GetSize() > 1)
             {
-                SetID (LLDB_INVALID_PROCESS_ID);
-                const char *error_string = error.AsCString();
-                if (error_string == NULL)
-                    error_string = "attach failed";
-
-                SetExitStatus(-1, error_string);
+                error.SetErrorStringWithFormat ("More than one process named %s\n", process_name);
+            }
+            else if (process_infos.GetSize() == 0)
+            {
+                error.SetErrorStringWithFormat ("Could not find a process named %s\n", process_name);
+            }
+            else 
+            {
+                ProcessInfo process_info;
+                if (process_infos.GetInfoAtIndex (0, process_info))
+                {
+                    const ArchSpec &process_arch = process_info.GetArchitecture();
+                    if (process_arch.IsValid() && process_arch != GetTarget().GetArchitecture())
+                    {
+                        // Set the architecture on the target.
+                        GetTarget().SetArchitecture (process_arch);
+                    }
+                }
             }
         }
         else
+        {        
+            error.SetErrorString ("Invalid platform");
+        }
+    }
+
+    if (error.Success())
+    {
+        m_dyld_ap.reset();
+        
+        error = WillAttachToProcessWithName(process_name, wait_for_launch);
+        if (error.Success())
         {
-            SetNextEventAction(new Process::AttachCompletionHandler(this));
-            StartPrivateStateThread();
+            SetPublicState (eStateAttaching);
+            error = DoAttachToProcessWithName (process_name, wait_for_launch);
+            if (error.Fail())
+            {
+                if (GetID() != LLDB_INVALID_PROCESS_ID)
+                {
+                    SetID (LLDB_INVALID_PROCESS_ID);
+                    const char *error_string = error.AsCString();
+                    if (error_string == NULL)
+                        error_string = "attach failed";
+
+                    SetExitStatus(-1, error_string);
+                }
+            }
+            else
+            {
+                SetNextEventAction(new Process::AttachCompletionHandler(this));
+                StartPrivateStateThread();
+            }
         }
     }
     return error;
@@ -2503,24 +2538,24 @@
     return GetTarget().GetProcessSP();
 }
 
-uint32_t
-Process::ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids)
-{
-    return 0;
-}
-    
-ArchSpec
-Process::GetArchSpecForExistingProcess (lldb::pid_t pid)
-{
-    return Host::GetArchSpecForExistingProcess (pid);
-}
-
-ArchSpec
-Process::GetArchSpecForExistingProcess (const char *process_name)
-{
-    return Host::GetArchSpecForExistingProcess (process_name);
-}
-
+//uint32_t
+//Process::ListProcessesMatchingName (const char *name, StringList &matches, std::vector<lldb::pid_t> &pids)
+//{
+//    return 0;
+//}
+//    
+//ArchSpec
+//Process::GetArchSpecForExistingProcess (lldb::pid_t pid)
+//{
+//    return Host::GetArchSpecForExistingProcess (pid);
+//}
+//
+//ArchSpec
+//Process::GetArchSpecForExistingProcess (const char *process_name)
+//{
+//    return Host::GetArchSpecForExistingProcess (process_name);
+//}
+//
 void
 Process::AppendSTDOUT (const char * s, size_t len)
 {
@@ -3281,7 +3316,6 @@
     m_input_path (),
     m_output_path (),
     m_error_path (),
-    m_plugin (),
     m_disable_aslr (true),
     m_disable_stdio (false),
     m_inherit_host_env (true),
@@ -3313,7 +3347,6 @@
     m_input_path (rhs.m_input_path),
     m_output_path (rhs.m_output_path),
     m_error_path (rhs.m_error_path),
-    m_plugin (rhs.m_plugin),
     m_disable_aslr (rhs.m_disable_aslr),
     m_disable_stdio (rhs.m_disable_stdio)
 {
@@ -3339,7 +3372,6 @@
         m_input_path = rhs.m_input_path;
         m_output_path = rhs.m_output_path;
         m_error_path = rhs.m_error_path;
-        m_plugin = rhs.m_plugin;
         m_disable_aslr = rhs.m_disable_aslr;
         m_disable_stdio = rhs.m_disable_stdio;
         m_inherit_host_env = rhs.m_inherit_host_env;
@@ -3372,10 +3404,6 @@
         UserSettingsController::UpdateStringVariable (op, m_output_path, value, err);
     else if (var_name == ErrorPathVarName())
         UserSettingsController::UpdateStringVariable (op, m_error_path, value, err);
-    else if (var_name == PluginVarName())
-        UserSettingsController::UpdateEnumVariable (entry.enum_values, (int *) &m_plugin, value, err);
-    else if (var_name == InheritHostEnvVarName())
-        UserSettingsController::UpdateBooleanVariable (op, m_inherit_host_env, value, err);
     else if (var_name == DisableASLRVarName())
         UserSettingsController::UpdateBooleanVariable (op, m_disable_aslr, value, err);
     else if (var_name == DisableSTDIOVarName ())
@@ -3396,7 +3424,6 @@
     m_input_path = new_process_settings->m_input_path;
     m_output_path = new_process_settings->m_output_path;
     m_error_path = new_process_settings->m_error_path;
-    m_plugin = new_process_settings->m_plugin;
     m_disable_aslr = new_process_settings->m_disable_aslr;
     m_disable_stdio = new_process_settings->m_disable_stdio;
 }
@@ -3442,10 +3469,6 @@
     {
         value.AppendString (m_error_path.c_str());
     }
-    else if (var_name == PluginVarName())
-    {
-        value.AppendString (UserSettingsController::EnumToString (entry.enum_values, (int) m_plugin));
-    }
     else if (var_name == InheritHostEnvVarName())
     {
         if (m_inherit_host_env)
@@ -3538,15 +3561,6 @@
 }
 
 const ConstString &
-ProcessInstanceSettings::PluginVarName ()
-{
-    static ConstString plugin_var_name ("plugin");
-
-    return plugin_var_name;
-}
-
-
-const ConstString &
 ProcessInstanceSettings::DisableASLRVarName ()
 {
     static ConstString disable_aslr_var_name ("disable-aslr");
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index e1e73c2..ca400fc 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -412,21 +412,26 @@
             m_arch_spec = exe_arch;
         
         FileSpecList dependent_files;
-        ObjectFile * executable_objfile = executable_sp->GetObjectFile();
-        if (executable_objfile == NULL)
-        {
-
-            FileSpec bundle_executable(executable_sp->GetFileSpec());
-            if (Host::ResolveExecutableInBundle (bundle_executable))
-            {
-                ModuleSP bundle_exe_module_sp(GetSharedModule(bundle_executable,
-                                                              exe_arch));
-                SetExecutableModule (bundle_exe_module_sp, get_dependent_files);
-                if (bundle_exe_module_sp->GetObjectFile() != NULL)
-                    executable_sp = bundle_exe_module_sp;
-                return;
-            }
-        }
+        ObjectFile *executable_objfile = executable_sp->GetObjectFile();
+        assert (executable_objfile);
+        // TODO: remote assertion above after verifying that it doesn't fire off
+        // after the platform changes. The platform is what should be selecting
+        // the right slice of an executable file, and it also should be the one
+        // to resolve any executables in their bundles.
+//        if (executable_objfile == NULL)
+//        {
+//
+//            FileSpec bundle_executable(executable_sp->GetFileSpec());
+//            if (Host::ResolveExecutableInBundle (bundle_executable))
+//            {
+//                ModuleSP bundle_exe_module_sp(GetSharedModule(bundle_executable,
+//                                                              exe_arch));
+//                SetExecutableModule (bundle_exe_module_sp, get_dependent_files);
+//                if (bundle_exe_module_sp->GetObjectFile() != NULL)
+//                    executable_sp = bundle_exe_module_sp;
+//                return;
+//            }
+//        }
 
         if (executable_objfile)
         {
diff --git a/source/Target/TargetList.cpp b/source/Target/TargetList.cpp
index af681d2..25b768f 100644
--- a/source/Target/TargetList.cpp
+++ b/source/Target/TargetList.cpp
@@ -16,6 +16,7 @@
 #include "lldb/Core/State.h"
 #include "lldb/Core/Timer.h"
 #include "lldb/Host/Host.h"
+#include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/TargetList.h"
 
@@ -49,44 +50,28 @@
     Debugger &debugger,
     const FileSpec& file,
     const ArchSpec& arch,
-    const lldb_private::UUID *uuid_ptr,
     bool get_dependent_files,
     TargetSP &target_sp
 )
 {
     Timer scoped_timer (__PRETTY_FUNCTION__,
-                        "TargetList::CreateTarget (file = '%s/%s', arch = '%s', uuid = %p)",
+                        "TargetList::CreateTarget (file = '%s/%s', arch = '%s')",
                         file.GetDirectory().AsCString(),
                         file.GetFilename().AsCString(),
-                        arch.GetArchitectureName(),
-                        uuid_ptr);
+                        arch.GetArchitectureName());
     Error error;
     
-    if (!file)
-    {
-        target_sp.reset(new Target(debugger));
-        target_sp->SetArchitecture(arch);
-    }
-    else
+    if (file)
     {
         ModuleSP exe_module_sp;
         FileSpec resolved_file(file);
+        ArchSpec platform_arch;
         
-        if (!resolved_file.Exists())
-            resolved_file.ResolveExecutableLocation ();
-            
-        if (!Host::ResolveExecutableInBundle (resolved_file))
-            resolved_file = file;
+        PlatformSP platform_sp (Platform::GetSelectedPlatform ());
+        if (platform_sp)
+            error = platform_sp->ResolveExecutable (file, arch, exe_module_sp);
 
-        error = ModuleList::GetSharedModule (resolved_file, 
-                                             arch, 
-                                             uuid_ptr, 
-                                             NULL, 
-                                             0, 
-                                             exe_module_sp, 
-                                             NULL, 
-                                             NULL);
-        if (exe_module_sp)
+        if (error.Success() && exe_module_sp)
         {
             if (exe_module_sp->GetObjectFile() == NULL)
             {
@@ -111,44 +96,24 @@
             target_sp->SetExecutableModule (exe_module_sp, get_dependent_files);
         }
     }
-
-    if (target_sp.get())
-        target_sp->UpdateInstanceName();
-    
-    if (target_sp.get())
+    else
     {
+        // No file was specified, just create an empty target with any arch
+        // if a valid arch was specified
+        target_sp.reset(new Target(debugger));
+        if (arch.IsValid())
+            target_sp->SetArchitecture(arch);
+    }
+
+    if (target_sp)
+    {
+        target_sp->UpdateInstanceName();        
+
         Mutex::Locker locker(m_target_list_mutex);
         m_selected_target_idx = m_target_list.size();
         m_target_list.push_back(target_sp);
     }
 
-//        target_sp.reset(new Target);
-//        // Let the target resolve any funky bundle paths before we try and get
-//        // the object file...
-//        target_sp->SetExecutableModule (exe_module_sp, get_dependent_files);
-//        if (exe_module_sp->GetObjectFile() == NULL)
-//        {
-//            error.SetErrorStringWithFormat("%s%s%s: doesn't contain architecture %s",
-//                                           file.GetDirectory().AsCString(),
-//                                           file.GetDirectory() ? "/" : "",
-//                                           file.GetFilename().AsCString(),
-//                                           arch.AsCString());
-//        }
-//        else
-//        {
-//            if (target_sp.get())
-//            {
-//                error.Clear();
-//                Mutex::Locker locker(m_target_list_mutex);
-//                m_selected_target_idx = m_target_list.size();
-//                m_target_list.push_back(target_sp);
-//            }
-//        }
-    else
-    {
-        target_sp.reset();
-    }
-
     return error;
 }
 
diff --git a/source/lldb.cpp b/source/lldb.cpp
index b78cc4d..8096153 100644
--- a/source/lldb.cpp
+++ b/source/lldb.cpp
@@ -12,6 +12,7 @@
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Core/RegularExpression.h"
 #include "lldb/Core/Timer.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/Mutex.h"
@@ -19,6 +20,8 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 
+#include "llvm/ADT/StringRef.h"
+
 #include "Plugins/Disassembler/llvm/DisassemblerLLVM.h"
 #include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h"
 #include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h"
@@ -30,7 +33,7 @@
 #include "Plugins/Process/Utility/ArchDefaultUnwindPlan-x86.h"
 #include "Plugins/Process/Utility/ArchVolatileRegs-x86.h"
 
-#ifdef __APPLE__
+#if defined (__APPLE__)
 #include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h"
 #include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
 #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
@@ -41,11 +44,13 @@
 #include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
 #include "Plugins/Process/MacOSX-User/source/ProcessMacOSX.h"
 #include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
+#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
 #endif
 
-#ifdef __linux__
-#include "Plugins/Process/Linux/ProcessLinux.h"
+#if defined (__linux__)
 #include "Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.h"
+#include "Plugins/Platform/Linux/PlatformLinux.h"
+#include "Plugins/Process/Linux/ProcessLinux.h"
 #endif
 
 #include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
@@ -83,7 +88,7 @@
         ArchVolatileRegs_x86::Initialize();
         ScriptInterpreter::Initialize ();
 
-#ifdef __APPLE__
+#if defined (__APPLE__)
         ABIMacOSX_i386::Initialize();
         ABISysV_x86_64::Initialize();
         DynamicLoaderMacOSXDYLD::Initialize();
@@ -96,8 +101,10 @@
         ProcessGDBRemote::Initialize();
         //ProcessMacOSX::Initialize();
         SymbolVendorMacOSX::Initialize();
+        PlatformMacOSX::Initialize();
 #endif
-#ifdef __linux__
+#if defined (__linux__)
+        ProcessLinux::Initialize();
         ProcessLinux::Initialize();
         DynamicLoaderLinuxDYLD::Initialize();
 #endif
@@ -136,7 +143,7 @@
     ArchVolatileRegs_x86::Terminate();
     ScriptInterpreter::Terminate ();
 
-#ifdef __APPLE__
+#if defined (__APPLE__)
     DynamicLoaderMacOSXDYLD::Terminate();
     SymbolFileDWARFDebugMap::Terminate();
     ItaniumABILanguageRuntime::Terminate();
@@ -147,13 +154,15 @@
     ProcessGDBRemote::Terminate();
     //ProcessMacOSX::Terminate();
     SymbolVendorMacOSX::Terminate();
+    PlatformMacOSX::Terminate();
 #endif
 
     Thread::Terminate ();
     Process::Terminate ();
     Target::Terminate ();
 
-#ifdef __linux__
+#if defined (__linux__)
+    PlatformLinux::Terminate();
     ProcessLinux::Terminate();
     DynamicLoaderLinuxDYLD::Terminate();
 #endif
@@ -227,3 +236,39 @@
 
 }
 
+bool
+lldb_private::NameMatches (const char *name, 
+                           lldb::NameMatchType match_type, 
+                           const char *match)
+{
+    if (match_type == eNameMatchIgnore)
+        return true;
+
+    if (name == match)
+        return true;
+
+    if (name && match)
+    {
+        llvm::StringRef name_sref(name);
+        llvm::StringRef match_sref(match);
+        switch (match_type)
+        {
+        case eNameMatchIgnore:
+            return true;
+        case eNameMatchEquals:      return name_sref == match_sref;
+        case eNameMatchContains:    return name_sref.find (match_sref) != llvm::StringRef::npos;
+        case eNameMatchStartsWith:  return name_sref.startswith (match_sref);
+        case eNameMatchEndsWith:    return name_sref.endswith (match_sref);
+        case eNameMatchRegularExpression:
+            {
+                RegularExpression regex (match);
+                return regex.Execute (name);
+            }
+            break;
+        default:
+            assert (!"unhandled NameMatchType in lldb_private::NameMatches()");
+            break;
+        }
+    }
+    return false;
+}