diff options
author | Enrico Granata <egranata@apple.com> | 2012-10-22 18:18:36 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2012-10-22 18:18:36 +0000 |
commit | e3e91517ffd7e63bcb5b9d196f85e2b09802b414 (patch) | |
tree | 16ba51bd013c2fb1d9753e2c6a6aae958202f892 /lldb/source/Core/ValueObjectDynamicValue.cpp | |
parent | 2f758cf8bafb527e9a709043d9704449a5f767b8 (diff) | |
download | bcm5719-llvm-e3e91517ffd7e63bcb5b9d196f85e2b09802b414.tar.gz bcm5719-llvm-e3e91517ffd7e63bcb5b9d196f85e2b09802b414.zip |
<rdar://problem/12437442>
Given our implementation of ValueObjects we could have a scenario where a ValueObject has a dynamic type of Foo* at one point, and then its dynamic type changes to Bar*
If Bar* has synthetic children enabled, by the time we figure that out, our public API is already vending SBValues wrapping a DynamicVO, instead of a SyntheticVO and there was
no trivial way for us to change the SP inside an SBValue on the fly
This checkin reimplements SBValue in terms of a wrapper, ValueImpl, that allows this substitutions on-the-fly by overriding GetSP() to do The Right Thing (TM)
As an additional bonus, GetNonSyntheticValue() now works, and we can get rid of the ForceDisableSyntheticChildren idiom in ScriptInterpreterPython
Lastly, this checkin makes sure the synthetic VOs get the correct m_value and m_data from their parents (prevented summaries from working in some cases)
llvm-svn: 166426
Diffstat (limited to 'lldb/source/Core/ValueObjectDynamicValue.cpp')
-rw-r--r-- | lldb/source/Core/ValueObjectDynamicValue.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp index 2921e9d1bf9..dfddbd97c95 100644 --- a/lldb/source/Core/ValueObjectDynamicValue.cpp +++ b/lldb/source/Core/ValueObjectDynamicValue.cpp @@ -290,29 +290,24 @@ ValueObjectDynamicValue::UpdateValue () lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES)); + bool has_changed_type = false; + if (!m_type_sp) { m_type_sp = dynamic_type_sp; - ResetCompleteTypeInfo (); - if (log) - log->Printf("[%s %p] now has a dynamic type %s", - GetName().GetCString(), - this, - GetTypeName().AsCString("")); + has_changed_type = true; } else if (dynamic_type_sp != m_type_sp) { // We are another type, we need to tear down our children... m_type_sp = dynamic_type_sp; SetValueDidChange (true); - ResetCompleteTypeInfo (); - if (log) - log->Printf("[%s %p] has a new dynamic type %s", - GetName().GetCString(), - this, - GetTypeName().AsCString("")); + has_changed_type = true; } + if (has_changed_type) + ClearDynamicTypeInformation (); + if (!m_address.IsValid() || m_address != dynamic_address) { if (m_address.IsValid()) @@ -341,6 +336,12 @@ ValueObjectDynamicValue::UpdateValue () // because we aren't pointing to the LOCATION that stores the pointer to us, we're pointing to us... m_value.SetValueType(Value::eValueTypeScalar); + if (has_changed_type && log) + log->Printf("[%s %p] has a new dynamic type %s", + GetName().GetCString(), + this, + GetTypeName().GetCString()); + if (m_address.IsValid() && m_type_sp) { // The variable value is in the Scalar value inside the m_value. |