diff options
author | Oleksiy Vyalov <ovyalov@google.com> | 2015-10-01 17:48:57 +0000 |
---|---|---|
committer | Oleksiy Vyalov <ovyalov@google.com> | 2015-10-01 17:48:57 +0000 |
commit | d21ca280cb16303c807099a49d879b4fb08b1a91 (patch) | |
tree | 6470ca2f5a44ce631398320fa1e43de39f964248 /lldb/source/Target/Platform.cpp | |
parent | 1ab1ee76200c21e948b5015db426e9283414d704 (diff) | |
download | bcm5719-llvm-d21ca280cb16303c807099a49d879b4fb08b1a91.tar.gz bcm5719-llvm-d21ca280cb16303c807099a49d879b4fb08b1a91.zip |
Use %HOME%/.lldb/module_cache as a default module cache directory.
http://reviews.llvm.org/D13323
llvm-svn: 249040
Diffstat (limited to 'lldb/source/Target/Platform.cpp')
-rw-r--r-- | lldb/source/Target/Platform.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index 4e07a16044c..e43cdc63646 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -39,9 +39,11 @@ #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/Utils.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/Path.h" #include "Utility/ModuleCache.h" + // Define these constants from POSIX mman.h rather than include the file // so that they will be correct even when compiled on Linux. #define MAP_PRIVATE 2 @@ -99,13 +101,17 @@ PlatformProperties::PlatformProperties () m_collection_sp->Initialize (g_properties); auto module_cache_dir = GetModuleCacheDirectory (); - if (!module_cache_dir) - { - if (!HostInfo::GetLLDBPath (ePathTypeGlobalLLDBTempSystemDir, module_cache_dir)) - module_cache_dir = FileSpec ("/tmp/lldb", false); - module_cache_dir.AppendPathComponent ("module_cache"); - SetModuleCacheDirectory (module_cache_dir); - } + if (module_cache_dir) + return; + + llvm::SmallString<64> user_home_dir; + if (!llvm::sys::path::home_directory (user_home_dir)) + return; + + module_cache_dir = FileSpec (user_home_dir.c_str(), false); + module_cache_dir.AppendPathComponent (".lldb"); + module_cache_dir.AppendPathComponent ("module_cache"); + SetModuleCacheDirectory (module_cache_dir); } bool @@ -1847,7 +1853,8 @@ Platform::GetCachedSharedModule (const ModuleSpec &module_spec, bool *did_create_ptr) { if (IsHost() || - !GetGlobalPlatformProperties ()->GetUseModuleCache ()) + !GetGlobalPlatformProperties ()->GetUseModuleCache () || + !GetGlobalPlatformProperties ()->GetModuleCacheDirectory ()) return false; Log *log = GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PLATFORM); |