[Lldb-commits] [lldb] r179613 - <rdar://problem/13657900>

Greg Clayton gclayton at apple.com
Tue Apr 16 11:30:47 PDT 2013


Author: gclayton
Date: Tue Apr 16 13:30:46 2013
New Revision: 179613

URL: http://llvm.org/viewvc/llvm-project?rev=179613&view=rev
Log:
<rdar://problem/13657900>

Special handling for file descriptor connections that are tty files.


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

Modified: lldb/trunk/source/Core/ConnectionFileDescriptor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConnectionFileDescriptor.cpp?rev=179613&r1=179612&r2=179613&view=diff
==============================================================================
--- lldb/trunk/source/Core/ConnectionFileDescriptor.cpp (original)
+++ lldb/trunk/source/Core/ConnectionFileDescriptor.cpp Tue Apr 16 13:30:46 2013
@@ -25,6 +25,7 @@
 #include <netinet/tcp.h>
 #include <sys/socket.h>
 #include <sys/un.h>
+#include <sys/termios.h>
 #include <sys/types.h>
 #include <string.h>
 #include <stdlib.h>
@@ -272,6 +273,26 @@ ConnectionFileDescriptor::Connect (const
                 return eConnectionStatusError;
             }
 
+            if (::isatty(m_fd_send))
+            {
+                // Set up serial terminal emulation
+                struct termios options;
+                ::tcgetattr (m_fd_send, &options);
+
+                // Set port speed to maximum
+                ::cfsetospeed (&options, B115200);
+                ::cfsetispeed (&options, B115200);
+
+                // Raw input, disable echo and signals
+                options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
+
+                // Make sure only one character is needed to return from a read
+                options.c_cc[VMIN]  = 1;
+                options.c_cc[VTIME] = 0;
+
+                ::tcsetattr (m_fd_send, TCSANOW, &options);
+            }
+
             int flags = ::fcntl (m_fd_send, F_GETFL, 0);
             if (flags >= 0)
             {





More information about the lldb-commits mailing list