diff options
Diffstat (limited to 'lldb/source/Core')
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 16 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectCast.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectDynamicValue.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectMemory.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectSyntheticFilter.cpp | 36 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectVariable.cpp | 2 |
6 files changed, 45 insertions, 15 deletions
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 3b37de79234..f38b7c01565 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -1450,7 +1450,7 @@ ValueObject::GetValueAsCString () } else { - my_format = GetClangType().GetFormat(); + my_format = GetValue().GetClangType().GetFormat(); } } } @@ -1482,7 +1482,7 @@ uint64_t ValueObject::GetValueAsUnsigned (uint64_t fail_value, bool *success) { // If our byte size is zero this is an aggregate type that has children - if (!GetClangType().IsAggregateType()) + if (CanProvideValue()) { Scalar scalar; if (ResolveValue (scalar)) @@ -1503,7 +1503,7 @@ int64_t ValueObject::GetValueAsSigned (int64_t fail_value, bool *success) { // If our byte size is zero this is an aggregate type that has children - if (!GetClangType().IsAggregateType()) + if (CanProvideValue()) { Scalar scalar; if (ResolveValue (scalar)) @@ -1751,7 +1751,7 @@ ValueObject::DumpPrintableRepresentation(Stream& s, cstr = GetSummaryAsCString(); else if (val_obj_display == eValueObjectRepresentationStyleSummary) { - if (GetClangType().IsAggregateType()) + if (!CanProvideValue()) { strm.Printf("%s @ %s", GetTypeName().AsCString(), GetLocationAsCString()); cstr = strm.GetString().c_str(); @@ -2805,7 +2805,7 @@ ValueObject::GetValueForExpressionPath_Impl(const char* expression_cstr, if (root->IsSynthetic()) { *first_unparsed = expression_cstr; - *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild; + *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchSyntheticChild; *final_result = ValueObject::eExpressionPathEndResultTypeInvalid; return ValueObjectSP(); } @@ -4080,3 +4080,9 @@ ValueObject::GetFormat () const } return m_format; } + +bool +ValueObject::CanProvideValue () +{ + return (false == GetClangType().IsAggregateType()); +} diff --git a/lldb/source/Core/ValueObjectCast.cpp b/lldb/source/Core/ValueObjectCast.cpp index 4f4f8cc681d..b20371b128d 100644 --- a/lldb/source/Core/ValueObjectCast.cpp +++ b/lldb/source/Core/ValueObjectCast.cpp @@ -102,7 +102,7 @@ ValueObjectCast::UpdateValue () //m_value.SetContext (Value::eContextTypeClangType, clang_type); m_value.SetClangType (clang_type); SetAddressTypeOfChildren(m_parent->GetAddressTypeOfChildren()); - if (clang_type.IsAggregateType ()) + if (!CanProvideValue()) { // this value object represents an aggregate type whose // children have values, but this object does not. So we diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp index 3481bdedf38..30a42f09461 100644 --- a/lldb/source/Core/ValueObjectDynamicValue.cpp +++ b/lldb/source/Core/ValueObjectDynamicValue.cpp @@ -329,7 +329,7 @@ ValueObjectDynamicValue::UpdateValue () m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get()); if (m_error.Success()) { - if (GetClangType().IsAggregateType ()) + if (!CanProvideValue()) { // this value object represents an aggregate type whose // children have values, but this object does not. So we diff --git a/lldb/source/Core/ValueObjectMemory.cpp b/lldb/source/Core/ValueObjectMemory.cpp index d2cbbfdda24..5fbe87b6652 100644 --- a/lldb/source/Core/ValueObjectMemory.cpp +++ b/lldb/source/Core/ValueObjectMemory.cpp @@ -233,7 +233,7 @@ ValueObjectMemory::UpdateValue () } } - if (GetClangType().IsAggregateType()) + if (!CanProvideValue()) { // this value object represents an aggregate type whose // children have values, but this object does not. So we diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp index 18d36164989..9bdf68963db 100644 --- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp +++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp @@ -66,16 +66,17 @@ ValueObjectSynthetic::ValueObjectSynthetic (ValueObject &parent, lldb::Synthetic m_name_toindex(), m_synthetic_children_count(UINT32_MAX), m_parent_type_name(parent.GetTypeName()), - m_might_have_children(eLazyBoolCalculate) + m_might_have_children(eLazyBoolCalculate), + m_provides_value(eLazyBoolCalculate) { -#ifdef LLDB_CONFIGURATION_DEBUG +#ifdef FOOBAR std::string new_name(parent.GetName().AsCString()); new_name += "$$__synth__"; SetName (ConstString(new_name.c_str())); #else SetName(parent.GetName()); #endif - CopyParentData(); + CopyValueData(m_parent); CreateSynthFilter(); } @@ -191,7 +192,20 @@ ValueObjectSynthetic::UpdateValue () m_might_have_children = eLazyBoolCalculate; } - CopyParentData(); + m_provides_value = eLazyBoolCalculate; + + lldb::ValueObjectSP synth_val(m_synth_filter_ap->GetSyntheticValue()); + + if (synth_val && synth_val->CanProvideValue()) + { + m_provides_value = eLazyBoolYes; + CopyValueData(synth_val.get()); + } + else + { + m_provides_value = eLazyBoolNo; + CopyValueData(m_parent); + } SetValueIsValid(true); return true; @@ -268,9 +282,19 @@ ValueObjectSynthetic::GetNonSyntheticValue () } void -ValueObjectSynthetic::CopyParentData () +ValueObjectSynthetic::CopyValueData (ValueObject *source) { - m_value = m_parent->GetValue(); + m_value = (source->UpdateValueIfNeeded(), source->GetValue()); ExecutionContext exe_ctx (GetExecutionContextRef()); m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get()); } + +bool +ValueObjectSynthetic::CanProvideValue () +{ + if (!UpdateValueIfNeeded()) + return false; + if (m_provides_value == eLazyBoolYes) + return true; + return m_parent->CanProvideValue(); +} diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp index 225dc02c8ad..aa8ade1aed1 100644 --- a/lldb/source/Core/ValueObjectVariable.cpp +++ b/lldb/source/Core/ValueObjectVariable.cpp @@ -234,7 +234,7 @@ ValueObjectVariable::UpdateValue () } } - if (GetClangType().IsAggregateType()) + if (!CanProvideValue()) { // this value object represents an aggregate type whose // children have values, but this object does not. So we |