[Lldb-commits] [lldb] 4e26cf2 - [lldb/CMake] Rename LLDB_DISABLE_PYTHON to LLDB_ENABLE_PYTHON
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Dec 13 13:44:26 PST 2019
Author: Jonas Devlieghere
Date: 2019-12-13T13:41:11-08:00
New Revision: 4e26cf2cfb2b140a33ec236153cb2f23b5c44127
URL: https://github.com/llvm/llvm-project/commit/4e26cf2cfb2b140a33ec236153cb2f23b5c44127
DIFF: https://github.com/llvm/llvm-project/commit/4e26cf2cfb2b140a33ec236153cb2f23b5c44127.diff
LOG: [lldb/CMake] Rename LLDB_DISABLE_PYTHON to LLDB_ENABLE_PYTHON
This matches the naming scheme used by LLVM and all the other optional
dependencies in LLDB.
Differential revision: https://reviews.llvm.org/D71482
Added:
Modified:
lldb/CMakeLists.txt
lldb/cmake/modules/LLDBConfig.cmake
lldb/docs/CMakeLists.txt
lldb/docs/resources/build.rst
lldb/include/lldb/Host/Config.h.cmake
lldb/packages/Python/lldbsuite/test/dotest.py
lldb/source/API/CMakeLists.txt
lldb/source/API/SBHostOS.cpp
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Commands/CommandObjectFrame.cpp
lldb/source/Commands/CommandObjectType.cpp
lldb/source/Core/ValueObject.cpp
lldb/source/Interpreter/CommandObjectScript.cpp
lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
lldb/source/Plugins/ScriptInterpreter/CMakeLists.txt
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h
lldb/test/API/lit.site.cfg.py.in
lldb/test/API/lldbtest.py
lldb/test/CMakeLists.txt
lldb/test/Shell/lit.cfg.py
lldb/test/Shell/lit.site.cfg.py.in
lldb/tools/intel-features/CMakeLists.txt
lldb/unittests/ScriptInterpreter/CMakeLists.txt
Removed:
################################################################################
diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index e66fa49a5114..3747c9896525 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -40,7 +40,7 @@ if (WIN32)
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 @@ if(LLDB_INCLUDE_TESTS)
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
index d2ae1ba20140..da006039b268 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -24,16 +24,19 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darw
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 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
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 @@ function(find_python_libs_windows_helper LOOKUP_DEBUG OUT_EXE_PATH_VARNAME OUT_L
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 @@ endfunction()
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 @@ function(find_python_libs_windows)
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 @@ function(find_python_libs_windows)
# 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 @@ function(find_python_libs_windows)
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 @@ endfunction(find_python_libs_windows)
# 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 @@ if (NOT LLDB_DISABLE_PYTHON)
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
index 1da68741b539..0082d004bd0d 100644
--- a/lldb/docs/CMakeLists.txt
+++ b/lldb/docs/CMakeLists.txt
@@ -15,7 +15,7 @@ if(DOXYGEN_FOUND)
)
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
index 4d9850c485b3..499a79b88ef6 100644
--- a/lldb/docs/resources/build.rst
+++ b/lldb/docs/resources/build.rst
@@ -401,7 +401,7 @@ further by passing the appropriate cmake options, such as:
::
- -DLLDB_DISABLE_PYTHON=1
+ -DLLDB_ENABLE_PYTHON=0
-DLLDB_ENABLE_LIBEDIT=0
-DLLDB_ENABLE_CURSES=0
-DLLVM_ENABLE_TERMINFO=0
@@ -453,7 +453,7 @@ to prepare the cmake build with the following parameters:
-DLLVM_HOST_TRIPLE=aarch64-unknown-linux-gnu \
-DLLVM_TABLEGEN=<path-to-host>/bin/llvm-tblgen \
-DCLANG_TABLEGEN=<path-to-host>/bin/clang-tblgen \
- -DLLDB_DISABLE_PYTHON=1 \
+ -DLLDB_ENABLE_PYTHON=0 \
-DLLDB_ENABLE_LIBEDIT=0 \
-DLLDB_ENABLE_CURSES=0
@@ -471,7 +471,7 @@ options. In my case it was sufficient to add the following arguments to
-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
index fa95631d1979..8012d790954e 100644
--- 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
index 1e3df7373f00..3d67b45c1d9d 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -617,7 +617,7 @@ def setupSysPath():
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
index 934bbf2ec1b0..1a99a26dfc4f 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -4,7 +4,7 @@ endif()
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 @@ endif()
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
index 2a1d17a2413a..6ac8717237e7 100644
--- 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 @@ SBFileSpec SBHostOS::GetLLDBPath(lldb::PathType path_type) {
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
index ffb302d7f41c..35a02ec29515 100644
--- 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 @@ llvm::Error SystemInitializerFull::Initialize() {
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 @@ void SystemInitializerFull::Terminate() {
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
index d743900e67b8..5669ce174d5e 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -852,7 +852,7 @@ Process 1234 stopped
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 @@ CommandObjectMultiwordFrame::CommandObjectMultiwordFrame(
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
index 265acb4ad8ae..aca166ed1651 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -163,7 +163,7 @@ class CommandObjectTypeSummaryAdd : public CommandObjectParsed,
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 @@ class CommandObjectTypeSummaryAdd : public CommandObjectParsed,
"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 @@ class CommandObjectTypeSynthAdd : public CommandObjectParsed,
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 @@ class CommandObjectTypeSynthAdd : public CommandObjectParsed,
error_sp->Flush();
}
-#endif // LLDB_DISABLE_PYTHON
+#endif
io_handler.SetIsDone(true);
}
@@ -1168,12 +1168,6 @@ class CommandObjectTypeFormatList
"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 @@ void CommandObjectTypeSummaryAdd::CommandOptions::OptionParsingStarting(
m_category = "default";
}
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary(
Args &command, CommandReturnObject &result) {
@@ -1381,7 +1375,7 @@ bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary(
return result.Succeeded();
}
-#endif // LLDB_DISABLE_PYTHON
+#endif
bool CommandObjectTypeSummaryAdd::Execute_StringSummary(
Args &command, CommandReturnObject &result) {
@@ -1579,13 +1573,13 @@ bool CommandObjectTypeSummaryAdd::DoExecute(Args &command,
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 @@ class CommandObjectTypeFilterList
"Show a list of current filters.") {}
};
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
// CommandObjectTypeSynthList
@@ -2166,7 +2160,7 @@ class CommandObjectTypeSynthList
"Show a list of current synthetic providers.") {}
};
-#endif // LLDB_DISABLE_PYTHON
+#endif
// CommandObjectTypeFilterDelete
@@ -2181,7 +2175,7 @@ class CommandObjectTypeFilterDelete : public CommandObjectTypeFormatterDelete {
~CommandObjectTypeFilterDelete() override = default;
};
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
// CommandObjectTypeSynthDelete
@@ -2197,7 +2191,7 @@ class CommandObjectTypeSynthDelete : public CommandObjectTypeFormatterDelete {
~CommandObjectTypeSynthDelete() override = default;
};
-#endif // LLDB_DISABLE_PYTHON
+#endif
// CommandObjectTypeFilterClear
@@ -2210,7 +2204,7 @@ class CommandObjectTypeFilterClear : public CommandObjectTypeFormatterClear {
"type filter clear", "Delete all existing filter.") {}
};
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
// CommandObjectTypeSynthClear
class CommandObjectTypeSynthClear : public CommandObjectTypeFormatterClear {
@@ -2374,7 +2368,7 @@ bool CommandObjectTypeSynthAdd::AddSynth(ConstString type_name,
}
}
-#endif // LLDB_DISABLE_PYTHON
+#endif
#define LLDB_OPTIONS_type_filter_add
#include "CommandOptions.inc"
@@ -2924,7 +2918,7 @@ class CommandObjectTypeFormat : public CommandObjectMultiword {
~CommandObjectTypeFormat() override = default;
};
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
class CommandObjectTypeSynth : public CommandObjectMultiword {
public:
@@ -2953,7 +2947,7 @@ class CommandObjectTypeSynth : public CommandObjectMultiword {
~CommandObjectTypeSynth() override = default;
};
-#endif // LLDB_DISABLE_PYTHON
+#endif
class CommandObjectTypeFilter : public CommandObjectMultiword {
public:
@@ -3039,10 +3033,10 @@ CommandObjectType::CommandObjectType(CommandInterpreter &interpreter)
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
index 596de20364a0..1dd9a6cf62c3 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -303,7 +303,7 @@ bool ValueObject::UpdateFormatsIfNeeded() {
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
index d9ee30ca8ab9..fe365a5496f8 100644
--- a/lldb/source/Interpreter/CommandObjectScript.cpp
+++ b/lldb/source/Interpreter/CommandObjectScript.cpp
@@ -32,13 +32,7 @@ CommandObjectScript::~CommandObjectScript() {}
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 @@ bool CommandObjectScript::DoExecute(llvm::StringRef command,
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.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index 3ed48e11d018..106457c0153d 100644
--- 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 @@ lldb::ThreadSP OperatingSystemPython::CreateThread(lldb::tid_t tid,
return ThreadSP();
}
-#endif // #ifndef LLDB_DISABLE_PYTHON
+#endif // #if LLDB_ENABLE_PYTHON
diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.h
index e38f0f8aedf5..4a594cf29a08 100644
--- 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 @@ class OperatingSystemPython : public lldb_private::OperatingSystem {
lldb_private::StructuredData::ObjectSP m_python_object_sp;
};
-#endif // LLDB_DISABLE_PYTHON
+#endif
#endif // liblldb_OperatingSystemPython_h_
diff --git a/lldb/source/Plugins/ScriptInterpreter/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/CMakeLists.txt
index 5d8642eb07e6..416f68005139 100644
--- 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.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index 7880c3a93df5..e5a67653e334 100644
--- 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/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
index ea33d44c324f..b75045b239a8 100644
--- 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/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 5c668bf72f3b..282c6e391f08 100644
--- 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::AddToSysPath(AddLocation location,
//
// void ScriptInterpreterPythonImpl::Terminate() { Py_Finalize (); }
-#endif // LLDB_DISABLE_PYTHON
+#endif
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
index 88f6975dd187..e59fedbd0971 100644
--- 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 @@ class ScriptInterpreterPython : public ScriptInterpreter,
};
} // 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/ScriptInterpreterPythonImpl.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
index 281cfb174f99..81c6eb0aa6c2 100644
--- 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
index b2cd7a658f3a..48f27b09b95c 100644
--- 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 <Python.h>
-#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
index b5e8ed9df8d2..374ca929aeb6 100644
--- a/lldb/test/API/lit.site.cfg.py.in
+++ b/lldb/test/API/lit.site.cfg.py.in
@@ -20,7 +20,7 @@ config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
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
index e7ba5eb3b04d..349a67f22fb3 100644
--- a/lldb/test/API/lldbtest.py
+++ b/lldb/test/API/lldbtest.py
@@ -55,7 +55,7 @@ def execute(self, test, litConfig):
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
index e5704f662f7a..d2fda3c45b31 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -143,7 +143,7 @@ endif()
# 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
index 68891e600169..c0a60914551d 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -100,7 +100,7 @@ def calculate_arch_features(arch_string):
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
index 39990a408b05..b391f8ba31e6 100644
--- a/lldb/test/Shell/lit.site.cfg.py.in
+++ b/lldb/test/Shell/lit.site.cfg.py.in
@@ -18,7 +18,7 @@ config.have_zlib = @LLVM_ENABLE_ZLIB@
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
index b5316540fdf3..aff75d7db334 100644
--- a/lldb/tools/intel-features/CMakeLists.txt
+++ b/lldb/tools/intel-features/CMakeLists.txt
@@ -23,7 +23,7 @@ if (LLDB_BUILD_INTEL_PT)
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_lldb_library(lldbIntelFeatures SHARED
)
# 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
index 667e7a7da323..06d909b862a0 100644
--- 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()
More information about the lldb-commits
mailing list