diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -25,7 +25,7 @@ endif() set(default_disable_python OFF) -set(default_disable_libedit OFF) +set(default_enable_libedit ON) set(default_enable_curses ON) if(DEFINED LLVM_ENABLE_LIBEDIT AND NOT LLVM_ENABLE_LIBEDIT) @@ -33,18 +33,18 @@ endif() if(CMAKE_SYSTEM_NAME MATCHES "Windows") - set(default_disable_libedit ON) + set(default_enable_libedit OFF) set(default_enable_curses OFF) elseif(CMAKE_SYSTEM_NAME MATCHES "Android") set(default_disable_python ON) - set(default_disable_libedit ON) + set(default_enable_libedit OFF) set(default_enable_curses OFF) elseif(IOS) set(default_disable_python ON) endif() option(LLDB_DISABLE_PYTHON "Disable Python scripting integration." ${default_disable_python}) -option(LLDB_DISABLE_LIBEDIT "Disable the use of editline." ${default_disable_libedit}) +option(LLDB_ENABLE_LIBEDIT "Disable the use of editline." ${default_enable_libedit}) option(LLDB_ENABLE_CURSES "Disable Curses integration." ${default_enable_curses}) option(LLDB_RELOCATABLE_PYTHON "Use the PYTHONHOME environment variable to locate Python." OFF) option(LLDB_USE_SYSTEM_SIX "Use six.py shipped with system and do not install a copy of it" OFF) @@ -109,7 +109,7 @@ endif() -if (NOT LLDB_DISABLE_LIBEDIT) +if (LLDB_ENABLE_LIBEDIT) find_package(LibEdit REQUIRED) # Check if we libedit capable of handling wide characters (built with diff --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst --- a/lldb/docs/resources/build.rst +++ b/lldb/docs/resources/build.rst @@ -401,8 +401,8 @@ :: - -DLLDB_DISABLE_LIBEDIT=1 -DLLDB_DISABLE_PYTHON=1 + -DLLDB_ENABLE_LIBEDIT=0 -DLLDB_ENABLE_CURSES=0 -DLLVM_ENABLE_TERMINFO=0 @@ -454,7 +454,7 @@ -DLLVM_TABLEGEN=/bin/llvm-tblgen \ -DCLANG_TABLEGEN=/bin/clang-tblgen \ -DLLDB_DISABLE_PYTHON=1 \ - -DLLDB_DISABLE_LIBEDIT=1 \ + -DLLDB_ENABLE_LIBEDIT=0 \ -DLLDB_ENABLE_CURSES=0 An alternative (and recommended) way to compile LLDB is with clang. diff --git a/lldb/include/lldb/Core/IOHandler.h b/lldb/include/lldb/Core/IOHandler.h --- a/lldb/include/lldb/Core/IOHandler.h +++ b/lldb/include/lldb/Core/IOHandler.h @@ -407,7 +407,7 @@ void PrintAsync(Stream *stream, const char *s, size_t len) override; private: -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT static bool IsInputCompleteCallback(Editline *editline, StringList &lines, void *baton); @@ -418,7 +418,7 @@ #endif protected: -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT std::unique_ptr m_editline_up; #endif IOHandlerDelegate &m_delegate; diff --git a/lldb/include/lldb/Host/Config.h.cmake b/lldb/include/lldb/Host/Config.h.cmake --- a/lldb/include/lldb/Host/Config.h.cmake +++ b/lldb/include/lldb/Host/Config.h.cmake @@ -37,9 +37,9 @@ #cmakedefine01 LLDB_ENABLE_CURSES -#cmakedefine LLDB_ENABLE_LIBXML2 +#cmakedefine01 LLDB_ENABLE_LIBEDIT -#cmakedefine LLDB_DISABLE_LIBEDIT +#cmakedefine LLDB_ENABLE_LIBXML2 #cmakedefine LLDB_DISABLE_PYTHON diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt --- a/lldb/source/Core/CMakeLists.txt +++ b/lldb/source/Core/CMakeLists.txt @@ -98,7 +98,7 @@ # TODO: Remove once we have better layering set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 4) -if (NOT LLDB_DISABLE_LIBEDIT) +if (LLDB_ENABLE_LIBEDIT) target_include_directories(lldbCore PRIVATE ${libedit_INCLUDE_DIRS}) endif() diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp --- a/lldb/source/Core/IOHandler.cpp +++ b/lldb/source/Core/IOHandler.cpp @@ -22,7 +22,7 @@ #include "lldb/Utility/StringList.h" #include "lldb/lldb-forward.h" -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT #include "lldb/Host/Editline.h" #endif #include "lldb/Interpreter/CommandCompletions.h" @@ -234,7 +234,7 @@ IOHandlerDelegate &delegate, repro::DataRecorder *data_recorder) : IOHandler(debugger, type, input_sp, output_sp, error_sp, flags, data_recorder), -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT m_editline_up(), #endif m_delegate(delegate), m_prompt(), m_continuation_prompt(), @@ -244,7 +244,7 @@ m_editing(false) { SetPrompt(prompt); -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT bool use_editline = false; use_editline = GetInputFILE() && GetOutputFILE() && GetErrorFILE() && @@ -272,7 +272,7 @@ } IOHandlerEditline::~IOHandlerEditline() { -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT m_editline_up.reset(); #endif } @@ -308,7 +308,7 @@ } bool IOHandlerEditline::GetLine(std::string &line, bool &interrupted) { -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT if (m_editline_up) { bool b = m_editline_up->GetLine(line, interrupted); if (b && m_data_recorder) @@ -402,7 +402,7 @@ return (bool)got_line; } -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT bool IOHandlerEditline::IsInputCompleteCallback(Editline *editline, StringList &lines, void *baton) { @@ -429,14 +429,14 @@ #endif const char *IOHandlerEditline::GetPrompt() { -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT if (m_editline_up) { return m_editline_up->GetPrompt(); } else { #endif if (m_prompt.empty()) return nullptr; -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT } #endif return m_prompt.c_str(); @@ -445,7 +445,7 @@ bool IOHandlerEditline::SetPrompt(llvm::StringRef prompt) { m_prompt = prompt; -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT if (m_editline_up) m_editline_up->SetPrompt(m_prompt.empty() ? nullptr : m_prompt.c_str()); #endif @@ -460,7 +460,7 @@ void IOHandlerEditline::SetContinuationPrompt(llvm::StringRef prompt) { m_continuation_prompt = prompt; -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT if (m_editline_up) m_editline_up->SetContinuationPrompt(m_continuation_prompt.empty() ? nullptr @@ -473,7 +473,7 @@ } uint32_t IOHandlerEditline::GetCurrentLineIndex() const { -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT if (m_editline_up) return m_editline_up->GetCurrentLine(); #endif @@ -484,7 +484,7 @@ m_current_lines_ptr = &lines; bool success = false; -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT if (m_editline_up) { return m_editline_up->GetLines(m_base_line_number, lines, interrupted); } else { @@ -514,7 +514,7 @@ } } success = lines.GetSize() > 0; -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT } #endif return success; @@ -554,7 +554,7 @@ } void IOHandlerEditline::Cancel() { -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT if (m_editline_up) m_editline_up->Cancel(); #endif @@ -565,7 +565,7 @@ if (m_delegate.IOHandlerInterrupt(*this)) return true; -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT if (m_editline_up) return m_editline_up->Interrupt(); #endif @@ -573,14 +573,14 @@ } void IOHandlerEditline::GotEOF() { -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT if (m_editline_up) m_editline_up->Interrupt(); #endif } void IOHandlerEditline::PrintAsync(Stream *stream, const char *s, size_t len) { -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT if (m_editline_up) m_editline_up->PrintAsync(stream, s, len); else diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt --- a/lldb/source/Host/CMakeLists.txt +++ b/lldb/source/Host/CMakeLists.txt @@ -52,7 +52,7 @@ common/XML.cpp ) -if (NOT LLDB_DISABLE_LIBEDIT) +if (LLDB_ENABLE_LIBEDIT) add_host_subdirectory(common common/Editline.cpp ) @@ -155,14 +155,14 @@ if (HAVE_LIBDL) list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS}) endif() -if (NOT LLDB_DISABLE_LIBEDIT) +if (LLDB_ENABLE_LIBEDIT) list(APPEND EXTRA_LIBS ${libedit_LIBRARIES}) endif() if (LLDB_ENABLE_LZMA) list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES}) endif() -if (NOT LLDB_DISABLE_LIBEDIT) +if (LLDB_ENABLE_LIBEDIT) list(APPEND LLDB_LIBEDIT_LIBS ${libedit_LIBRARIES}) if (LLVM_BUILD_STATIC) list(APPEND LLDB_SYSTEM_LIBS gpm) @@ -183,6 +183,6 @@ Support ) -if (NOT LLDB_DISABLE_LIBEDIT) +if (LLDB_ENABLE_LIBEDIT) target_include_directories(lldbHost PUBLIC ${libedit_INCLUDE_DIRS}) endif() diff --git a/lldb/source/Interpreter/CMakeLists.txt b/lldb/source/Interpreter/CMakeLists.txt --- a/lldb/source/Interpreter/CMakeLists.txt +++ b/lldb/source/Interpreter/CMakeLists.txt @@ -69,6 +69,6 @@ LLDBInterpreterPropertiesGen LLDBInterpreterPropertiesEnumGen) -if (NOT LLDB_DISABLE_LIBEDIT) +if (LLDB_ENABLE_LIBEDIT) target_include_directories(lldbInterpreter PRIVATE ${libedit_INCLUDE_DIRS}) endif() diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -49,7 +49,7 @@ #include "lldb/Utility/Timer.h" #include "lldb/Host/Config.h" -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT #include "lldb/Host/Editline.h" #endif #include "lldb/Host/Host.h" diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt --- a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt +++ b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt @@ -3,7 +3,7 @@ endif() add_definitions(-DLLDB_PYTHON_RELATIVE_LIBDIR="${LLDB_PYTHON_RELATIVE_PATH}") -if (NOT LLDB_DISABLE_LIBEDIT) +if (LLDB_ENABLE_LIBEDIT) list(APPEND LLDB_LIBEDIT_LIBS ${libedit_LIBRARIES}) endif() @@ -26,7 +26,7 @@ Support ) -if (NOT LLDB_DISABLE_LIBEDIT) +if (LLDB_ENABLE_LIBEDIT) target_include_directories(lldbPluginScriptInterpreterPython PUBLIC ${libedit_INCLUDE_DIRS} ) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h @@ -9,7 +9,7 @@ #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONREADLINE_H -#if !defined(LLDB_DISABLE_LIBEDIT) && defined(__linux__) +#if LLDB_ENABLE_LIBEDIT && defined(__linux__) // NOTE: Since Python may define some pre-processor definitions which affect the // standard headers on some systems, you must include Python.h before any // standard headers are included. diff --git a/lldb/unittests/Editline/EditlineTest.cpp b/lldb/unittests/Editline/EditlineTest.cpp --- a/lldb/unittests/Editline/EditlineTest.cpp +++ b/lldb/unittests/Editline/EditlineTest.cpp @@ -8,7 +8,7 @@ #include "lldb/Host/Config.h" -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT #define EDITLINE_TEST_DUMP_OUTPUT 0