Author: gclayton Date: Fri Mar 6 17:46:54 2015 New Revision: 231535 URL: http://llvm.org/viewvc/llvm-project?rev=231535&view=rev Log: Make sure to re-read the file data you can get from OptionValueFileSpec::GetFileContents(...) when the file has changed.
This means you can set an expression prefix file with: (lldb) settings set target.expr-prefix /tmp/to/prefix.txt And you can run an expression and modify your expression prefix file in another editor without having to type: (lldb) settings set target.expr-prefix /tmp/to/prefix.txt again... <rdar://problem/12155942> Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h?rev=231535&r1=231534&r2=231535&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h (original) +++ lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h Fri Mar 6 17:46:54 2015 @@ -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; }; Modified: lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp?rev=231535&r1=231534&r2=231535&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp (original) +++ lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp Fri Mar 6 17:46:54 2015 @@ -29,6 +29,7 @@ OptionValueFileSpec::OptionValueFileSpec 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 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 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 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 (Comma 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; } _______________________________________________ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits