diff options
Diffstat (limited to 'lldb/source/Core')
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 14 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectCast.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectChild.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectConstResult.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectDynamicValue.cpp | 9 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectMemory.cpp | 11 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectRegister.cpp | 17 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectSyntheticFilter.cpp | 14 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectVariable.cpp | 5 |
9 files changed, 59 insertions, 26 deletions
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 708526d4469..ecafd202e4c 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -770,9 +770,21 @@ ValueObject::GetChildMemberWithName (const ConstString &name, bool can_create) size_t -ValueObject::GetNumChildren () +ValueObject::GetNumChildren (uint32_t max) { UpdateValueIfNeeded(); + + if (max < UINT32_MAX) + { + if (m_children_count_valid) + { + size_t children_count = m_children.GetChildrenCount(); + return children_count <= max ? children_count : max; + } + else + return CalculateNumChildren(max); + } + if (!m_children_count_valid) { SetNumChildren (CalculateNumChildren()); diff --git a/lldb/source/Core/ValueObjectCast.cpp b/lldb/source/Core/ValueObjectCast.cpp index ac7562024ac..1c5838b820e 100644 --- a/lldb/source/Core/ValueObjectCast.cpp +++ b/lldb/source/Core/ValueObjectCast.cpp @@ -68,9 +68,10 @@ ValueObjectCast::GetCompilerTypeImpl () } size_t -ValueObjectCast::CalculateNumChildren() +ValueObjectCast::CalculateNumChildren(uint32_t max) { - return GetCompilerType().GetNumChildren (true); + auto children_count = GetCompilerType().GetNumChildren (true); + return children_count <= max ? children_count : max; } uint64_t diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp index 7e95da6a5e9..8b579a5e42c 100644 --- a/lldb/source/Core/ValueObjectChild.cpp +++ b/lldb/source/Core/ValueObjectChild.cpp @@ -62,9 +62,10 @@ ValueObjectChild::GetValueType() const } size_t -ValueObjectChild::CalculateNumChildren() +ValueObjectChild::CalculateNumChildren(uint32_t max) { - return GetCompilerType().GetNumChildren (true); + auto children_count = GetCompilerType().GetNumChildren (true); + return children_count <= max ? children_count : max; } static void diff --git a/lldb/source/Core/ValueObjectConstResult.cpp b/lldb/source/Core/ValueObjectConstResult.cpp index 6154829b240..a0f1737a861 100644 --- a/lldb/source/Core/ValueObjectConstResult.cpp +++ b/lldb/source/Core/ValueObjectConstResult.cpp @@ -270,9 +270,10 @@ ValueObjectConstResult::SetByteSize (size_t size) } size_t -ValueObjectConstResult::CalculateNumChildren() +ValueObjectConstResult::CalculateNumChildren(uint32_t max) { - return GetCompilerType().GetNumChildren (true); + auto children_count = GetCompilerType().GetNumChildren (true); + return children_count <= max ? children_count : max; } ConstString diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp index 3de12e5a66f..cec2ca52384 100644 --- a/lldb/source/Core/ValueObjectDynamicValue.cpp +++ b/lldb/source/Core/ValueObjectDynamicValue.cpp @@ -113,13 +113,16 @@ ValueObjectDynamicValue::GetDisplayTypeName() } size_t -ValueObjectDynamicValue::CalculateNumChildren() +ValueObjectDynamicValue::CalculateNumChildren(uint32_t max) { const bool success = UpdateValueIfNeeded(false); if (success && m_dynamic_type_info.HasType()) - return GetCompilerType().GetNumChildren (true); + { + auto children_count = GetCompilerType().GetNumChildren (true); + return children_count <= max ? children_count : max; + } else - return m_parent->GetNumChildren(); + return m_parent->GetNumChildren(max); } uint64_t diff --git a/lldb/source/Core/ValueObjectMemory.cpp b/lldb/source/Core/ValueObjectMemory.cpp index fa483516d8e..b989710c95d 100644 --- a/lldb/source/Core/ValueObjectMemory.cpp +++ b/lldb/source/Core/ValueObjectMemory.cpp @@ -156,12 +156,17 @@ ValueObjectMemory::GetDisplayTypeName() } size_t -ValueObjectMemory::CalculateNumChildren() +ValueObjectMemory::CalculateNumChildren(uint32_t max) { if (m_type_sp) - return m_type_sp->GetNumChildren(true); + { + auto child_count = m_type_sp->GetNumChildren(true); + return child_count <= max ? child_count : max; + } + const bool omit_empty_base_classes = true; - return m_compiler_type.GetNumChildren (omit_empty_base_classes); + auto child_count = m_compiler_type.GetNumChildren (omit_empty_base_classes); + return child_count <= max ? child_count : max; } uint64_t diff --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp index 1e8a4156a61..c7845cd0320 100644 --- a/lldb/source/Core/ValueObjectRegister.cpp +++ b/lldb/source/Core/ValueObjectRegister.cpp @@ -67,9 +67,10 @@ ValueObjectRegisterContext::GetQualifiedTypeName() } size_t -ValueObjectRegisterContext::CalculateNumChildren() +ValueObjectRegisterContext::CalculateNumChildren(uint32_t max) { - return m_reg_ctx_sp->GetRegisterSetCount(); + auto reg_set_count = m_reg_ctx_sp->GetRegisterSetCount(); + return reg_set_count <= max ? reg_set_count : max; } uint64_t @@ -163,11 +164,14 @@ ValueObjectRegisterSet::GetQualifiedTypeName() } size_t -ValueObjectRegisterSet::CalculateNumChildren() +ValueObjectRegisterSet::CalculateNumChildren(uint32_t max) { const RegisterSet *reg_set = m_reg_ctx_sp->GetRegisterSet(m_reg_set_idx); if (reg_set) - return reg_set->num_registers; + { + auto reg_count = reg_set->num_registers; + return reg_count <= max ? reg_count : max; + } return 0; } @@ -338,9 +342,10 @@ ValueObjectRegister::GetTypeName() } size_t -ValueObjectRegister::CalculateNumChildren() +ValueObjectRegister::CalculateNumChildren(uint32_t max) { - return GetCompilerType().GetNumChildren(true); + auto children_count = GetCompilerType().GetNumChildren (true); + return children_count <= max ? children_count : max; } uint64_t diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp index e82862af1df..0ba0282448b 100644 --- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp +++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp @@ -26,7 +26,7 @@ public: {} size_t - CalculateNumChildren() + CalculateNumChildren () { return m_backend.GetNumChildren(); } @@ -36,7 +36,7 @@ public: { return m_backend.GetChildAtIndex(idx, true); } - + size_t GetIndexOfChildWithName (const ConstString &name) { @@ -107,12 +107,16 @@ ValueObjectSynthetic::GetDisplayTypeName() } size_t -ValueObjectSynthetic::CalculateNumChildren() +ValueObjectSynthetic::CalculateNumChildren(uint32_t max) { UpdateValueIfNeeded(); if (m_synthetic_children_count < UINT32_MAX) - return m_synthetic_children_count; - return (m_synthetic_children_count = m_synth_filter_ap->CalculateNumChildren()); + return m_synthetic_children_count <= max ? m_synthetic_children_count : max; + + if (max < UINT32_MAX) + return m_synth_filter_ap->CalculateNumChildren(max); + else + return (m_synthetic_children_count = m_synth_filter_ap->CalculateNumChildren(max)); } lldb::ValueObjectSP diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp index 72107400bfc..389b7c54243 100644 --- a/lldb/source/Core/ValueObjectVariable.cpp +++ b/lldb/source/Core/ValueObjectVariable.cpp @@ -91,7 +91,7 @@ ValueObjectVariable::GetQualifiedTypeName() } size_t -ValueObjectVariable::CalculateNumChildren() +ValueObjectVariable::CalculateNumChildren(uint32_t max) { CompilerType type(GetCompilerType()); @@ -99,7 +99,8 @@ ValueObjectVariable::CalculateNumChildren() return 0; const bool omit_empty_base_classes = true; - return type.GetNumChildren(omit_empty_base_classes); + auto child_count = type.GetNumChildren(omit_empty_base_classes); + return child_count <= max ? child_count : max; } uint64_t |