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, ''))"
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)
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()
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)
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()
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()
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()
# 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()
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()
# 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)
endif()
endif()
-if (LLDB_DISABLE_PYTHON)
+if (NOT LLDB_ENABLE_PYTHON)
unset(PYTHON_INCLUDE_DIR)
unset(PYTHON_LIBRARY)
unset(PYTHON_EXECUTABLE)
)
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}")
::
- -DLLDB_DISABLE_PYTHON=1
+ -DLLDB_ENABLE_PYTHON=0
-DLLDB_ENABLE_LIBEDIT=0
-DLLDB_ENABLE_CURSES=0
-DLLVM_ENABLE_TERMINFO=0
-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
-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
#cmakedefine01 LLDB_ENABLE_LIBXML2
-#cmakedefine LLDB_DISABLE_PYTHON
+#cmakedefine01 LLDB_ENABLE_PYTHON
#cmakedefine LLDB_PYTHON_HOME "${LLDB_PYTHON_HOME}"
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(
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()
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()
#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
fspec = HostInfo::GetHeaderDir();
break;
case ePathTypePythonDir:
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
fspec = ScriptInterpreterPython::GetPythonDir();
#endif
break;
#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
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
DynamicLoaderStatic::Terminate();
DynamicLoaderWindowsDYLD::Terminate();
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
OperatingSystemPython::Terminate();
#endif
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());
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
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;
"error: script interpreter missing, didn't add python command.\n");
error_sp->Flush();
}
-#endif // LLDB_DISABLE_PYTHON
+#endif
io_handler.SetIsDone(true);
}
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;
error_sp->Flush();
}
-#endif // LLDB_DISABLE_PYTHON
+#endif
io_handler.SetIsDone(true);
}
"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) {
m_category = "default";
}
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary(
Args &command, CommandReturnObject &result) {
return result.Succeeded();
}
-#endif // LLDB_DISABLE_PYTHON
+#endif
bool CommandObjectTypeSummaryAdd::Execute_StringSummary(
Args &command, CommandReturnObject &result) {
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);
"Show a list of current filters.") {}
};
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
// CommandObjectTypeSynthList
"Show a list of current synthetic providers.") {}
};
-#endif // LLDB_DISABLE_PYTHON
+#endif
// CommandObjectTypeFilterDelete
~CommandObjectTypeFilterDelete() override = default;
};
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
// CommandObjectTypeSynthDelete
~CommandObjectTypeSynthDelete() override = default;
};
-#endif // LLDB_DISABLE_PYTHON
+#endif
// CommandObjectTypeFilterClear
"type filter clear", "Delete all existing filter.") {}
};
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
// CommandObjectTypeSynthClear
class CommandObjectTypeSynthClear : public CommandObjectTypeFormatterClear {
}
}
-#endif // LLDB_DISABLE_PYTHON
+#endif
#define LLDB_OPTIONS_type_filter_add
#include "CommandOptions.inc"
~CommandObjectTypeFormat() override = default;
};
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
class CommandObjectTypeSynth : public CommandObjectMultiword {
public:
~CommandObjectTypeSynth() override = default;
};
-#endif // LLDB_DISABLE_PYTHON
+#endif
class CommandObjectTypeFilter : public CommandObjectMultiword {
public:
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)));
}
SetValueFormat(DataVisualization::GetFormat(*this, eNoDynamicValues));
SetSummaryFormat(
DataVisualization::GetSummaryFormat(*this, GetDynamicValueType()));
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
SetSyntheticChildren(
DataVisualization::GetSyntheticChildren(*this, GetDynamicValueType()));
#endif
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(
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
}
#include "lldb/Host/Config.h"
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
#include "OperatingSystemPython.h"
return ThreadSP();
}
-#endif // #ifndef LLDB_DISABLE_PYTHON
+#endif // #if LLDB_ENABLE_PYTHON
#include "lldb/Host/Config.h"
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
#include "lldb/Target/OperatingSystem.h"
#include "lldb/Utility/StructuredData.h"
lldb_private::StructuredData::ObjectSP m_python_object_sp;
};
-#endif // LLDB_DISABLE_PYTHON
+#endif
#endif // liblldb_OperatingSystemPython_h_
add_subdirectory(None)
-if (NOT LLDB_DISABLE_PYTHON)
+if (LLDB_ENABLE_PYTHON)
add_subdirectory(Python)
endif()
#include "lldb/Host/Config.h"
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
#include "PythonDataObjects.h"
#include "ScriptInterpreterPython.h"
#include "lldb/Host/Config.h"
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
// LLDB Python header must be included first
#include "lldb-python.h"
#include "lldb/Host/Config.h"
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
// LLDB Python header must be included first
#include "lldb-python.h"
//
// void ScriptInterpreterPythonImpl::Terminate() { Py_Finalize (); }
-#endif // LLDB_DISABLE_PYTHON
+#endif
#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"
};
} // namespace lldb_private
-#endif // LLDB_DISABLE_PYTHON
+#endif // LLDB_ENABLE_PYTHON
#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
#include "lldb/Host/Config.h"
-#ifndef LLDB_DISABLE_PYTHON
+#if LLDB_ENABLE_PYTHON
#include "lldb-python.h"
// 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
// Include python for non windows machines
#include <Python.h>
-#endif // LLDB_DISABLE_PYTHON
+#endif
#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
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")
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:
# 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)
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:
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")
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}
)
# 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()
-if (NOT LLDB_DISABLE_PYTHON)
+if (LLDB_ENABLE_PYTHON)
add_subdirectory(Python)
endif()