summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Interpreter/OptionValueFileSpec.h2
-rw-r--r--lldb/source/Interpreter/OptionValueFileSpec.cpp10
2 files changed, 11 insertions, 1 deletions
diff --git a/lldb/include/lldb/Interpreter/OptionValueFileSpec.h b/lldb/include/lldb/Interpreter/OptionValueFileSpec.h
index 4265fdb737b..80dd77ecef2 100644
--- a/lldb/include/lldb/Interpreter/OptionValueFileSpec.h
+++ b/lldb/include/lldb/Interpreter/OptionValueFileSpec.h
@@ -59,6 +59,7 @@ public:
m_current_value = m_default_value;
m_value_was_set = false;
m_data_sp.reset();
+ m_data_mod_time.Clear();
return true;
}
@@ -123,6 +124,7 @@ protected:
FileSpec m_current_value;
FileSpec m_default_value;
lldb::DataBufferSP m_data_sp;
+ TimeValue m_data_mod_time;
uint32_t m_completion_mask;
bool m_resolve;
};
diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp
index 221a5c5f1b2..e9d2d5fa940 100644
--- a/lldb/source/Interpreter/OptionValueFileSpec.cpp
+++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp
@@ -29,6 +29,7 @@ OptionValueFileSpec::OptionValueFileSpec (bool resolve) :
m_current_value (),
m_default_value (),
m_data_sp(),
+ m_data_mod_time (),
m_completion_mask (CommandCompletions::eDiskFileCompletion),
m_resolve (resolve)
{
@@ -40,6 +41,7 @@ OptionValueFileSpec::OptionValueFileSpec (const FileSpec &value,
m_current_value (value),
m_default_value (value),
m_data_sp(),
+ m_data_mod_time (),
m_completion_mask (CommandCompletions::eDiskFileCompletion),
m_resolve (resolve)
{
@@ -52,6 +54,7 @@ OptionValueFileSpec::OptionValueFileSpec (const FileSpec &current_value,
m_current_value (current_value),
m_default_value (default_value),
m_data_sp(),
+ m_data_mod_time (),
m_completion_mask (CommandCompletions::eDiskFileCompletion),
m_resolve (resolve)
{
@@ -99,6 +102,7 @@ OptionValueFileSpec::SetValueFromString (llvm::StringRef value,
m_value_was_set = true;
m_current_value.SetFile(value.str().c_str(), m_resolve);
m_data_sp.reset();
+ m_data_mod_time.Clear();
NotifyValueChanged();
}
else
@@ -151,12 +155,16 @@ OptionValueFileSpec::AutoComplete (CommandInterpreter &interpreter,
const lldb::DataBufferSP &
OptionValueFileSpec::GetFileContents(bool null_terminate)
{
- if (!m_data_sp && m_current_value)
+ if (m_current_value)
{
+ const TimeValue file_mod_time = m_current_value.GetModificationTime();
+ if (m_data_sp && m_data_mod_time == file_mod_time)
+ return m_data_sp;
if (null_terminate)
m_data_sp = m_current_value.ReadFileContentsAsCString();
else
m_data_sp = m_current_value.ReadFileContents();
+ m_data_mod_time = file_mod_time;
}
return m_data_sp;
}
OpenPOWER on IntegriCloud