[Lldb-commits] [lldb] r124810 - in /lldb/trunk/source/Core: Communication.cpp ConnectionFileDescriptor.cpp

Caroline Tice ctice at apple.com
Thu Feb 3 12:02:43 PST 2011


Author: ctice
Date: Thu Feb  3 14:02:43 2011
New Revision: 124810

URL: http://llvm.org/viewvc/llvm-project?rev=124810&view=rev
Log:
Fix the ctr-D and end-of-file stuff.


Modified:
    lldb/trunk/source/Core/Communication.cpp
    lldb/trunk/source/Core/ConnectionFileDescriptor.cpp

Modified: lldb/trunk/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=124810&r1=124809&r2=124810&view=diff
==============================================================================
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Thu Feb  3 14:02:43 2011
@@ -293,7 +293,8 @@
     lldb_private::LogIfAnyCategoriesSet (LIBLLDB_LOG_COMMUNICATION,
                                  "%p Communication::AppendBytesToCache (src = %p, src_len = %zu, broadcast = %i)",
                                  this, bytes, len, broadcast);
-    if (bytes == NULL || len == 0)
+    if ((bytes == NULL || len == 0)
+        && (status != lldb::eConnectionStatusEndOfFile))
         return;
     if (m_callback)
     {
@@ -348,6 +349,13 @@
             size_t bytes_read = comm->ReadFromConnection (buf, sizeof(buf), status, &error);
             if (bytes_read > 0)
                 comm->AppendBytesToCache (buf, bytes_read, true, status);
+            else if ((bytes_read == 0)
+                    && status == eConnectionStatusEndOfFile)
+            {
+                if (comm->GetCloseOnEOF ())
+                    comm->Disconnect ();
+                comm->AppendBytesToCache (buf, bytes_read, true, status);
+            }
         }
 
         switch (status)
@@ -356,6 +364,9 @@
             break;
 
         case eConnectionStatusEndOfFile:
+            if (comm->GetCloseOnEOF())
+                 done = true;
+             break;
         case eConnectionStatusNoConnection:     // No connection
         case eConnectionStatusLostConnection:   // Lost connection while connected to a valid connection
             done = true;

Modified: lldb/trunk/source/Core/ConnectionFileDescriptor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConnectionFileDescriptor.cpp?rev=124810&r1=124809&r2=124810&view=diff
==============================================================================
--- lldb/trunk/source/Core/ConnectionFileDescriptor.cpp (original)
+++ lldb/trunk/source/Core/ConnectionFileDescriptor.cpp Thu Feb  3 14:02:43 2011
@@ -155,13 +155,9 @@
     Error error;
     ssize_t bytes_read = ::read (m_fd, dst, dst_len);
     if (bytes_read == 0)
-//        Disable the end-of-file special handling stuff for now.  Hopefully re-instate it (properly fixed) at a 
-//        later date:
     {
-//        error.Clear(); // End-of-file.  Do not automatically close; pass along for the end-of-file handlers.
-//        status = eConnectionStatusEndOfFile;
-        error.SetErrorStringWithFormat("End-of-file.\n");
-        status = eConnectionStatusLostConnection;
+        error.Clear(); // End-of-file.  Do not automatically close; pass along for the end-of-file handlers.
+        status = eConnectionStatusEndOfFile;
     }
     else if (bytes_read < 0)
     {





More information about the lldb-commits mailing list