[Lldb-commits] [PATCH] D151950: [lldb] Unconditionally increment depth when printing children

Augusto Noronha via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 1 17:04:30 PDT 2023


augusto2112 created this revision.
augusto2112 added reviewers: kastiglione, aprantl, DavidSpickett.
Herald added a project: All.
augusto2112 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The `target.max-children-depth` setting and `--depth` flag would be
ignored if treating pointer as arrays, fix that by always incrementing
the current depth when printing a new child.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151950

Files:
  lldb/source/DataFormatters/ValueObjectPrinter.cpp


Index: lldb/source/DataFormatters/ValueObjectPrinter.cpp
===================================================================
--- lldb/source/DataFormatters/ValueObjectPrinter.cpp
+++ lldb/source/DataFormatters/ValueObjectPrinter.cpp
@@ -590,7 +590,7 @@
 void ValueObjectPrinter::PrintChild(
     ValueObjectSP child_sp,
     const DumpValueObjectOptions::PointerDepth &curr_ptr_depth) {
-  const uint32_t consumed_depth = (!m_options.m_pointer_as_array) ? 1 : 0;
+  const uint32_t consumed_depth = m_options.m_pointer_as_array ? 0 : 1;
   const bool does_consume_ptr_depth =
       ((IsPtr() && !m_options.m_pointer_as_array) || IsRef());
 
@@ -611,7 +611,7 @@
     ValueObjectPrinter child_printer(
         child_sp.get(), m_stream, child_options,
         does_consume_ptr_depth ? --curr_ptr_depth : curr_ptr_depth,
-        m_curr_depth + consumed_depth, m_printed_instance_pointers);
+        m_curr_depth + 1, m_printed_instance_pointers);
     child_printer.PrintValueObject();
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151950.527669.patch
Type: text/x-patch
Size: 993 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230602/dca97170/attachment.bin>


More information about the lldb-commits mailing list