summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Core/DataExtractor.cpp26
-rw-r--r--lldb/source/Core/ValueObject.cpp57
2 files changed, 72 insertions, 11 deletions
diff --git a/lldb/source/Core/DataExtractor.cpp b/lldb/source/Core/DataExtractor.cpp
index 27dccfe5cf2..6e1d63095cf 100644
--- a/lldb/source/Core/DataExtractor.cpp
+++ b/lldb/source/Core/DataExtractor.cpp
@@ -22,7 +22,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/MathExtras.h"
-
+#include "llvm/Support/MD5.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/DataExtractor.h"
@@ -2238,3 +2238,27 @@ DataExtractor::Append(void* buf, offset_t length)
return true;
}
+
+void
+DataExtractor::Checksum (llvm::SmallVectorImpl<uint8_t> &dest,
+ uint64_t max_data)
+{
+ if (max_data == 0)
+ max_data = GetByteSize();
+ else
+ max_data = std::min(max_data, GetByteSize());
+
+ llvm::MD5 md5;
+
+ const llvm::ArrayRef<uint8_t> data(GetDataStart(),max_data);
+ md5.update(data);
+
+ llvm::MD5::MD5Result result;
+ md5.final(result);
+
+ dest.resize(16);
+ std::copy(result,
+ result+16,
+ dest.begin());
+}
+
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 624c06d5a75..5487b601655 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -98,6 +98,7 @@ ValueObject::ValueObject (ValueObject &parent) :
m_type_validator_sp(),
m_user_id_of_forced_summary(),
m_address_type_of_ptr_or_ref_children(eAddressTypeInvalid),
+ m_value_checksum(),
m_value_is_valid (false),
m_value_did_change (false),
m_children_count_valid (false),
@@ -147,6 +148,7 @@ ValueObject::ValueObject (ExecutionContextScope *exe_scope,
m_type_validator_sp(),
m_user_id_of_forced_summary(),
m_address_type_of_ptr_or_ref_children(child_ptr_or_ref_addr_type),
+ m_value_checksum(),
m_value_is_valid (false),
m_value_did_change (false),
m_children_count_valid (false),
@@ -192,7 +194,7 @@ ValueObject::UpdateValueIfNeeded (bool update_format)
return m_error.Success();
}
- bool first_update = m_update_point.IsFirstEvaluation();
+ bool first_update = IsChecksumEmpty();
if (m_update_point.NeedsUpdating())
{
@@ -221,10 +223,35 @@ ValueObject::UpdateValueIfNeeded (bool update_format)
m_error.Clear();
// Call the pure virtual function to update the value
+
+ bool need_compare_checksums = false;
+ llvm::SmallVector<uint8_t, 16> old_checksum;
+
+ if (!first_update && CanProvideValue())
+ {
+ need_compare_checksums = true;
+ old_checksum.resize(m_value_checksum.size());
+ std::copy(m_value_checksum.begin(), m_value_checksum.end(), old_checksum.begin());
+ }
+
bool success = UpdateValue ();
SetValueIsValid (success);
+ if (success)
+ {
+ const uint64_t max_checksum_size = 128;
+ m_data.Checksum(m_value_checksum,
+ max_checksum_size);
+ }
+ else
+ {
+ need_compare_checksums = false;
+ m_value_checksum.clear();
+ }
+
+ assert (old_checksum.empty() == !need_compare_checksums);
+
if (first_update)
SetValueDidChange (false);
else if (!m_value_did_change && success == false)
@@ -233,6 +260,11 @@ ValueObject::UpdateValueIfNeeded (bool update_format)
// as changed if the value used to be valid and now isn't
SetValueDidChange (value_was_valid);
}
+ else if (need_compare_checksums)
+ {
+ SetValueDidChange(memcmp(&old_checksum[0], &m_value_checksum[0], m_value_checksum.size()));
+ }
+
}
else
{
@@ -498,7 +530,6 @@ ValueObject::SetValueIsValid (bool b)
bool
ValueObject::GetValueDidChange ()
{
- GetValueAsCString ();
return m_value_did_change;
}
@@ -3834,16 +3865,14 @@ ValueObject::CastPointerType (const char *name, TypeSP &type_sp)
ValueObject::EvaluationPoint::EvaluationPoint () :
m_mod_id(),
m_exe_ctx_ref(),
- m_needs_update (true),
- m_first_update (true)
+ m_needs_update (true)
{
}
ValueObject::EvaluationPoint::EvaluationPoint (ExecutionContextScope *exe_scope, bool use_selected):
m_mod_id(),
m_exe_ctx_ref(),
- m_needs_update (true),
- m_first_update (true)
+ m_needs_update (true)
{
ExecutionContext exe_ctx(exe_scope);
TargetSP target_sp (exe_ctx.GetTargetSP());
@@ -3887,8 +3916,7 @@ ValueObject::EvaluationPoint::EvaluationPoint (ExecutionContextScope *exe_scope,
ValueObject::EvaluationPoint::EvaluationPoint (const ValueObject::EvaluationPoint &rhs) :
m_mod_id(),
m_exe_ctx_ref(rhs.m_exe_ctx_ref),
- m_needs_update (true),
- m_first_update (true)
+ m_needs_update (true)
{
}
@@ -3982,7 +4010,6 @@ ValueObject::EvaluationPoint::SetUpdated ()
ProcessSP process_sp(m_exe_ctx_ref.GetProcessSP());
if (process_sp)
m_mod_id = process_sp->GetModID();
- m_first_update = false;
m_needs_update = false;
}
@@ -4183,7 +4210,17 @@ ValueObject::GetPreferredDisplayLanguage ()
bool
ValueObject::CanProvideValue ()
{
- return (false == GetClangType().IsAggregateType());
+ // we need to support invalid types as providers of values because some bare-board
+ // debugging scenarios have no notion of types, but still manage to have raw numeric
+ // values for things like registers. sigh.
+ const ClangASTType &type(GetClangType());
+ return (false == type.IsValid()) || (0 != (type.GetTypeInfo() & eTypeHasValue));
+}
+
+bool
+ValueObject::IsChecksumEmpty ()
+{
+ return m_value_checksum.empty();
}
ValueObjectSP
OpenPOWER on IntegriCloud