diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp --- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp +++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp @@ -511,6 +511,10 @@ if (is_uninit) return false; + // If we have reached the maximum depth we shouldn't print any more children. + if (HasReachedMaximumDepth()) + return false; + // if the user has specified an element count, always print children as it is // explicit user demand being honored if (m_options.m_pointer_as_array) @@ -523,7 +527,7 @@ if (TypeSummaryImpl *type_summary = GetSummaryFormatter()) print_children = type_summary->DoesPrintChildren(m_valobj); - if (is_failed_description || !HasReachedMaximumDepth()) { + if (is_failed_description) { // We will show children for all concrete types. We won't show pointer // contents unless a pointer depth has been specified. We won't reference // contents unless the reference is the root object (depth of zero).