diff options
Diffstat (limited to 'lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp')
-rw-r--r-- | lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp | 76 |
1 files changed, 73 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index 3b0e159e454..9ca49731ee9 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -12,14 +12,19 @@ // C Includes #ifndef LLDB_DISABLE_POSIX +#include <sys/stat.h> #include <sys/sysctl.h> #endif // C++ Includes + +#include <sstream> + // Other libraries and framework includes // Project includes #include "lldb/Core/Error.h" #include "lldb/Breakpoint/BreakpointLocation.h" +#include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleList.h" #include "lldb/Core/PluginManager.h" @@ -161,9 +166,9 @@ PlatformMacOSX::~PlatformMacOSX() } Error -PlatformMacOSX::GetFile (const FileSpec &platform_file, - const UUID *uuid_ptr, - FileSpec &local_file) +PlatformMacOSX::GetSymbolFile (const FileSpec &platform_file, + const UUID *uuid_ptr, + FileSpec &local_file) { if (IsRemote()) { @@ -176,6 +181,62 @@ PlatformMacOSX::GetFile (const FileSpec &platform_file, return Error(); } +lldb_private::Error +PlatformMacOSX::GetFile (const lldb_private::FileSpec &platform_file, + const lldb_private::UUID *uuid_ptr, + lldb_private::FileSpec &local_file) +{ + if (IsRemote() && m_remote_platform_sp) + { + std::string local_os_build; + Host::GetOSBuildString(local_os_build); + std::string remote_os_build; + m_remote_platform_sp->GetOSBuildString(remote_os_build); + if (local_os_build.compare(remote_os_build) == 0) + { + // same OS version: the local file is good enough + local_file = platform_file; + return Error(); + } + else + { + // try to find the file in the cache + std::string cache_path(GetLocalCacheDirectory()); + std::string module_path (platform_file.GetPath()); + cache_path.append(module_path); + FileSpec module_cache_spec(cache_path.c_str(),false); + if (module_cache_spec.Exists()) + { + local_file = module_cache_spec; + return Error(); + } + // bring in the remote module file + FileSpec module_cache_folder = module_cache_spec.CopyByRemovingLastPathComponent(); + StreamString mkdir_folder_cmd; + // try to make the local directory first + mkdir_folder_cmd.Printf("mkdir -p %s/%s", module_cache_folder.GetDirectory().AsCString(), module_cache_folder.GetFilename().AsCString()); + Host::RunShellCommand(mkdir_folder_cmd.GetData(), + NULL, + NULL, + NULL, + NULL, + 60); + Error err = GetFile(platform_file, module_cache_spec); + if (err.Fail()) + return err; + if (module_cache_spec.Exists()) + { + local_file = module_cache_spec; + return Error(); + } + else + return Error("unable to obtain valid module file"); + } + } + local_file = platform_file; + return Error(); +} + bool PlatformMacOSX::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch) { @@ -186,3 +247,12 @@ PlatformMacOSX::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch) #endif } +lldb_private::Error +PlatformMacOSX::GetSharedModule (const lldb_private::ModuleSpec &module_spec, + lldb::ModuleSP &module_sp, + const lldb_private::FileSpecList *module_search_paths_ptr, + lldb::ModuleSP *old_module_sp_ptr, + bool *did_create_ptr) +{ + return GetSharedModuleWithLocalCache(module_spec, module_sp, module_search_paths_ptr, old_module_sp_ptr, did_create_ptr); +} |