[Lldb-commits] [lldb] r223353 - Cleanup of the fix done recently for a lldb-mi hang on OSX.

Hafiz Abid Qadeer hafiz_abid at mentor.com
Thu Dec 4 03:05:32 PST 2014


Author: abidh
Date: Thu Dec  4 05:05:31 2014
New Revision: 223353

URL: http://llvm.org/viewvc/llvm-project?rev=223353&view=rev
Log:
Cleanup of the fix done recently for a lldb-mi hang on OSX.
It was observed that we dont need to set stdin to unbuffered and setting console
to non-canonical mode.

Patch originally came from "Ilia K <ki.stfu at gmail.com>"


Modified:
    lldb/trunk/tools/lldb-mi/MICmnStreamStdinLinux.cpp

Modified: lldb/trunk/tools/lldb-mi/MICmnStreamStdinLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnStreamStdinLinux.cpp?rev=223353&r1=223352&r2=223353&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnStreamStdinLinux.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnStreamStdinLinux.cpp Thu Dec  4 05:05:31 2014
@@ -161,23 +161,14 @@ CMICmnStreamStdinLinux::InputAvailable(b
     // Although this problem was not observed on Linux.
     // A solution based on 'select' was also proposed but it seems to slow things down
     // a lot.
-    static bool bInitialized = false;
-
-    if (!bInitialized)
+    int nBytesWaiting;
+    if (::ioctl(STDIN_FILENO, FIONREAD, &nBytesWaiting) == -1)
     {
-        // Use termios to turn off line buffering
-        ::termios term;
-        ::tcgetattr(STDIN_FILENO, &term);
-        term.c_lflag &= ~ICANON;
-        ::tcsetattr(STDIN_FILENO, TCSANOW, &term);
-        ::setbuf(stdin, NULL);
-        bInitialized = true;
+        vwbAvail = false;
+        return MIstatus::failure;;
     }
-
-    int nBytesWaiting;
-    ::ioctl(STDIN_FILENO, FIONREAD, &nBytesWaiting);
     vwbAvail = (nBytesWaiting > 0);
-#endif
+#endif // !defined( _WIN32 )
     return MIstatus::success;
 }
 





More information about the lldb-commits mailing list