[Lldb-commits] [lldb] r233278 - Fix infinite loop when ^D was pressed (MI)

Ilia K ki.stfu at gmail.com
Thu Mar 26 08:10:32 PDT 2015


Author: ki.stfu
Date: Thu Mar 26 10:10:32 2015
New Revision: 233278

URL: http://llvm.org/viewvc/llvm-project?rev=233278&view=rev
Log:
Fix infinite loop when ^D was pressed (MI)


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

Modified: lldb/trunk/tools/lldb-mi/MICmnStreamStdin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnStreamStdin.cpp?rev=233278&r1=233277&r2=233278&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnStreamStdin.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnStreamStdin.cpp Thu Mar 26 10:10:32 2015
@@ -12,6 +12,7 @@
 #include "MICmnStreamStdout.h"
 #include "MICmnResources.h"
 #include "MICmnLog.h"
+#include "MIDriver.h"
 #include "MIUtilSingletonHelper.h"
 #include <string.h> // For std::strerror()
 
@@ -205,7 +206,12 @@ CMICmnStreamStdin::ReadLine(CMIUtilStrin
     const MIchar *pText = ::fgets(&m_pCmdBuffer[0], m_constBufferSize, stdin);
     if (pText == nullptr)
     {
-        if (::ferror(stdin) != 0)
+        if (::feof(stdin))
+        {
+            const bool bForceExit = true;
+            CMIDriver::Instance().SetExitApplicationFlag(bForceExit);
+        }
+        else if (::ferror(stdin) != 0)
             vwErrMsg = ::strerror(errno);
         return nullptr;
     }





More information about the lldb-commits mailing list