[Lldb-commits] [PATCH] D122025: [lldb] Remove lldbassert from CommandInterpreter::PrintCommandOutput

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 18 11:56:39 PDT 2022


JDevlieghere created this revision.
JDevlieghere added reviewers: labath, lemo, jingham, mib.
Herald added a project: All.
JDevlieghere requested review of this revision.

The assertion checks that the command output doesn't contain any null
bytes. I'm not sure if the intention was to make sure the string wasn't
shorter than the reported length or if this was a way to catch us
accidentally writing an (unformatted) null byte.

Regardless, the command output can be based on user input, so an
assertion doesn't make sense. For example, you should be totally allowed
to call print("\0") from Python. The latter doesn't trigger this bug
because it writes directly to the output stream and therefore bypasses
PrintCommandOutput but that's just an implementation detail.


https://reviews.llvm.org/D122025

Files:
  lldb/source/Interpreter/CommandInterpreter.cpp


Index: lldb/source/Interpreter/CommandInterpreter.cpp
===================================================================
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2987,7 +2987,6 @@
   while (size > 0 && !WasInterrupted()) {
     size_t chunk_size = 0;
     for (; chunk_size < size; ++chunk_size) {
-      lldbassert(data[chunk_size] != '\0');
       if (data[chunk_size] == '\n') {
         ++chunk_size;
         break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122025.416566.patch
Type: text/x-patch
Size: 487 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220318/a0b411cc/attachment.bin>


More information about the lldb-commits mailing list