diff options
author | Caroline Tice <ctice@apple.com> | 2011-02-03 20:02:43 +0000 |
---|---|---|
committer | Caroline Tice <ctice@apple.com> | 2011-02-03 20:02:43 +0000 |
commit | 9fd5850fbcfcb4c660c875c30a544c847fa028e4 (patch) | |
tree | a12ecf7c48680b38f3295db2e2029439a759827c /lldb/source/Core | |
parent | 7f6f81ba9bb6d9b762e51a70081f11904fcaa027 (diff) | |
download | bcm5719-llvm-9fd5850fbcfcb4c660c875c30a544c847fa028e4.tar.gz bcm5719-llvm-9fd5850fbcfcb4c660c875c30a544c847fa028e4.zip |
Fix the ctr-D and end-of-file stuff.
llvm-svn: 124810
Diffstat (limited to 'lldb/source/Core')
-rw-r--r-- | lldb/source/Core/Communication.cpp | 13 | ||||
-rw-r--r-- | lldb/source/Core/ConnectionFileDescriptor.cpp | 8 |
2 files changed, 14 insertions, 7 deletions
diff --git a/lldb/source/Core/Communication.cpp b/lldb/source/Core/Communication.cpp index cf58aa5eff8..6b8a6fe530b 100644 --- a/lldb/source/Core/Communication.cpp +++ b/lldb/source/Core/Communication.cpp @@ -293,7 +293,8 @@ Communication::AppendBytesToCache (const uint8_t * bytes, size_t len, bool broad 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 @@ Communication::ReadThread (void *p) 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 @@ Communication::ReadThread (void *p) 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; diff --git a/lldb/source/Core/ConnectionFileDescriptor.cpp b/lldb/source/Core/ConnectionFileDescriptor.cpp index 30cab9f4c32..1b653780516 100644 --- a/lldb/source/Core/ConnectionFileDescriptor.cpp +++ b/lldb/source/Core/ConnectionFileDescriptor.cpp @@ -155,13 +155,9 @@ ConnectionFileDescriptor::Read (void *dst, size_t dst_len, ConnectionStatus &sta 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) { |