From d553d00c79eb250a10cd3ad8b45103ff0be0c9ee Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Mon, 17 Nov 2014 21:31:18 +0000 Subject: [PATCH] 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". llvm-svn: 222177 --- lldb/source/CMakeLists.txt | 11 +++++++++++ lldb/source/Core/IOHandler.cpp | 11 ++++------- lldb/source/Host/CMakeLists.txt | 8 ++++---- lldb/source/Host/common/Editline.cpp | 4 ++++ 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/lldb/source/CMakeLists.txt b/lldb/source/CMakeLists.txt index 5e2ac8b..d551ebb 100644 --- a/lldb/source/CMakeLists.txt +++ b/lldb/source/CMakeLists.txt @@ -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 diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp index bf3815b..21ba965 100644 --- a/lldb/source/Core/IOHandler.cpp +++ b/lldb/source/Core/IOHandler.cpp @@ -387,12 +387,7 @@ IOHandlerEditline::IOHandlerEditline (Debugger &debugger, #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 (const char *p) 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 (uint32_t line) uint32_t IOHandlerEditline::GetCurrentLineIndex () const { -#ifdef LLDB_DISABLE_LIBEDIT +#ifndef LLDB_DISABLE_LIBEDIT if (m_editline_ap) return m_editline_ap->GetCurrentLine(); #endif diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt index e77b535..50f57592 100644 --- a/lldb/source/Host/CMakeLists.txt +++ b/lldb/source/Host/CMakeLists.txt @@ -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 diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp index 215f06f..b82fbea 100644 --- a/lldb/source/Host/common/Editline.cpp +++ b/lldb/source/Host/common/Editline.cpp @@ -136,6 +136,10 @@ GetIndentation (const EditLineStringType & line) 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); -- 2.7.4