diff options
author | Med Ismail Bennani <ismail@bennani.ma> | 2024-08-20 10:47:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-20 10:47:06 -0700 |
commit | 356533246aa33db44c75afb2d3eb6e0e08f0d7a6 (patch) | |
tree | b6771ec31906f74ffc68778a12f66b61616f13fb /lldb/source/Plugins/ScriptInterpreter/Python | |
parent | 8056d92bc201906edbb27f4efa1cc80a18359880 (diff) | |
download | llvm-356533246aa33db44c75afb2d3eb6e0e08f0d7a6.zip llvm-356533246aa33db44c75afb2d3eb6e0e08f0d7a6.tar.gz llvm-356533246aa33db44c75afb2d3eb6e0e08f0d7a6.tar.bz2 |
[lldb] Fix windows debug build after 9d07f43 (#104896)
This patch tries to fix an issue with the windows debug builds where the
PDB file for python scripted interfaces cannot be opened since its path
length exceed the windows `MAX_PATH` limit:
https://github.com/llvm/llvm-project/pull/101672#issuecomment-2289481324
This patch addresses the issue by building all the interfaces as a
single library plugin that initiliazes each component as part of its
`Initialize` method, instead of building each interface as its own
library plugin.
This keeps the build artifact path length smaller while respecting the
naming convention and without making any exception in the build system.
Fixes #104895.
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python')
16 files changed, 101 insertions, 98 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt index eb22a96..6ba714e 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt @@ -19,8 +19,13 @@ if (LLDB_ENABLE_LIBEDIT) list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit) endif() -add_lldb_library(lldbPluginScriptInterpreterPythonInterfaces +add_lldb_library(lldbPluginScriptInterpreterPythonInterfaces PLUGIN + OperatingSystemPythonInterface.cpp + ScriptInterpreterPythonInterfaces.cpp + ScriptedPlatformPythonInterface.cpp + ScriptedProcessPythonInterface.cpp ScriptedPythonInterface.cpp + ScriptedThreadPlanPythonInterface.cpp ScriptedThreadPythonInterface.cpp LINK_LIBS @@ -35,8 +40,4 @@ add_lldb_library(lldbPluginScriptInterpreterPythonInterfaces Support ) -add_subdirectory(OperatingSystemPythonInterface) -add_subdirectory(ScriptedPlatformPythonInterface) -add_subdirectory(ScriptedProcessPythonInterface) -add_subdirectory(ScriptedThreadPlanPythonInterface) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/OperatingSystemPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp index 019db26..c3379e7 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/OperatingSystemPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp @@ -16,11 +16,11 @@ // clang-format off // LLDB Python header must be included first -#include "../../lldb-python.h" +#include "../lldb-python.h" //clang-format on -#include "../../SWIGPythonBridge.h" -#include "../../ScriptInterpreterPythonImpl.h" +#include "../SWIGPythonBridge.h" +#include "../ScriptInterpreterPythonImpl.h" #include "OperatingSystemPythonInterface.h" using namespace lldb; @@ -28,8 +28,6 @@ using namespace lldb_private; using namespace lldb_private::python; using Locker = ScriptInterpreterPythonImpl::Locker; -LLDB_PLUGIN_DEFINE_ADV(OperatingSystemPythonInterface, ScriptInterpreterPythonOperatingSystemPythonInterface) - OperatingSystemPythonInterface::OperatingSystemPythonInterface( ScriptInterpreterPythonImpl &interpreter) : OperatingSystemInterface(), ScriptedThreadPythonInterface(interpreter) {} diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/OperatingSystemPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.h index 6d60f8b..92358ac 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/OperatingSystemPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.h @@ -14,7 +14,7 @@ #if LLDB_ENABLE_PYTHON -#include "../ScriptedThreadPythonInterface.h" +#include "ScriptedThreadPythonInterface.h" #include <optional> diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/CMakeLists.txt deleted file mode 100644 index b48f1e8..0000000 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -add_lldb_library(lldbPluginScriptInterpreterPythonOperatingSystemPythonInterface PLUGIN - - OperatingSystemPythonInterface.cpp - - LINK_LIBS - lldbCore - lldbHost - lldbInterpreter - lldbTarget - lldbPluginScriptInterpreterPython - ${Python3_LIBRARIES} - ${LLDB_LIBEDIT_LIBS} - - LINK_COMPONENTS - Support - ) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.cpp new file mode 100644 index 0000000..38b6443 --- /dev/null +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.cpp @@ -0,0 +1,41 @@ +//===-- ScriptInterpreterPythonInterfaces.cpp -----------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "lldb/Core/PluginManager.h" +#include "lldb/Host/Config.h" +#include "lldb/lldb-enumerations.h" + +#if LLDB_ENABLE_PYTHON + +#include "ScriptInterpreterPythonInterfaces.h" + +using namespace lldb; +using namespace lldb_private; + +LLDB_PLUGIN_DEFINE(ScriptInterpreterPythonInterfaces) + +llvm::StringRef +ScriptInterpreterPythonInterfaces::GetPluginDescriptionStatic() { + return "Script Interpreter Python Interfaces"; +} + +void ScriptInterpreterPythonInterfaces::Initialize() { + OperatingSystemPythonInterface::Initialize(); + ScriptedPlatformPythonInterface::Initialize(); + ScriptedProcessPythonInterface::Initialize(); + ScriptedThreadPlanPythonInterface::Initialize(); +} + +void ScriptInterpreterPythonInterfaces::Terminate() { + OperatingSystemPythonInterface::Terminate(); + ScriptedPlatformPythonInterface::Terminate(); + ScriptedProcessPythonInterface::Terminate(); + ScriptedThreadPlanPythonInterface::Terminate(); +} + +#endif diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.h new file mode 100644 index 0000000..36b5214 --- /dev/null +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptInterpreterPythonInterfaces.h @@ -0,0 +1,36 @@ +//===-- ScriptInterpreterPythonInterfaces.h ---------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHONINTERFACES_H +#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHONINTERFACES_H + +#include "lldb/Core/PluginInterface.h" +#include "lldb/Host/Config.h" +#include "lldb/lldb-private.h" + +#if LLDB_ENABLE_PYTHON + +#include "OperatingSystemPythonInterface.h" +#include "ScriptedPlatformPythonInterface.h" +#include "ScriptedProcessPythonInterface.h" +#include "ScriptedThreadPlanPythonInterface.h" + +namespace lldb_private { +class ScriptInterpreterPythonInterfaces : public PluginInterface { +public: + static void Initialize(); + static void Terminate(); + static llvm::StringRef GetPluginNameStatic() { + return "script-interpreter-python-interfaces"; + } + static llvm::StringRef GetPluginDescriptionStatic(); +}; +} // namespace lldb_private + +#endif // LLDB_ENABLE_PYTHON +#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHONINTERFACES_H diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp index 3586251..0c078f01 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp @@ -17,11 +17,11 @@ // clang-format off // LLDB Python header must be included first -#include "../../lldb-python.h" +#include "../lldb-python.h" //clang-format on -#include "../../SWIGPythonBridge.h" -#include "../../ScriptInterpreterPythonImpl.h" +#include "../SWIGPythonBridge.h" +#include "../ScriptInterpreterPythonImpl.h" #include "ScriptedPlatformPythonInterface.h" using namespace lldb; @@ -29,8 +29,6 @@ using namespace lldb_private; using namespace lldb_private::python; using Locker = ScriptInterpreterPythonImpl::Locker; -LLDB_PLUGIN_DEFINE_ADV(ScriptedPlatformPythonInterface, ScriptInterpreterPythonScriptedPlatformPythonInterface) - ScriptedPlatformPythonInterface::ScriptedPlatformPythonInterface( ScriptInterpreterPythonImpl &interpreter) : ScriptedPlatformInterface(), ScriptedPythonInterface(interpreter) {} diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.h index 01ee40a..36a219a 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.h @@ -14,7 +14,7 @@ #if LLDB_ENABLE_PYTHON -#include "../ScriptedPythonInterface.h" +#include "ScriptedPythonInterface.h" namespace lldb_private { class ScriptedPlatformPythonInterface : public ScriptedPlatformInterface, diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/CMakeLists.txt deleted file mode 100644 index ae5e525..0000000 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -add_lldb_library(lldbPluginScriptInterpreterPythonScriptedPlatformPythonInterface PLUGIN - - ScriptedPlatformPythonInterface.cpp - - LINK_LIBS - lldbCore - lldbHost - lldbInterpreter - lldbTarget - lldbPluginScriptInterpreterPython - ${Python3_LIBRARIES} - ${LLDB_LIBEDIT_LIBS} - - LINK_COMPONENTS - Support - ) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface/ScriptedProcessPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp index c744d70..8ba31b3 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface/ScriptedProcessPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp @@ -16,11 +16,11 @@ // clang-format off // LLDB Python header must be included first -#include "../../lldb-python.h" +#include "../lldb-python.h" -#include "../../SWIGPythonBridge.h" -#include "../../ScriptInterpreterPythonImpl.h" -#include "../ScriptedThreadPythonInterface.h" +#include "../SWIGPythonBridge.h" +#include "../ScriptInterpreterPythonImpl.h" +#include "ScriptedThreadPythonInterface.h" #include "ScriptedProcessPythonInterface.h" // Included in this position to prevent redefinition of pid_t on Windows. @@ -34,8 +34,6 @@ using namespace lldb_private; using namespace lldb_private::python; using Locker = ScriptInterpreterPythonImpl::Locker; -LLDB_PLUGIN_DEFINE_ADV(ScriptedProcessPythonInterface, ScriptInterpreterPythonScriptedProcessPythonInterface) - ScriptedProcessPythonInterface::ScriptedProcessPythonInterface( ScriptInterpreterPythonImpl &interpreter) : ScriptedProcessInterface(), ScriptedPythonInterface(interpreter) {} diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface/ScriptedProcessPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.h index bb27734..1535d57 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface/ScriptedProcessPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.h @@ -14,7 +14,7 @@ #if LLDB_ENABLE_PYTHON -#include "../ScriptedPythonInterface.h" +#include "ScriptedPythonInterface.h" #include <optional> diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface/CMakeLists.txt deleted file mode 100644 index 66ed041..0000000 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -add_lldb_library(lldbPluginScriptInterpreterPythonScriptedProcessPythonInterface PLUGIN - - ScriptedProcessPythonInterface.cpp - - LINK_LIBS - lldbCore - lldbHost - lldbInterpreter - lldbTarget - lldbPluginScriptInterpreterPython - ${Python3_LIBRARIES} - ${LLDB_LIBEDIT_LIBS} - - LINK_COMPONENTS - Support - ) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface.cpp index 5f1c7da..14c48a4 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface.cpp @@ -15,19 +15,17 @@ // clang-format off // LLDB Python header must be included first -#include "../../lldb-python.h" +#include "../lldb-python.h" //clang-format on -#include "../../SWIGPythonBridge.h" -#include "../../ScriptInterpreterPythonImpl.h" +#include "../SWIGPythonBridge.h" +#include "../ScriptInterpreterPythonImpl.h" #include "ScriptedThreadPlanPythonInterface.h" using namespace lldb; using namespace lldb_private; using namespace lldb_private::python; -LLDB_PLUGIN_DEFINE_ADV(ScriptedThreadPlanPythonInterface, ScriptInterpreterPythonScriptedThreadPlanPythonInterface) - ScriptedThreadPlanPythonInterface::ScriptedThreadPlanPythonInterface( ScriptInterpreterPythonImpl &interpreter) : ScriptedThreadPlanInterface(), ScriptedPythonInterface(interpreter) {} diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface.h index c0a82f4..5e78ae7 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface.h @@ -14,7 +14,7 @@ #if LLDB_ENABLE_PYTHON -#include "../ScriptedPythonInterface.h" +#include "ScriptedPythonInterface.h" #include <optional> diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/CMakeLists.txt deleted file mode 100644 index db41da1..0000000 --- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -add_lldb_library(lldbPluginScriptInterpreterPythonScriptedThreadPlanPythonInterface PLUGIN - - ScriptedThreadPlanPythonInterface.cpp - - LINK_LIBS - lldbCore - lldbHost - lldbInterpreter - lldbTarget - lldbPluginScriptInterpreterPython - ${Python3_LIBRARIES} - ${LLDB_LIBEDIT_LIBS} - - LINK_COMPONENTS - Support - ) diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index a78c76b..335c482 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -14,10 +14,7 @@ // LLDB Python header must be included first #include "lldb-python.h" -#include "Interfaces/OperatingSystemPythonInterface/OperatingSystemPythonInterface.h" -#include "Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.h" -#include "Interfaces/ScriptedProcessPythonInterface/ScriptedProcessPythonInterface.h" -#include "Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.h" +#include "Interfaces/ScriptInterpreterPythonInterfaces.h" #include "PythonDataObjects.h" #include "PythonReadline.h" #include "SWIGPythonBridge.h" |