[Lldb-commits] [lldb] r366520 - check for interrupt from fgets on Windows

Nathan Lanza via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 18 17:40:37 PDT 2019


Author: lanza
Date: Thu Jul 18 17:40:37 2019
New Revision: 366520

URL: http://llvm.org/viewvc/llvm-project?rev=366520&view=rev
Log:
check for interrupt from fgets on Windows

Windows does not have the error EINTR when a blocking syscall is
interrupted by a signal. The ReadFile API that fgets is implemented
with instead use ERROR_OPERATION_ABORTED. Check for that after fgets.

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

Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=366520&r1=366519&r2=366520&view=diff
==============================================================================
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Thu Jul 18 17:40:37 2019
@@ -383,6 +383,9 @@ bool IOHandlerEditline::GetLine(std::str
         // fgets twice until this bug is fixed.
         if (fgets(buffer, sizeof(buffer), in) == nullptr &&
             fgets(buffer, sizeof(buffer), in) == nullptr) {
+          // this is the equivalent of EINTR for Windows
+          if (GetLastError() == ERROR_OPERATION_ABORTED)
+            continue;
 #else
         if (fgets(buffer, sizeof(buffer), in) == nullptr) {
 #endif




More information about the lldb-commits mailing list