diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -40,7 +40,7 @@ add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE) endif() -if (NOT LLDB_DISABLE_PYTHON) +if (LLDB_ENABLE_PYTHON) execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(True, False, ''))" @@ -91,7 +91,7 @@ add_subdirectory(utils/lldb-dotest) endif() -if (NOT LLDB_DISABLE_PYTHON) +if (LLDB_ENABLE_PYTHON) get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR) if(LLDB_BUILD_FRAMEWORK) 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 @@ -24,16 +24,19 @@ set(LLDB_LINKER_SUPPORTS_GROUPS ON) endif() -set(default_disable_python OFF) +set(default_enable_python ON) set(default_enable_libedit ON) set(default_enable_curses ON) -# Temporary support the old LLDB_DISABLE_CURSES variable +# Temporary support the old LLDB_DISABLE_* variables if (DEFINED LLDB_DISABLE_CURSES) if (LLDB_DISABLE_CURSES) set(default_enable_curses OFF) - else() - set(default_enable_curses ON) + endif() +endif() +if (DEFINED LLDB_DISABLE_PYTHON) + if (LLDB_DISABLE_PYTHON) + set(default_enable_python OFF) endif() endif() @@ -45,14 +48,14 @@ set(default_enable_libedit OFF) set(default_enable_curses OFF) elseif(CMAKE_SYSTEM_NAME MATCHES "Android") - set(default_disable_python ON) + set(default_enable_python OFF) set(default_enable_libedit OFF) set(default_enable_curses OFF) elseif(IOS) - set(default_disable_python ON) + set(default_enable_python OFF) endif() -option(LLDB_DISABLE_PYTHON "Disable Python scripting integration." ${default_disable_python}) +option(LLDB_ENABLE_PYTHON "Enable Python scripting integration." ${default_enable_python}) option(LLDB_ENABLE_LIBEDIT "Enable the use of editline." ${default_enable_libedit}) option(LLDB_ENABLE_CURSES "Enable Curses integration." ${default_enable_curses}) option(LLDB_RELOCATABLE_PYTHON "Use the PYTHONHOME environment variable to locate Python." OFF) @@ -172,7 +175,7 @@ if (NOT PYTHON_EXE OR NOT PYTHON_LIB OR NOT PYTHON_DLL) message(WARNING "Unable to find all Python components. Python support will be disabled for this build.") - set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE) + set(LLDB_ENABLE_PYTHON 0 PARENT_SCOPE) return() endif() @@ -197,7 +200,7 @@ function(find_python_libs_windows) if ("${PYTHON_HOME}" STREQUAL "") message(WARNING "LLDB embedded Python on Windows requires specifying a value for PYTHON_HOME. Python support disabled.") - set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE) + set(LLDB_ENABLE_PYTHON 0 PARENT_SCOPE) return() endif() @@ -214,7 +217,7 @@ else() message(WARNING "Unable to find ${PYTHON_INCLUDE_DIR}/patchlevel.h, Python installation is corrupt.") message(WARNING "Python support will be disabled for this build.") - set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE) + set(LLDB_ENABLE_PYTHON 0 PARENT_SCOPE) return() endif() @@ -226,8 +229,8 @@ # Lookup for both debug and release python installations find_python_libs_windows_helper(TRUE PYTHON_DEBUG_EXE PYTHON_DEBUG_LIB PYTHON_DEBUG_DLL PYTHON_DEBUG_VERSION_STRING) find_python_libs_windows_helper(FALSE PYTHON_RELEASE_EXE PYTHON_RELEASE_LIB PYTHON_RELEASE_DLL PYTHON_RELEASE_VERSION_STRING) - if(LLDB_DISABLE_PYTHON) - set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE) + if(NOT LLDB_ENABLE_PYTHON) + set(LLDB_ENABLE_PYTHON 0 PARENT_SCOPE) return() endif() @@ -250,8 +253,8 @@ set(LOOKUP_DEBUG_PYTHON FALSE) endif() find_python_libs_windows_helper(${LOOKUP_DEBUG_PYTHON} PYTHON_EXECUTABLE PYTHON_LIBRARY PYTHON_DLL PYTHON_VERSION_STRING) - if(LLDB_DISABLE_PYTHON) - set(LLDB_DISABLE_PYTHON 1 PARENT_SCOPE) + if(NOT LLDB_ENABLE_PYTHON) + set(LLDB_ENABLE_PYTHON 0 PARENT_SCOPE) return() endif() endif() @@ -286,12 +289,12 @@ # Call find_python_libs_windows ahead of the rest of the python configuration. # It's possible that it won't find a python installation and will then set -# LLDB_DISABLE_PYTHON to ON. -if (NOT LLDB_DISABLE_PYTHON AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") +# LLDB_ENABLE_PYTHON to OFF. +if (LLDB_ENABLE_PYTHON AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") find_python_libs_windows() endif() -if (NOT LLDB_DISABLE_PYTHON) +if (LLDB_ENABLE_PYTHON) if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") if (NOT LLDB_RELOCATABLE_PYTHON) file(TO_CMAKE_PATH "${PYTHON_HOME}" LLDB_PYTHON_HOME) @@ -320,7 +323,7 @@ endif() endif() -if (LLDB_DISABLE_PYTHON) +if (NOT LLDB_ENABLE_PYTHON) unset(PYTHON_INCLUDE_DIR) unset(PYTHON_LIBRARY) unset(PYTHON_EXECUTABLE) diff --git a/lldb/docs/CMakeLists.txt b/lldb/docs/CMakeLists.txt --- a/lldb/docs/CMakeLists.txt +++ b/lldb/docs/CMakeLists.txt @@ -15,7 +15,7 @@ ) endif() -if (NOT LLDB_DISABLE_PYTHON) +if (LLDB_ENABLE_PYTHON) find_program(EPYDOC_EXECUTABLE NAMES epydoc epydoc.py) if(EPYDOC_EXECUTABLE) message(STATUS "Found epydoc - ${EPYDOC_EXECUTABLE}") 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,7 +401,7 @@ :: - -DLLDB_DISABLE_PYTHON=1 + -DLLDB_ENABLE_PYTHON=0 -DLLDB_ENABLE_LIBEDIT=0 -DLLDB_ENABLE_CURSES=0 -DLLVM_ENABLE_TERMINFO=0 @@ -453,7 +453,7 @@ -DLLVM_HOST_TRIPLE=aarch64-unknown-linux-gnu \ -DLLVM_TABLEGEN=/bin/llvm-tblgen \ -DCLANG_TABLEGEN=/bin/clang-tblgen \ - -DLLDB_DISABLE_PYTHON=1 \ + -DLLDB_ENABLE_PYTHON=0 \ -DLLDB_ENABLE_LIBEDIT=0 \ -DLLDB_ENABLE_CURSES=0 @@ -471,7 +471,7 @@ -I /usr/aarch64-linux-gnu/include If you wanted to build a full version of LLDB and avoid passing -``-DLLDB_DISABLE_PYTHON`` and other options, you would need to obtain the +``-DLLDB_ENABLE_PYTHON=0`` and other options, you would need to obtain the target versions of the respective libraries. The easiest way to achieve this is to use the qemu-debootstrap utility, which can prepare a system image using qemu and chroot to simulate the target environment. Then you can install the 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 @@ -42,7 +42,7 @@ #cmakedefine01 LLDB_ENABLE_LIBXML2 -#cmakedefine LLDB_DISABLE_PYTHON +#cmakedefine01 LLDB_ENABLE_PYTHON #cmakedefine LLDB_PYTHON_HOME "${LLDB_PYTHON_HOME}" diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -617,7 +617,7 @@ if not lldbPythonDir: print( "Unable to load lldb extension module. Possible reasons for this include:") - print(" 1) LLDB was built with LLDB_DISABLE_PYTHON=1") + print(" 1) LLDB was built with LLDB_ENABLE_PYTHON=0") print( " 2) PYTHONPATH and PYTHONHOME are not set correctly. PYTHONHOME should refer to") print( diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt --- a/lldb/source/API/CMakeLists.txt +++ b/lldb/source/API/CMakeLists.txt @@ -4,7 +4,7 @@ get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS) -if(NOT LLDB_DISABLE_PYTHON) +if(LLDB_ENABLE_PYTHON) get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR) set(lldb_python_wrapper ${lldb_scripts_dir}/LLDBWrapPython.cpp) endif() @@ -154,7 +154,7 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) # Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs, # so only it needs to explicitly link against ${PYTHON_LIBRARY} - if (MSVC AND NOT LLDB_DISABLE_PYTHON) + if (MSVC AND LLDB_ENABLE_PYTHON) target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY}) endif() else() diff --git a/lldb/source/API/SBHostOS.cpp b/lldb/source/API/SBHostOS.cpp --- a/lldb/source/API/SBHostOS.cpp +++ b/lldb/source/API/SBHostOS.cpp @@ -19,7 +19,7 @@ #include "lldb/Utility/FileSpec.h" #include "Plugins/ExpressionParser/Clang/ClangHost.h" -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON #include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h" #endif @@ -61,7 +61,7 @@ fspec = HostInfo::GetHeaderDir(); break; case ePathTypePythonDir: -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON fspec = ScriptInterpreterPython::GetPythonDir(); #endif break; diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp --- a/lldb/source/API/SystemInitializerFull.cpp +++ b/lldb/source/API/SystemInitializerFull.cpp @@ -10,7 +10,7 @@ #include "lldb/API/SBCommandInterpreter.h" #include "lldb/Host/Config.h" -#if !defined(LLDB_DISABLE_PYTHON) +#if LLDB_ENABLE_PYTHON #include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h" #endif @@ -179,11 +179,11 @@ ScriptInterpreterNone::Initialize(); -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON OperatingSystemPython::Initialize(); #endif -#if !defined(LLDB_DISABLE_PYTHON) +#if LLDB_ENABLE_PYTHON ScriptInterpreterPython::Initialize(); #endif @@ -375,7 +375,7 @@ DynamicLoaderStatic::Terminate(); DynamicLoaderWindowsDYLD::Terminate(); -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON OperatingSystemPython::Terminate(); #endif diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -852,7 +852,7 @@ bool CommandObjectFrameRecognizerAdd::DoExecute(Args &command, CommandReturnObject &result) { -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON if (m_options.m_class_name.empty()) { result.AppendErrorWithFormat( "%s needs a Python class name (-l argument).\n", m_cmd_name.c_str()); @@ -1106,7 +1106,7 @@ CommandObjectSP(new CommandObjectFrameSelect(interpreter))); LoadSubCommand("variable", CommandObjectSP(new CommandObjectFrameVariable(interpreter))); -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON LoadSubCommand("recognizer", CommandObjectSP(new CommandObjectFrameRecognizer( interpreter))); #endif diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -163,7 +163,7 @@ std::string &data) override { StreamFileSP error_sp = io_handler.GetErrorStreamFileSP(); -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter(); if (interpreter) { StringList lines; @@ -256,7 +256,7 @@ "error: script interpreter missing, didn't add python command.\n"); error_sp->Flush(); } -#endif // LLDB_DISABLE_PYTHON +#endif io_handler.SetIsDone(true); } @@ -395,7 +395,7 @@ std::string &data) override { StreamFileSP error_sp = io_handler.GetErrorStreamFileSP(); -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter(); if (interpreter) { StringList lines; @@ -475,7 +475,7 @@ error_sp->Flush(); } -#endif // LLDB_DISABLE_PYTHON +#endif io_handler.SetIsDone(true); } @@ -1168,12 +1168,6 @@ "Show a list of current formats.") {} }; -#ifndef LLDB_DISABLE_PYTHON - -// CommandObjectTypeSummaryAdd - -#endif // LLDB_DISABLE_PYTHON - Status CommandObjectTypeSummaryAdd::CommandOptions::SetOptionValue( uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { @@ -1256,7 +1250,7 @@ m_category = "default"; } -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary( Args &command, CommandReturnObject &result) { @@ -1381,7 +1375,7 @@ return result.Succeeded(); } -#endif // LLDB_DISABLE_PYTHON +#endif bool CommandObjectTypeSummaryAdd::Execute_StringSummary( Args &command, CommandReturnObject &result) { @@ -1579,13 +1573,13 @@ WarnOnPotentialUnquotedUnsignedType(command, result); if (m_options.m_is_add_script) { -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON return Execute_ScriptSummary(command, result); #else result.AppendError("python is disabled"); result.SetStatus(eReturnStatusFailed); return false; -#endif // LLDB_DISABLE_PYTHON +#endif } return Execute_StringSummary(command, result); @@ -2153,7 +2147,7 @@ "Show a list of current filters.") {} }; -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON // CommandObjectTypeSynthList @@ -2166,7 +2160,7 @@ "Show a list of current synthetic providers.") {} }; -#endif // LLDB_DISABLE_PYTHON +#endif // CommandObjectTypeFilterDelete @@ -2181,7 +2175,7 @@ ~CommandObjectTypeFilterDelete() override = default; }; -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON // CommandObjectTypeSynthDelete @@ -2197,7 +2191,7 @@ ~CommandObjectTypeSynthDelete() override = default; }; -#endif // LLDB_DISABLE_PYTHON +#endif // CommandObjectTypeFilterClear @@ -2210,7 +2204,7 @@ "type filter clear", "Delete all existing filter.") {} }; -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON // CommandObjectTypeSynthClear class CommandObjectTypeSynthClear : public CommandObjectTypeFormatterClear { @@ -2374,7 +2368,7 @@ } } -#endif // LLDB_DISABLE_PYTHON +#endif #define LLDB_OPTIONS_type_filter_add #include "CommandOptions.inc" @@ -2924,7 +2918,7 @@ ~CommandObjectTypeFormat() override = default; }; -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON class CommandObjectTypeSynth : public CommandObjectMultiword { public: @@ -2953,7 +2947,7 @@ ~CommandObjectTypeSynth() override = default; }; -#endif // LLDB_DISABLE_PYTHON +#endif class CommandObjectTypeFilter : public CommandObjectMultiword { public: @@ -3039,10 +3033,10 @@ CommandObjectSP(new CommandObjectTypeFormat(interpreter))); LoadSubCommand("summary", CommandObjectSP(new CommandObjectTypeSummary(interpreter))); -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON LoadSubCommand("synthetic", CommandObjectSP(new CommandObjectTypeSynth(interpreter))); -#endif // LLDB_DISABLE_PYTHON +#endif LoadSubCommand("lookup", CommandObjectSP(new CommandObjectTypeLookup(interpreter))); } diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -303,7 +303,7 @@ SetValueFormat(DataVisualization::GetFormat(*this, eNoDynamicValues)); SetSummaryFormat( DataVisualization::GetSummaryFormat(*this, GetDynamicValueType())); -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON SetSyntheticChildren( DataVisualization::GetSyntheticChildren(*this, GetDynamicValueType())); #endif diff --git a/lldb/source/Interpreter/CommandObjectScript.cpp b/lldb/source/Interpreter/CommandObjectScript.cpp --- a/lldb/source/Interpreter/CommandObjectScript.cpp +++ b/lldb/source/Interpreter/CommandObjectScript.cpp @@ -32,13 +32,7 @@ bool CommandObjectScript::DoExecute(llvm::StringRef command, CommandReturnObject &result) { -#ifdef LLDB_DISABLE_PYTHON - // if we ever support languages other than Python this simple #ifdef won't - // work - result.AppendError("your copy of LLDB does not support scripting."); - result.SetStatus(eReturnStatusFailed); - return false; -#else +#if LLDB_ENABLE_PYTHON if (m_interpreter.GetDebugger().GetScriptLanguage() == lldb::eScriptLanguageNone) { result.AppendError( @@ -72,5 +66,11 @@ result.SetStatus(eReturnStatusFailed); return result.Succeeded(); +#else + // if we ever support languages other than Python this simple #ifdef won't + // work + result.AppendError("your copy of LLDB does not support scripting."); + result.SetStatus(eReturnStatusFailed); + return false; #endif } diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h @@ -11,7 +11,7 @@ #include "lldb/Host/Config.h" -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON #include "lldb/Target/OperatingSystem.h" #include "lldb/Utility/StructuredData.h" @@ -82,6 +82,6 @@ lldb_private::StructuredData::ObjectSP m_python_object_sp; }; -#endif // LLDB_DISABLE_PYTHON +#endif #endif // liblldb_OperatingSystemPython_h_ diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -8,7 +8,7 @@ #include "lldb/Host/Config.h" -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON #include "OperatingSystemPython.h" @@ -418,4 +418,4 @@ return ThreadSP(); } -#endif // #ifndef LLDB_DISABLE_PYTHON +#endif // #if LLDB_ENABLE_PYTHON diff --git a/lldb/source/Plugins/ScriptInterpreter/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/CMakeLists.txt --- a/lldb/source/Plugins/ScriptInterpreter/CMakeLists.txt +++ b/lldb/source/Plugins/ScriptInterpreter/CMakeLists.txt @@ -1,4 +1,4 @@ add_subdirectory(None) -if (NOT LLDB_DISABLE_PYTHON) +if (LLDB_ENABLE_PYTHON) add_subdirectory(Python) endif() diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h @@ -50,7 +50,7 @@ #include "lldb/Host/Config.h" -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON // LLDB Python header must be included first #include "lldb-python.h" diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -8,7 +8,7 @@ #include "lldb/Host/Config.h" -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON #include "PythonDataObjects.h" #include "ScriptInterpreterPython.h" diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h @@ -11,11 +11,7 @@ #include "lldb/Host/Config.h" -#ifdef LLDB_DISABLE_PYTHON - -// Python is disabled in this build - -#else +#if LLDB_ENABLE_PYTHON #include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Core/IOHandler.h" @@ -62,5 +58,5 @@ }; } // namespace lldb_private -#endif // LLDB_DISABLE_PYTHON +#endif // LLDB_ENABLE_PYTHON #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -8,7 +8,7 @@ #include "lldb/Host/Config.h" -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON // LLDB Python header must be included first #include "lldb-python.h" @@ -3293,4 +3293,4 @@ // // void ScriptInterpreterPythonImpl::Terminate() { Py_Finalize (); } -#endif // LLDB_DISABLE_PYTHON +#endif diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h @@ -8,7 +8,7 @@ #include "lldb/Host/Config.h" -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON #include "lldb-python.h" diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h b/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h --- a/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h @@ -14,9 +14,7 @@ // Python.h needs to be included before any system headers in order to avoid // redefinition of macros -#ifdef LLDB_DISABLE_PYTHON -// Python is disabled in this build -#else +#if LLDB_ENABLE_PYTHON #include "llvm/Support/Compiler.h" #if defined(_WIN32) // If anyone #includes Host/PosixApi.h later, it will try to typedef pid_t. We @@ -42,6 +40,6 @@ // Include python for non windows machines #include -#endif // LLDB_DISABLE_PYTHON +#endif #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H diff --git a/lldb/test/API/lit.site.cfg.py.in b/lldb/test/API/lit.site.cfg.py.in --- a/lldb/test/API/lit.site.cfg.py.in +++ b/lldb/test/API/lit.site.cfg.py.in @@ -20,7 +20,7 @@ config.python_executable = "@PYTHON_EXECUTABLE@" config.dotest_path = "@LLDB_SOURCE_DIR@/test/API/dotest.py" config.dotest_args_str = "@LLDB_DOTEST_ARGS@" -config.lldb_disable_python = @LLDB_DISABLE_PYTHON@ +config.lldb_enable_python = @LLDB_ENABLE_PYTHON@ config.dotest_lit_args_str = None # The API tests use their own module caches. config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-api") diff --git a/lldb/test/API/lldbtest.py b/lldb/test/API/lldbtest.py --- a/lldb/test/API/lldbtest.py +++ b/lldb/test/API/lldbtest.py @@ -55,7 +55,7 @@ if litConfig.noExecute: return lit.Test.PASS, '' - if test.config.lldb_disable_python: + if not test.config.lldb_enable_python: return (lit.Test.UNSUPPORTED, 'Python module disabled') if test.config.unsupported: diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt --- a/lldb/test/CMakeLists.txt +++ b/lldb/test/CMakeLists.txt @@ -143,7 +143,7 @@ # These values are not canonicalized within LLVM. llvm_canonicalize_cmake_booleans( - LLDB_DISABLE_PYTHON + LLDB_ENABLE_PYTHON LLVM_ENABLE_ZLIB LLVM_ENABLE_SHARED_LIBS LLDB_IS_64_BITS) diff --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py --- a/lldb/test/Shell/lit.cfg.py +++ b/lldb/test/Shell/lit.cfg.py @@ -100,7 +100,7 @@ else: lit_config.warning("lit-cpuid failed: %s" % err) -if not config.lldb_disable_python: +if config.lldb_enable_python: config.available_features.add('python') if config.lldb_enable_lzma: diff --git a/lldb/test/Shell/lit.site.cfg.py.in b/lldb/test/Shell/lit.site.cfg.py.in --- a/lldb/test/Shell/lit.site.cfg.py.in +++ b/lldb/test/Shell/lit.site.cfg.py.in @@ -18,7 +18,7 @@ config.lldb_enable_lzma = @LLDB_ENABLE_LZMA@ config.host_triple = "@LLVM_HOST_TRIPLE@" config.lldb_bitness = 64 if @LLDB_IS_64_BITS@ else 32 -config.lldb_disable_python = @LLDB_DISABLE_PYTHON@ +config.lldb_enable_python = @LLDB_ENABLE_PYTHON@ config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@" # The shell tests use their own module caches. config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-shell") diff --git a/lldb/tools/intel-features/CMakeLists.txt b/lldb/tools/intel-features/CMakeLists.txt --- a/lldb/tools/intel-features/CMakeLists.txt +++ b/lldb/tools/intel-features/CMakeLists.txt @@ -23,7 +23,7 @@ endif() # Add python wrapper if python not disabled -if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT) +if (LLDB_ENABLE_PYTHON AND LLDB_BUILD_INTEL_PT) set(LLDB_INTEL_FEATURES_PYTHON_WRAP ${LLDB_BINARY_DIR}/tools/intel-features/scripts/IntelFeaturesPythonWrap.cpp) set_source_files_properties(${LLDB_INTEL_FEATURES_PYTHON_WRAP} @@ -59,7 +59,7 @@ ) # Add link dependencies for python wrapper -if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT) +if (LLDB_ENABLE_PYTHON AND LLDB_BUILD_INTEL_PT) add_dependencies(lldbIntelFeatures intel-features-swig_wrapper) endif() diff --git a/lldb/unittests/ScriptInterpreter/CMakeLists.txt b/lldb/unittests/ScriptInterpreter/CMakeLists.txt --- a/lldb/unittests/ScriptInterpreter/CMakeLists.txt +++ b/lldb/unittests/ScriptInterpreter/CMakeLists.txt @@ -1,3 +1,3 @@ -if (NOT LLDB_DISABLE_PYTHON) +if (LLDB_ENABLE_PYTHON) add_subdirectory(Python) endif()