[Lldb-commits] [lldb] r200790 - LLDB exits the command interpreter and thus LLDB when using a pty or file as the input handle and a blank line is entered (like when running under emacs). This is now fixed.

Greg Clayton gclayton at apple.com
Tue Feb 4 11:25:11 PST 2014


Author: gclayton
Date: Tue Feb  4 13:25:11 2014
New Revision: 200790

URL: http://llvm.org/viewvc/llvm-project?rev=200790&view=rev
Log:
LLDB exits the command interpreter and thus LLDB when using a pty or file as the input handle and a blank line is entered (like when running under emacs). This is now fixed.

<rdar://problem/15976187>


Modified:
    lldb/trunk/source/Core/IOHandler.cpp

Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=200790&r1=200789&r2=200790&view=diff
==============================================================================
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Tue Feb  4 13:25:11 2014
@@ -397,12 +397,14 @@ IOHandlerEditline::GetLine (std::string
             }
             char buffer[256];
             bool done = false;
+            bool got_line = false;
             while (!done)
             {
                 if (fgets(buffer, sizeof(buffer), in) == NULL)
                     done = true;
                 else
                 {
+                    got_line = true;
                     size_t buffer_len = strlen(buffer);
                     assert (buffer[buffer_len] == '\0');
                     char last_char = buffer[buffer_len-1];
@@ -421,6 +423,9 @@ IOHandlerEditline::GetLine (std::string
                     line.append(buffer, buffer_len);
                 }
             }
+            // We might have gotten a newline on a line by itself
+            // make sure to return true in this case.
+            return got_line;
         }
         else
         {





More information about the lldb-commits mailing list