[Lldb-commits] [PATCH] D111634: [lldb] Print embedded nuls in char arrays (PR44649)

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 12 05:42:37 PDT 2021


labath created this revision.
labath added reviewers: teemperor, jingham.
labath requested review of this revision.
Herald added a project: LLDB.

When we know the bounds of the array, print any embedded nuls instead of
treating them as terminators. An exception to this rule is made for the
nul character at the very end of the string. We don't print that, as
otherwise 99% of the strings would end in \0. This way the strings
usually come out the same as how the user typed it into the compiler
(char foo[] = "with\0nuls"). It also matches how they come out in gdb.

This resolves a FIXME left from D111399 <https://reviews.llvm.org/D111399>, and leaves another FIXME for dealing
with nul characters in "escape-non-printables=false" mode. In this mode the
characters cause the entire summary string to be terminated prematurely.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111634

Files:
  lldb/source/Core/ValueObject.cpp
  lldb/test/API/functionalities/data-formatter/builtin-formats/TestBuiltinFormats.py
  lldb/test/API/functionalities/data-formatter/stringprinter/main.cpp
  lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_const_value.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111634.378988.patch
Type: text/x-patch
Size: 6193 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211012/58d70c48/attachment.bin>


More information about the lldb-commits mailing list