[lldb] Specify default value for platform.module-cache-directory

In addition to the commit rG352f16db87f583ec7f55f8028647b5fd8616111f,
this one fixes settings behavior on clearing - the setting should be
reverted to their default value, not an empty one.
This commit is contained in:
Tatyana Krasnukha
2020-03-12 21:48:23 +03:00
parent 05334de679
commit fe74df01a9
2 changed files with 13 additions and 0 deletions

View File

@@ -50,6 +50,9 @@ public:
FileSpec GetModuleCacheDirectory() const;
bool SetModuleCacheDirectory(const FileSpec &dir_spec);
private:
void SetDefaultModuleCacheDirectory(const FileSpec &dir_spec);
};
typedef std::shared_ptr<PlatformProperties> PlatformPropertiesSP;

View File

@@ -26,6 +26,7 @@
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/OptionValueFileSpec.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Interpreter/Property.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -93,6 +94,7 @@ PlatformProperties::PlatformProperties() {
module_cache_dir = FileSpec(user_home_dir.c_str());
module_cache_dir.AppendPathComponent(".lldb");
module_cache_dir.AppendPathComponent("module_cache");
SetDefaultModuleCacheDirectory(module_cache_dir);
SetModuleCacheDirectory(module_cache_dir);
}
@@ -117,6 +119,14 @@ bool PlatformProperties::SetModuleCacheDirectory(const FileSpec &dir_spec) {
nullptr, ePropertyModuleCacheDirectory, dir_spec);
}
void PlatformProperties::SetDefaultModuleCacheDirectory(
const FileSpec &dir_spec) {
auto f_spec_opt = m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpec(
nullptr, false, ePropertyModuleCacheDirectory);
assert(f_spec_opt);
f_spec_opt->SetDefaultValue(dir_spec);
}
/// Get the native host platform plug-in.
///
/// There should only be one of these for each host that LLDB runs