[all-commits] [llvm/llvm-project] ca0ce9: [lldb] Print embedded nuls in char arrays (PR44649)

Pavel Labath via All-commits all-commits at lists.llvm.org
Thu Oct 14 00:53:03 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ca0ce99fc87c9a49b4c4a69cc6e88594bf6eb13c
      https://github.com/llvm/llvm-project/commit/ca0ce99fc87c9a49b4c4a69cc6e88594bf6eb13c
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2021-10-14 (Thu, 14 Oct 2021)

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

  Log Message:
  -----------
  [lldb] Print embedded nuls in char arrays (PR44649)

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

Differential Revision: https://reviews.llvm.org/D111634




More information about the All-commits mailing list