[Lldb-commits] [PATCH] D151748: [lldb] Consult summary provider before printing children of root references

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue May 30 13:16:08 PDT 2023


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

When printing the root of a value, if it's a reference its children are unconditionally
printed - in contrast to pointers whose children are only printed if a sufficient
pointer depth is given.

However, the children are printed even when there's a summary provider that says not to.
If a summary provider exists, this change consults it to determine if children should be
printed.

For example, given a variable of type `std::string &`, this change has the following
effect:

Before:

  (lldb) p string_ref
  (std::string &) string_ref = "one two three four five six seven eight nine ten": {
    __r_ = {
      std::__1::__compressed_pair_elem<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, 0, false> = {
        __value_ = {
           = {
            __l = (__data_ = "one two three four five six seven eight nine ten", __size_ = 48, __cap_ = 64, __is_long_ = 1)
            __s = (__data_ = "@\0p\U00000001\0`\0\00\0\0\0\0\0\0\0@", __padding_ = "\x80t<", __size_ = '\0', __is_long_ = '\x01')
            __r = {
              __words ={...}
            }
          }
        }
      }
    }
  }

After:

  (lldb) p string_ref
  (std::string &) string_ref = "one two three four five six seven eight nine ten"

rdar://73248786


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151748

Files:
  lldb/source/DataFormatters/ValueObjectPrinter.cpp
  lldb/test/API/functionalities/data-formatter/root-reference-children/Makefile
  lldb/test/API/functionalities/data-formatter/root-reference-children/TestRootReferenceChildren.py
  lldb/test/API/functionalities/data-formatter/root-reference-children/main.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151748.526761.patch
Type: text/x-patch
Size: 3681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230530/76694b07/attachment.bin>


More information about the lldb-commits mailing list