[Lldb-commits] [lldb] r249040 - Use %HOME%/.lldb/module_cache as a default module cache directory.
Oleksiy Vyalov via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 1 10:48:57 PDT 2015
Author: ovyalov
Date: Thu Oct 1 12:48:57 2015
New Revision: 249040
URL: http://llvm.org/viewvc/llvm-project?rev=249040&view=rev
Log:
Use %HOME%/.lldb/module_cache as a default module cache directory.
http://reviews.llvm.org/D13323
Modified:
lldb/trunk/source/Target/Platform.cpp
Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=249040&r1=249039&r2=249040&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Thu Oct 1 12:48:57 2015
@@ -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 M
bool *did_create_ptr)
{
if (IsHost() ||
- !GetGlobalPlatformProperties ()->GetUseModuleCache ())
+ !GetGlobalPlatformProperties ()->GetUseModuleCache () ||
+ !GetGlobalPlatformProperties ()->GetModuleCacheDirectory ())
return false;
Log *log = GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PLATFORM);
More information about the lldb-commits
mailing list