[Lldb-commits] [lldb] r222177 - Disable Editline on Windows.

Zachary Turner zturner at google.com
Mon Nov 17 13:31:18 PST 2014


Author: zturner
Date: Mon Nov 17 15:31:18 2014
New Revision: 222177

URL: http://llvm.org/viewvc/llvm-project?rev=222177&view=rev
Log:
Disable Editline on Windows.

Editline does not work correctly on Windows.  This goes back at
least to r208369, and as a result r210105 was submitted to disable
libedit at runtime on Windows.

More recently, r222163 was submitted which re-writes editline
entirely, but makes the situation even worse on Windows, to the
point that it doesn't even compile.  While it would be easy to
fix the compilation failure, this patch simply stops compiling
Editline entirely on Windows, as the simple compilation fix would
still result in a broken use of select on Windows, and as such a
broken implementation of Editline.

Since Editline was already disabled to begin with on Windows, we
don't attempt to fix the compilation failure or the underlying
issues, and instead just disable it "even more".

Modified:
    lldb/trunk/source/CMakeLists.txt
    lldb/trunk/source/Core/IOHandler.cpp
    lldb/trunk/source/Host/CMakeLists.txt
    lldb/trunk/source/Host/common/Editline.cpp

Modified: lldb/trunk/source/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/CMakeLists.txt?rev=222177&r1=222176&r2=222177&view=diff
==============================================================================
--- lldb/trunk/source/CMakeLists.txt (original)
+++ lldb/trunk/source/CMakeLists.txt Mon Nov 17 15:31:18 2014
@@ -1,5 +1,16 @@
 include_directories(.)
 
+if (__ANDROID_NDK__ OR (CMAKE_SYSTEM_NAME MATCHES "Windows"))
+  set(LLDB_DEFAULT_DISABLE_LIBEDIT 1)
+else()
+  set(LLDB_DEFAULT_DISABLE_LIBEDIT 0)
+endif ()
+
+set(LLDB_DISABLE_LIBEDIT ${LLDB_DEFAULT_DISABLE_LIBEDIT} CACHE BOOL "Disables the use of editline.")
+if (LLDB_DISABLE_LIBEDIT)
+  add_definitions( -DLLDB_DISABLE_LIBEDIT )
+endif()
+
 if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
 include_directories(
   Plugins/Process/Linux

Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=222177&r1=222176&r2=222177&view=diff
==============================================================================
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Mon Nov 17 15:31:18 2014
@@ -387,12 +387,7 @@ IOHandlerEditline::IOHandlerEditline (De
 #ifndef LLDB_DISABLE_LIBEDIT
     bool use_editline = false;
     
-#ifndef _MSC_VER
     use_editline = m_input_sp->GetFile().GetIsRealTerminal();
-#else
-    // Editline is causing issues on Windows, so use the fallback.
-    use_editline = false;
-#endif
 
     if (use_editline)
     {
@@ -620,9 +615,11 @@ IOHandlerEditline::SetContinuationPrompt
         m_continuation_prompt = p;
     else
         m_continuation_prompt.clear();
-    
+
+#ifndef LLDB_DISABLE_LIBEDIT
     if (m_editline_ap)
         m_editline_ap->SetContinuationPrompt (m_continuation_prompt.empty() ? NULL : m_continuation_prompt.c_str());
+#endif
 }
 
 
@@ -635,7 +632,7 @@ IOHandlerEditline::SetBaseLineNumber (ui
 uint32_t
 IOHandlerEditline::GetCurrentLineIndex () const
 {
-#ifdef LLDB_DISABLE_LIBEDIT
+#ifndef LLDB_DISABLE_LIBEDIT
     if (m_editline_ap)
         return m_editline_ap->GetCurrentLine();
 #endif

Modified: lldb/trunk/source/Host/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=222177&r1=222176&r2=222177&view=diff
==============================================================================
--- lldb/trunk/source/Host/CMakeLists.txt (original)
+++ lldb/trunk/source/Host/CMakeLists.txt Mon Nov 17 15:31:18 2014
@@ -32,10 +32,10 @@ add_host_subdirectory(common
   common/TimeValue.cpp
   )
 
-if (NOT __ANDROID_NDK__)
-add_host_subdirectory(common
-  common/Editline.cpp
-  )
+if (NOT LLDB_DISABLE_LIBEDIT)
+  add_host_subdirectory(common
+    common/Editline.cpp
+    )
 endif()
 
 add_host_subdirectory(posix

Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=222177&r1=222176&r2=222177&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Mon Nov 17 15:31:18 2014
@@ -136,6 +136,10 @@ GetIndentation (const EditLineStringType
 bool
 IsInputPending (FILE * file)
 {
+    // FIXME: This will be broken on Windows if we ever re-enable Editline.  You can't use select
+    // on something that isn't a socket.  This will have to be re-written to not use a FILE*, but
+    // instead use some kind of yet-to-be-created abstraction that select-like functionality on
+    // non-socket objects.
     const int fd = fileno (file);
     fd_set fds;
     FD_ZERO (&fds);





More information about the lldb-commits mailing list