[Lldb-commits] [PATCH] D126081: [lldb] Fix spurious lldb_assert in PrintCommandOutput

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri May 20 14:15:57 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGd252d9231c4a: [lldb] Fix spurious assertion in PrintCommandOutput (authored by JDevlieghere).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126081/new/

https://reviews.llvm.org/D126081

Files:
  lldb/source/Interpreter/CommandInterpreter.cpp


Index: lldb/source/Interpreter/CommandInterpreter.cpp
===================================================================
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2989,22 +2989,18 @@
   lldb::StreamFileSP stream = is_stdout ? io_handler.GetOutputStreamFileSP()
                                         : io_handler.GetErrorStreamFileSP();
   // Split the output into lines and poll for interrupt requests
-  size_t size = str.size();
-  while (size > 0 && !WasInterrupted()) {
+  while (!str.empty() && !WasInterrupted()) {
     llvm::StringRef line;
-    size_t written = 0;
     std::tie(line, str) = str.split('\n');
     {
       std::lock_guard<std::recursive_mutex> guard(io_handler.GetOutputMutex());
-      written += stream->Write(line.data(), line.size());
-      written += stream->Write("\n", 1);
+      stream->Write(line.data(), line.size());
+      stream->Write("\n", 1);
     }
-    lldbassert(size >= written);
-    size -= written;
   }
 
   std::lock_guard<std::recursive_mutex> guard(io_handler.GetOutputMutex());
-  if (size > 0)
+  if (!str.empty())
     stream->Printf("\n... Interrupted.\n");
   stream->Flush();
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126081.431051.patch
Type: text/x-patch
Size: 1206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220520/ba7a07a0/attachment.bin>


More information about the lldb-commits mailing list