diff options
Diffstat (limited to 'lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp')
-rw-r--r-- | lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 3ff620da840..8c18af92f97 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -305,100 +305,100 @@ PlatformDarwin::GetSharedModuleWithLocalCache (const lldb_private::ModuleSpec &m module_spec.GetSymbolFileSpec().GetFilename().AsCString()); std::string cache_path(GetLocalCacheDirectory()); - std::string module_path (module_spec.GetFileSpec().GetPath()); - cache_path.append(module_path); - FileSpec module_cache_spec(cache_path.c_str(),false); - - // if rsync is supported, always bring in the file - rsync will be very efficient - // when files are the same on the local and remote end of the connection - if (this->GetSupportsRSync()) - { - Error err = BringInRemoteFile (this, module_spec, module_cache_spec); - if (err.Fail()) - return err; - if (module_cache_spec.Exists()) - { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) - log->Printf("[%s] module %s/%s was rsynced and is now there", - (IsHost() ? "host" : "remote"), - module_spec.GetFileSpec().GetDirectory().AsCString(), - module_spec.GetFileSpec().GetFilename().AsCString()); - ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture()); - module_sp.reset(new Module(local_spec)); - module_sp->SetPlatformFileSpec(module_spec.GetFileSpec()); - return Error(); - } - } - - if (module_spec.GetFileSpec().Exists() && !module_sp) + // Only search for a locally cached file if we have a valid cache path + if (!cache_path.empty()) { - module_sp.reset(new Module(module_spec)); - return Error(); - } + std::string module_path (module_spec.GetFileSpec().GetPath()); + cache_path.append(module_path); + FileSpec module_cache_spec(cache_path.c_str(),false); - // try to find the module in the cache - if (module_cache_spec.Exists()) - { - // get the local and remote MD5 and compare - if (m_remote_platform_sp) + // if rsync is supported, always bring in the file - rsync will be very efficient + // when files are the same on the local and remote end of the connection + if (this->GetSupportsRSync()) { - // when going over the *slow* GDB remote transfer mechanism we first check - // the hashes of the files - and only do the actual transfer if they differ - uint64_t high_local,high_remote,low_local,low_remote; - Host::CalculateMD5 (module_cache_spec, low_local, high_local); - m_remote_platform_sp->CalculateMD5(module_spec.GetFileSpec(), low_remote, high_remote); - if (low_local != low_remote || high_local != high_remote) + Error err = BringInRemoteFile (this, module_spec, module_cache_spec); + if (err.Fail()) + return err; + if (module_cache_spec.Exists()) { - // bring in the remote file Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) - log->Printf("[%s] module %s/%s needs to be replaced from remote copy", + log->Printf("[%s] module %s/%s was rsynced and is now there", (IsHost() ? "host" : "remote"), module_spec.GetFileSpec().GetDirectory().AsCString(), module_spec.GetFileSpec().GetFilename().AsCString()); - Error err = BringInRemoteFile (this, module_spec, module_cache_spec); - if (err.Fail()) - return err; + ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture()); + module_sp.reset(new Module(local_spec)); + module_sp->SetPlatformFileSpec(module_spec.GetFileSpec()); + return Error(); } } - ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture()); - module_sp.reset(new Module(local_spec)); - module_sp->SetPlatformFileSpec(module_spec.GetFileSpec()); - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) - log->Printf("[%s] module %s/%s was found in the cache", - (IsHost() ? "host" : "remote"), - module_spec.GetFileSpec().GetDirectory().AsCString(), - module_spec.GetFileSpec().GetFilename().AsCString()); - return Error(); - } - - // bring in the remote module file - if (log) - log->Printf("[%s] module %s/%s needs to come in remotely", - (IsHost() ? "host" : "remote"), - module_spec.GetFileSpec().GetDirectory().AsCString(), - module_spec.GetFileSpec().GetFilename().AsCString()); - Error err = BringInRemoteFile (this, module_spec, module_cache_spec); - if (err.Fail()) - return err; - if (module_cache_spec.Exists()) - { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + // try to find the module in the cache + if (module_cache_spec.Exists()) + { + // get the local and remote MD5 and compare + if (m_remote_platform_sp) + { + // when going over the *slow* GDB remote transfer mechanism we first check + // the hashes of the files - and only do the actual transfer if they differ + uint64_t high_local,high_remote,low_local,low_remote; + Host::CalculateMD5 (module_cache_spec, low_local, high_local); + m_remote_platform_sp->CalculateMD5(module_spec.GetFileSpec(), low_remote, high_remote); + if (low_local != low_remote || high_local != high_remote) + { + // bring in the remote file + Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + if (log) + log->Printf("[%s] module %s/%s needs to be replaced from remote copy", + (IsHost() ? "host" : "remote"), + module_spec.GetFileSpec().GetDirectory().AsCString(), + module_spec.GetFileSpec().GetFilename().AsCString()); + Error err = BringInRemoteFile (this, module_spec, module_cache_spec); + if (err.Fail()) + return err; + } + } + + ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture()); + module_sp.reset(new Module(local_spec)); + module_sp->SetPlatformFileSpec(module_spec.GetFileSpec()); + Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + if (log) + log->Printf("[%s] module %s/%s was found in the cache", + (IsHost() ? "host" : "remote"), + module_spec.GetFileSpec().GetDirectory().AsCString(), + module_spec.GetFileSpec().GetFilename().AsCString()); + return Error(); + } + + // bring in the remote module file if (log) - log->Printf("[%s] module %s/%s is now cached and fine", + log->Printf("[%s] module %s/%s needs to come in remotely", (IsHost() ? "host" : "remote"), module_spec.GetFileSpec().GetDirectory().AsCString(), module_spec.GetFileSpec().GetFilename().AsCString()); - ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture()); - module_sp.reset(new Module(local_spec)); - module_sp->SetPlatformFileSpec(module_spec.GetFileSpec()); - return Error(); + Error err = BringInRemoteFile (this, module_spec, module_cache_spec); + if (err.Fail()) + return err; + if (module_cache_spec.Exists()) + { + Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); + if (log) + log->Printf("[%s] module %s/%s is now cached and fine", + (IsHost() ? "host" : "remote"), + module_spec.GetFileSpec().GetDirectory().AsCString(), + module_spec.GetFileSpec().GetFilename().AsCString()); + ModuleSpec local_spec(module_cache_spec, module_spec.GetArchitecture()); + module_sp.reset(new Module(local_spec)); + module_sp->SetPlatformFileSpec(module_spec.GetFileSpec()); + return Error(); + } + else + return Error("unable to obtain valid module file"); } else - return Error("unable to obtain valid module file"); + return Error("no cache path"); } Error |