From ea5e0cc3203898a8b9f33080ba4cb186d3917125 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Mon, 27 Feb 2012 19:12:12 +0000 Subject: [PATCH] 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. llvm-svn: 151539 --- lldb/lldb.xcodeproj/project.pbxproj | 32 +++++++++++++++++++ .../Platform/FreeBSD/PlatformFreeBSD.cpp | 3 +- .../Plugins/Platform/Linux/PlatformLinux.cpp | 21 ++++-------- .../Plugins/Platform/Linux/PlatformLinux.h | 3 +- lldb/source/lldb.cpp | 19 ++++------- 5 files changed, 49 insertions(+), 29 deletions(-) diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj index f508290fd939..60004a2f49a9 100644 --- a/lldb/lldb.xcodeproj/project.pbxproj +++ b/lldb/lldb.xcodeproj/project.pbxproj @@ -329,6 +329,10 @@ 268F9D55123AA16600B91E9B /* SBSymbolContextList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 268F9D54123AA16600B91E9B /* SBSymbolContextList.cpp */; }; 2690B3711381D5C300ECFBAE /* Memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2690B3701381D5C300ECFBAE /* Memory.cpp */; }; 2692BA15136610C100F9E14D /* UnwindAssemblyInstEmulation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2692BA13136610C100F9E14D /* UnwindAssemblyInstEmulation.cpp */; }; + 2694E99D14FC0BB30076DE67 /* PlatformFreeBSD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2694E99A14FC0BB30076DE67 /* PlatformFreeBSD.cpp */; }; + 2694E99E14FC0BB30076DE67 /* PlatformFreeBSD.h in Headers */ = {isa = PBXBuildFile; fileRef = 2694E99B14FC0BB30076DE67 /* PlatformFreeBSD.h */; }; + 2694E9A414FC0BBD0076DE67 /* PlatformLinux.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2694E9A114FC0BBD0076DE67 /* PlatformLinux.cpp */; }; + 2694E9A514FC0BBD0076DE67 /* PlatformLinux.h in Headers */ = {isa = PBXBuildFile; fileRef = 2694E9A214FC0BBD0076DE67 /* PlatformLinux.h */; }; 26954EBE1401EE8B00294D09 /* DynamicRegisterInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26954EBC1401EE8B00294D09 /* DynamicRegisterInfo.cpp */; }; 26957D9813D381C900670048 /* RegisterContextDarwin_arm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26957D9213D381C900670048 /* RegisterContextDarwin_arm.cpp */; }; 26957D9A13D381C900670048 /* RegisterContextDarwin_i386.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26957D9413D381C900670048 /* RegisterContextDarwin_i386.cpp */; }; @@ -805,6 +809,10 @@ 2692BA14136610C100F9E14D /* UnwindAssemblyInstEmulation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnwindAssemblyInstEmulation.h; sourceTree = ""; }; 269416AD119A024800FF2715 /* CommandObjectTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectTarget.cpp; path = source/Commands/CommandObjectTarget.cpp; sourceTree = ""; }; 269416AE119A024800FF2715 /* CommandObjectTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectTarget.h; path = source/Commands/CommandObjectTarget.h; sourceTree = ""; }; + 2694E99A14FC0BB30076DE67 /* PlatformFreeBSD.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformFreeBSD.cpp; sourceTree = ""; }; + 2694E99B14FC0BB30076DE67 /* PlatformFreeBSD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformFreeBSD.h; sourceTree = ""; }; + 2694E9A114FC0BBD0076DE67 /* PlatformLinux.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformLinux.cpp; sourceTree = ""; }; + 2694E9A214FC0BBD0076DE67 /* PlatformLinux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformLinux.h; sourceTree = ""; }; 26954EBC1401EE8B00294D09 /* DynamicRegisterInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DynamicRegisterInfo.cpp; path = Utility/DynamicRegisterInfo.cpp; sourceTree = ""; }; 26954EBD1401EE8B00294D09 /* DynamicRegisterInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DynamicRegisterInfo.h; path = Utility/DynamicRegisterInfo.h; sourceTree = ""; }; 26957D9213D381C900670048 /* RegisterContextDarwin_arm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegisterContextDarwin_arm.cpp; path = Utility/RegisterContextDarwin_arm.cpp; sourceTree = ""; }; @@ -2096,6 +2104,24 @@ path = x86; sourceTree = ""; }; + 2694E99814FC0BB30076DE67 /* FreeBSD */ = { + isa = PBXGroup; + children = ( + 2694E99A14FC0BB30076DE67 /* PlatformFreeBSD.cpp */, + 2694E99B14FC0BB30076DE67 /* PlatformFreeBSD.h */, + ); + path = FreeBSD; + sourceTree = ""; + }; + 2694E99F14FC0BBD0076DE67 /* Linux */ = { + isa = PBXGroup; + children = ( + 2694E9A114FC0BBD0076DE67 /* PlatformLinux.cpp */, + 2694E9A214FC0BBD0076DE67 /* PlatformLinux.h */, + ); + path = Linux; + sourceTree = ""; + }; 26A3B4AB1181454800381BC2 /* BSD-Archive */ = { isa = PBXGroup; children = ( @@ -2729,7 +2755,9 @@ 26C5577E132575B6008FD8FE /* Platform */ = { isa = PBXGroup; children = ( + 2694E99814FC0BB30076DE67 /* FreeBSD */, 264A97BC133918A30017F0BE /* GDB Server */, + 2694E99F14FC0BBD0076DE67 /* Linux */, 26C5577F132575C8008FD8FE /* MacOSX */, ); path = Platform; @@ -3056,6 +3084,8 @@ 26FFC19A14FC072100087D58 /* AuxVector.h in Headers */, 26FFC19C14FC072100087D58 /* DYLDRendezvous.h in Headers */, 26FFC19E14FC072100087D58 /* DynamicLoaderPOSIXDYLD.h in Headers */, + 2694E99E14FC0BB30076DE67 /* PlatformFreeBSD.h in Headers */, + 2694E9A514FC0BBD0076DE67 /* PlatformLinux.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3781,6 +3811,8 @@ 26FFC19914FC072100087D58 /* AuxVector.cpp in Sources */, 26FFC19B14FC072100087D58 /* DYLDRendezvous.cpp in Sources */, 26FFC19D14FC072100087D58 /* DynamicLoaderPOSIXDYLD.cpp in Sources */, + 2694E99D14FC0BB30076DE67 /* PlatformFreeBSD.cpp in Sources */, + 2694E9A414FC0BBD0076DE67 /* PlatformLinux.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index 1a7e3463a86a..ecc96c34b48d 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -155,7 +155,8 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file, } 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/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index d93ad011a857..80c9a86a973a 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -93,7 +93,8 @@ PlatformLinux::Terminate () 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 @@ PlatformLinux::ResolveExecutable (const FileSpec &exe_file, 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 @@ PlatformLinux::ResolveExecutable (const FileSpec &exe_file, // 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 @@ PlatformLinux::ResolveExecutable (const FileSpec &exe_file, 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/lldb/source/Plugins/Platform/Linux/PlatformLinux.h b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h index 5935002c58b0..59dde3ec1707 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h @@ -72,7 +72,8 @@ namespace lldb_private { 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/lldb/source/lldb.cpp b/lldb/source/lldb.cpp index 1576063071c3..3c7b7688fdb9 100644 --- a/lldb/source/lldb.cpp +++ b/lldb/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 @@ lldb_private::Initialize () EmulateInstructionARM::Initialize (); ObjectFilePECOFF::Initialize (); DynamicLoaderPOSIXDYLD::Initialize (); + PlatformFreeBSD::Initialize(); + PlatformLinux::Initialize(); #if defined (__APPLE__) //---------------------------------------------------------------------- // Apple/Darwin hosted plugins @@ -134,14 +134,10 @@ lldb_private::Initialize () //---------------------------------------------------------------------- // 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 @@ lldb_private::Terminate () EmulateInstructionARM::Terminate (); ObjectFilePECOFF::Terminate (); DynamicLoaderPOSIXDYLD::Terminate (); - + PlatformFreeBSD::Terminate(); + PlatformLinux::Terminate(); #if defined (__APPLE__) DynamicLoaderMacOSXDYLD::Terminate(); DynamicLoaderDarwinKernel::Terminate(); @@ -213,15 +210,11 @@ lldb_private::Terminate () Debugger::SettingsTerminate (); #if defined (__linux__) - PlatformLinux::Terminate(); ProcessLinux::Terminate(); - DynamicLoaderPOSIXDYLD::Terminate(); #endif #if defined (__FreeBSD__) - PlatformFreeBSD::Terminate(); ProcessFreeBSD::Terminate(); - DynamicLoaderPOSIXDYLD::Terminate(); #endif DynamicLoaderStatic::Terminate(); -- GitLab