[Lldb-commits] [PATCH] D152409: [lldb] Never print children if the max depth has been reached

Augusto Noronha via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 7 16:20:43 PDT 2023


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).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152409.529466.patch
Type: text/x-patch
Size: 1058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230607/2bf5d36c/attachment.bin>


More information about the lldb-commits mailing list