Enabled the PlatformLinux and PlatforFreeBSD on MacOSX so they can be used
and also so we don't break them with our code changes.

The _only_ plug-ins that should be #ifdef'ed out and not compiled in LLDB
are those that only work when running natively on the host system.

This fixed bot the PlatformLinux and PlatformFreeBSD build breakages that
were due to ModuleSpec changes.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151539 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
index 1a7e346..ecc96c3 100644
--- a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
+++ b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
@@ -155,7 +155,8 @@
             }
             else
             {
-                error.SetErrorStringWithFormat("the platform is not currently connected, and '%s' doesn't exist in the system root.");
+                exe_file.GetPath(exe_path, sizeof(exe_path));
+                error.SetErrorStringWithFormat("the platform is not currently connected, and '%s' doesn't exist in the system root.", exe_path);
             }
         }
     }
diff --git a/source/Plugins/Platform/Linux/PlatformLinux.cpp b/source/Plugins/Platform/Linux/PlatformLinux.cpp
index d93ad01..80c9a86 100644
--- a/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -93,7 +93,8 @@
 Error
 PlatformLinux::ResolveExecutable (const FileSpec &exe_file,
                                   const ArchSpec &exe_arch,
-                                  lldb::ModuleSP &exe_module_sp)
+                                  lldb::ModuleSP &exe_module_sp,
+                                  const FileSpecList *module_search_paths_ptr)
 {
     Error error;
     // Nothing special to do here, just use the actual file and architecture
@@ -144,13 +145,10 @@
 
     if (error.Success())
     {
+        ModuleSpec module_spec (resolved_exe_file, exe_arch);
         if (exe_arch.IsValid())
         {
-            error = ModuleList::GetSharedModule (resolved_exe_file, 
-                                                 exe_arch, 
-                                                 NULL,
-                                                 NULL, 
-                                                 0, 
+            error = ModuleList::GetSharedModule (module_spec, 
                                                  exe_module_sp, 
                                                  NULL, 
                                                  NULL,
@@ -172,14 +170,9 @@
             // 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)
+            for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, module_spec.GetArchitecture()); ++idx)
             {
-                error = ModuleList::GetSharedModule (resolved_exe_file, 
-                                                     platform_arch, 
-                                                     NULL,
-                                                     NULL, 
-                                                     0, 
+                error = ModuleList::GetSharedModule (module_spec, 
                                                      exe_module_sp, 
                                                      NULL, 
                                                      NULL,
@@ -195,7 +188,7 @@
                 
                 if (idx > 0)
                     arch_names.PutCString (", ");
-                arch_names.PutCString (platform_arch.GetArchitectureName());
+                arch_names.PutCString (module_spec.GetArchitecture().GetArchitectureName());
             }
             
             if (error.Fail() || !exe_module_sp)
diff --git a/source/Plugins/Platform/Linux/PlatformLinux.h b/source/Plugins/Platform/Linux/PlatformLinux.h
index 5935002..59dde3e 100644
--- a/source/Plugins/Platform/Linux/PlatformLinux.h
+++ b/source/Plugins/Platform/Linux/PlatformLinux.h
@@ -72,7 +72,8 @@
         virtual Error
         ResolveExecutable (const FileSpec &exe_file,
                            const ArchSpec &arch,
-                           lldb::ModuleSP &module_sp);
+                           lldb::ModuleSP &module_sp,
+                           const FileSpecList *module_search_paths_ptr);
 
         virtual const char *
         GetDescription ()
diff --git a/source/lldb.cpp b/source/lldb.cpp
index 1576063..3c7b768 100644
--- a/source/lldb.cpp
+++ b/source/lldb.cpp
@@ -38,6 +38,8 @@
 #include "Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h"
 #include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
 #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
+#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
+#include "Plugins/Platform/Linux/PlatformLinux.h"
 #if defined (__APPLE__)
 #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h"
 #include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
@@ -57,14 +59,10 @@
 #include "Plugins/Process/mach-core/ProcessMachCore.h"
 
 #if defined (__linux__)
-#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
-#include "Plugins/Platform/Linux/PlatformLinux.h"
 #include "Plugins/Process/Linux/ProcessLinux.h"
 #endif
 
 #if defined (__FreeBSD__)
-#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
-#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
 #include "Plugins/Process/POSIX/ProcessPOSIX.h"
 #include "Plugins/Process/FreeBSD/ProcessFreeBSD.h"
 #endif
@@ -109,6 +107,8 @@
         EmulateInstructionARM::Initialize ();
         ObjectFilePECOFF::Initialize ();
         DynamicLoaderPOSIXDYLD::Initialize ();
+        PlatformFreeBSD::Initialize();
+        PlatformLinux::Initialize();
 #if defined (__APPLE__)
         //----------------------------------------------------------------------
         // Apple/Darwin hosted plugins
@@ -134,14 +134,10 @@
         //----------------------------------------------------------------------
         // Linux hosted plugins
         //----------------------------------------------------------------------
-        PlatformLinux::Initialize();
         ProcessLinux::Initialize();
-        DynamicLoaderPOSIXDYLD::Initialize();
 #endif
 #if defined (__FreeBSD__)
-        PlatformFreeBSD::Initialize();
         ProcessFreeBSD::Initialize();
-        DynamicLoaderPOSIXDYLD::Initialize();
 #endif
         //----------------------------------------------------------------------
         // Platform agnostic plugins
@@ -190,7 +186,8 @@
     EmulateInstructionARM::Terminate ();
     ObjectFilePECOFF::Terminate ();
     DynamicLoaderPOSIXDYLD::Terminate ();
-
+    PlatformFreeBSD::Terminate();
+    PlatformLinux::Terminate();
 #if defined (__APPLE__)
     DynamicLoaderMacOSXDYLD::Terminate();
     DynamicLoaderDarwinKernel::Terminate();
@@ -213,15 +210,11 @@
     Debugger::SettingsTerminate ();
 
 #if defined (__linux__)
-    PlatformLinux::Terminate();
     ProcessLinux::Terminate();
-    DynamicLoaderPOSIXDYLD::Terminate();
 #endif
 
 #if defined (__FreeBSD__)
-    PlatformFreeBSD::Terminate();
     ProcessFreeBSD::Terminate();
-    DynamicLoaderPOSIXDYLD::Terminate();
 #endif
     
     DynamicLoaderStatic::Terminate();