augusto2112 created this revision. augusto2112 added reviewers: aprantl, kastiglione. Herald added a project: All. augusto2112 requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
When formatting a variable, the max depth would potentially be ignored if the current value object failed to print itself. Change that to always respect the max depth, even if failure occurs rdar://109855463 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D152409 Files: lldb/source/DataFormatters/ValueObjectPrinter.cpp Index: lldb/source/DataFormatters/ValueObjectPrinter.cpp =================================================================== --- lldb/source/DataFormatters/ValueObjectPrinter.cpp +++ 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).
Index: lldb/source/DataFormatters/ValueObjectPrinter.cpp =================================================================== --- lldb/source/DataFormatters/ValueObjectPrinter.cpp +++ 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).
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits