Author: vharron Date: Mon Apr 20 13:15:33 2015 New Revision: 235322 URL: http://llvm.org/viewvc/llvm-project?rev=235322&view=rev Log: ConnectionFileDescriptor::BytesAvailable reading too many command bytes
ConnectionFileDescriptor::BytesAvailable was reading multiple command bytes from the command pipe but only processing the first. This change only allows one byte to be read at a time, ensuring that all get handled. This isn't known to cause any bugs, but it might cause current/future bugs. Differential Revision: http://reviews.llvm.org/D9098 Modified: lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp Modified: lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp?rev=235322&r1=235321&r2=235322&view=diff ============================================================================== --- lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp (original) +++ lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp Mon Apr 20 13:15:33 2015 @@ -685,8 +685,10 @@ ConnectionFileDescriptor::BytesAvailable return eConnectionStatusSuccess; if (have_pipe_fd && FD_ISSET(pipe_fd, FD_SET_DATA(read_fds))) { - // We got a command to exit. Read the data from that pipe: - char buffer[16]; + // There is an interrupt or exit command in the command pipe + // Read the data from that pipe: + char buffer[1]; + ssize_t bytes_read; do @@ -698,8 +700,9 @@ ConnectionFileDescriptor::BytesAvailable { case 'q': if (log) - log->Printf("%p ConnectionFileDescriptor::BytesAvailable() got data: %*s from the command channel.", - static_cast<void *>(this), static_cast<int>(bytes_read), buffer); + log->Printf("%p ConnectionFileDescriptor::BytesAvailable() " + "got data: %c from the command channel.", + static_cast<void *>(this), buffer[0]); return eConnectionStatusEndOfFile; case 'i': // Interrupt the current read _______________________________________________ lldb-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
