diff options
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python')
8 files changed, 18 insertions, 70 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt index 039b5e6eef7..56eacc941d6 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt +++ b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt @@ -1,4 +1,4 @@ -if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" AND NOT LLDB_DISABLE_PYTHON) +if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows") # Call a python script to gather the arch-specific libdir for # modules like the lldb module. execute_process( diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp index f528dcf21be..671e8f9f23b 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -1,5 +1,4 @@ -//===-- PythonDataObjects.cpp ------------------------------------*- C++ -//-*-===// +//===-- PythonDataObjects.cpp -----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -8,12 +7,6 @@ // //===----------------------------------------------------------------------===// -#ifdef LLDB_DISABLE_PYTHON - -// Python is disabled in this build - -#else - #include "PythonDataObjects.h" #include "ScriptInterpreterPython.h" @@ -1035,5 +1028,3 @@ bool PythonFile::GetUnderlyingFile(File &file) const { file.SetOptions(PythonFile::GetOptionsFromMode(py_mode.GetString())); return file.IsValid(); } - -#endif diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h index beeb6478236..c818cbbd8b5 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h @@ -10,8 +10,6 @@ #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_H #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_H -#ifndef LLDB_DISABLE_PYTHON - // LLDB Python header must be included first #include "lldb-python.h" @@ -470,5 +468,3 @@ public: } // namespace lldb_private #endif - -#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_H diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp index d28a8033820..5a173164643 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#ifndef LLDB_DISABLE_PYTHON - // LLDB Python header must be included first #include "lldb-python.h" @@ -166,5 +164,3 @@ std::string PythonExceptionState::ReadBacktrace() const { return retval; } - -#endif diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.h b/lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.h index 20f4b4c6329..bcdf6e183ff 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.h @@ -10,8 +10,6 @@ #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONEXCEPTIONSTATE_H #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONEXCEPTIONSTATE_H -#ifndef LLDB_DISABLE_PYTHON - #include "PythonDataObjects.h" namespace lldb_private { @@ -53,5 +51,3 @@ private: } #endif - -#endif diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 9ae631717af..8729a7353e9 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -7,12 +7,6 @@ // //===----------------------------------------------------------------------===// -#ifdef LLDB_DISABLE_PYTHON - -// Python is disabled in this build - -#else - // LLDB Python header must be included first #include "lldb-python.h" @@ -3191,30 +3185,18 @@ void ScriptInterpreterPython::AddToSysPath(AddLocation location, PyRun_SimpleString(statement.c_str()); } -// void -// ScriptInterpreterPython::Terminate () -//{ -// // We are intentionally NOT calling Py_Finalize here (this would be the -// logical place to call it). Calling -// // Py_Finalize here causes test suite runs to seg fault: The test suite -// runs in Python. It registers -// // SBDebugger::Terminate to be called 'at_exit'. When the test suite -// Python harness finishes up, it calls -// // Py_Finalize, which calls all the 'at_exit' registered functions. -// SBDebugger::Terminate calls Debugger::Terminate, -// // which calls lldb::Terminate, which calls ScriptInterpreter::Terminate, -// which calls -// // ScriptInterpreterPython::Terminate. So if we call Py_Finalize here, we -// end up with Py_Finalize being called from -// // within Py_Finalize, which results in a seg fault. -// // -// // Since this function only gets called when lldb is shutting down and -// going away anyway, the fact that we don't -// // actually call Py_Finalize should not cause any problems (everything -// should shut down/go away anyway when the -// // process exits). -// // -//// Py_Finalize (); -//} - -#endif // #ifdef LLDB_DISABLE_PYTHON +// We are intentionally NOT calling Py_Finalize here (this would be the logical +// place to call it). Calling Py_Finalize here causes test suite runs to seg +// fault: The test suite runs in Python. It registers SBDebugger::Terminate to +// be called 'at_exit'. When the test suite Python harness finishes up, it +// calls Py_Finalize, which calls all the 'at_exit' registered functions. +// SBDebugger::Terminate calls Debugger::Terminate, which calls lldb::Terminate, +// which calls ScriptInterpreter::Terminate, which calls +// ScriptInterpreterPython::Terminate. So if we call Py_Finalize here, we end +// up with Py_Finalize being called from within Py_Finalize, which results in a +// seg fault. Since this function only gets called when lldb is shutting down +// and going away anyway, the fact that we don't actually call Py_Finalize +// should not cause any problems (everything should shut down/go away anyway +// when the process exits). +// +// void ScriptInterpreterPython::Terminate() { Py_Finalize (); } diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h index 628b71f3f47..527853bb624 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h @@ -10,12 +10,6 @@ #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H -#ifdef LLDB_DISABLE_PYTHON - -// Python is disabled in this build - -#else - // C Includes // C++ Includes #include <memory> @@ -571,6 +565,4 @@ protected: } // namespace lldb_private -#endif // LLDB_DISABLE_PYTHON - #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h b/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h index 81bcb8aa73b..c0998636fcb 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h @@ -1,5 +1,4 @@ -//===-- lldb-python.h --------------------------------------------*- C++ -//-*-===// +//===-- lldb-python.h -------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -14,9 +13,6 @@ // 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 #include "llvm/Support/Compiler.h" #if defined(_WIN32) // If anyone #includes Host/PosixApi.h later, it will try to typedef pid_t. We @@ -36,6 +32,5 @@ // Include python for non windows machines #include <Python.h> -#endif // LLDB_DISABLE_PYTHON #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H |