Skip to content

Commit 3565332

Browse files
authored
[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: #101672 (comment) 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 <[email protected]>
1 parent 8056d92 commit 3565332

16 files changed

+101
-98
lines changed

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt

+6-5
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ if (LLDB_ENABLE_LIBEDIT)
1919
list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
2020
endif()
2121

22-
add_lldb_library(lldbPluginScriptInterpreterPythonInterfaces
22+
add_lldb_library(lldbPluginScriptInterpreterPythonInterfaces PLUGIN
23+
OperatingSystemPythonInterface.cpp
24+
ScriptInterpreterPythonInterfaces.cpp
25+
ScriptedPlatformPythonInterface.cpp
26+
ScriptedProcessPythonInterface.cpp
2327
ScriptedPythonInterface.cpp
28+
ScriptedThreadPlanPythonInterface.cpp
2429
ScriptedThreadPythonInterface.cpp
2530

2631
LINK_LIBS
@@ -35,8 +40,4 @@ add_lldb_library(lldbPluginScriptInterpreterPythonInterfaces
3540
Support
3641
)
3742

38-
add_subdirectory(OperatingSystemPythonInterface)
39-
add_subdirectory(ScriptedPlatformPythonInterface)
40-
add_subdirectory(ScriptedProcessPythonInterface)
41-
add_subdirectory(ScriptedThreadPlanPythonInterface)
4243

Original file line numberDiff line numberDiff line change
@@ -16,20 +16,18 @@
1616

1717
// clang-format off
1818
// LLDB Python header must be included first
19-
#include "../../lldb-python.h"
19+
#include "../lldb-python.h"
2020
//clang-format on
2121

22-
#include "../../SWIGPythonBridge.h"
23-
#include "../../ScriptInterpreterPythonImpl.h"
22+
#include "../SWIGPythonBridge.h"
23+
#include "../ScriptInterpreterPythonImpl.h"
2424
#include "OperatingSystemPythonInterface.h"
2525

2626
using namespace lldb;
2727
using namespace lldb_private;
2828
using namespace lldb_private::python;
2929
using Locker = ScriptInterpreterPythonImpl::Locker;
3030

31-
LLDB_PLUGIN_DEFINE_ADV(OperatingSystemPythonInterface, ScriptInterpreterPythonOperatingSystemPythonInterface)
32-
3331
OperatingSystemPythonInterface::OperatingSystemPythonInterface(
3432
ScriptInterpreterPythonImpl &interpreter)
3533
: OperatingSystemInterface(), ScriptedThreadPythonInterface(interpreter) {}
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#if LLDB_ENABLE_PYTHON
1616

17-
#include "../ScriptedThreadPythonInterface.h"
17+
#include "ScriptedThreadPythonInterface.h"
1818

1919
#include <optional>
2020

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface/CMakeLists.txt

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//===-- ScriptInterpreterPythonInterfaces.cpp -----------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "lldb/Core/PluginManager.h"
10+
#include "lldb/Host/Config.h"
11+
#include "lldb/lldb-enumerations.h"
12+
13+
#if LLDB_ENABLE_PYTHON
14+
15+
#include "ScriptInterpreterPythonInterfaces.h"
16+
17+
using namespace lldb;
18+
using namespace lldb_private;
19+
20+
LLDB_PLUGIN_DEFINE(ScriptInterpreterPythonInterfaces)
21+
22+
llvm::StringRef
23+
ScriptInterpreterPythonInterfaces::GetPluginDescriptionStatic() {
24+
return "Script Interpreter Python Interfaces";
25+
}
26+
27+
void ScriptInterpreterPythonInterfaces::Initialize() {
28+
OperatingSystemPythonInterface::Initialize();
29+
ScriptedPlatformPythonInterface::Initialize();
30+
ScriptedProcessPythonInterface::Initialize();
31+
ScriptedThreadPlanPythonInterface::Initialize();
32+
}
33+
34+
void ScriptInterpreterPythonInterfaces::Terminate() {
35+
OperatingSystemPythonInterface::Terminate();
36+
ScriptedPlatformPythonInterface::Terminate();
37+
ScriptedProcessPythonInterface::Terminate();
38+
ScriptedThreadPlanPythonInterface::Terminate();
39+
}
40+
41+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//===-- ScriptInterpreterPythonInterfaces.h ---------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHONINTERFACES_H
10+
#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHONINTERFACES_H
11+
12+
#include "lldb/Core/PluginInterface.h"
13+
#include "lldb/Host/Config.h"
14+
#include "lldb/lldb-private.h"
15+
16+
#if LLDB_ENABLE_PYTHON
17+
18+
#include "OperatingSystemPythonInterface.h"
19+
#include "ScriptedPlatformPythonInterface.h"
20+
#include "ScriptedProcessPythonInterface.h"
21+
#include "ScriptedThreadPlanPythonInterface.h"
22+
23+
namespace lldb_private {
24+
class ScriptInterpreterPythonInterfaces : public PluginInterface {
25+
public:
26+
static void Initialize();
27+
static void Terminate();
28+
static llvm::StringRef GetPluginNameStatic() {
29+
return "script-interpreter-python-interfaces";
30+
}
31+
static llvm::StringRef GetPluginDescriptionStatic();
32+
};
33+
} // namespace lldb_private
34+
35+
#endif // LLDB_ENABLE_PYTHON
36+
#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHONINTERFACES_H
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,18 @@
1717

1818
// clang-format off
1919
// LLDB Python header must be included first
20-
#include "../../lldb-python.h"
20+
#include "../lldb-python.h"
2121
//clang-format on
2222

23-
#include "../../SWIGPythonBridge.h"
24-
#include "../../ScriptInterpreterPythonImpl.h"
23+
#include "../SWIGPythonBridge.h"
24+
#include "../ScriptInterpreterPythonImpl.h"
2525
#include "ScriptedPlatformPythonInterface.h"
2626

2727
using namespace lldb;
2828
using namespace lldb_private;
2929
using namespace lldb_private::python;
3030
using Locker = ScriptInterpreterPythonImpl::Locker;
3131

32-
LLDB_PLUGIN_DEFINE_ADV(ScriptedPlatformPythonInterface, ScriptInterpreterPythonScriptedPlatformPythonInterface)
33-
3432
ScriptedPlatformPythonInterface::ScriptedPlatformPythonInterface(
3533
ScriptInterpreterPythonImpl &interpreter)
3634
: ScriptedPlatformInterface(), ScriptedPythonInterface(interpreter) {}
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#if LLDB_ENABLE_PYTHON
1616

17-
#include "../ScriptedPythonInterface.h"
17+
#include "ScriptedPythonInterface.h"
1818

1919
namespace lldb_private {
2020
class ScriptedPlatformPythonInterface : public ScriptedPlatformInterface,

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface/CMakeLists.txt

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
// clang-format off
1818
// LLDB Python header must be included first
19-
#include "../../lldb-python.h"
19+
#include "../lldb-python.h"
2020

21-
#include "../../SWIGPythonBridge.h"
22-
#include "../../ScriptInterpreterPythonImpl.h"
23-
#include "../ScriptedThreadPythonInterface.h"
21+
#include "../SWIGPythonBridge.h"
22+
#include "../ScriptInterpreterPythonImpl.h"
23+
#include "ScriptedThreadPythonInterface.h"
2424
#include "ScriptedProcessPythonInterface.h"
2525

2626
// Included in this position to prevent redefinition of pid_t on Windows.
@@ -34,8 +34,6 @@ using namespace lldb_private;
3434
using namespace lldb_private::python;
3535
using Locker = ScriptInterpreterPythonImpl::Locker;
3636

37-
LLDB_PLUGIN_DEFINE_ADV(ScriptedProcessPythonInterface, ScriptInterpreterPythonScriptedProcessPythonInterface)
38-
3937
ScriptedProcessPythonInterface::ScriptedProcessPythonInterface(
4038
ScriptInterpreterPythonImpl &interpreter)
4139
: ScriptedProcessInterface(), ScriptedPythonInterface(interpreter) {}
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#if LLDB_ENABLE_PYTHON
1616

17-
#include "../ScriptedPythonInterface.h"
17+
#include "ScriptedPythonInterface.h"
1818

1919
#include <optional>
2020

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface/CMakeLists.txt

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,17 @@
1515

1616
// clang-format off
1717
// LLDB Python header must be included first
18-
#include "../../lldb-python.h"
18+
#include "../lldb-python.h"
1919
//clang-format on
2020

21-
#include "../../SWIGPythonBridge.h"
22-
#include "../../ScriptInterpreterPythonImpl.h"
21+
#include "../SWIGPythonBridge.h"
22+
#include "../ScriptInterpreterPythonImpl.h"
2323
#include "ScriptedThreadPlanPythonInterface.h"
2424

2525
using namespace lldb;
2626
using namespace lldb_private;
2727
using namespace lldb_private::python;
2828

29-
LLDB_PLUGIN_DEFINE_ADV(ScriptedThreadPlanPythonInterface, ScriptInterpreterPythonScriptedThreadPlanPythonInterface)
30-
3129
ScriptedThreadPlanPythonInterface::ScriptedThreadPlanPythonInterface(
3230
ScriptInterpreterPythonImpl &interpreter)
3331
: ScriptedThreadPlanInterface(), ScriptedPythonInterface(interpreter) {}
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#if LLDB_ENABLE_PYTHON
1616

17-
#include "../ScriptedPythonInterface.h"
17+
#include "ScriptedPythonInterface.h"
1818

1919
#include <optional>
2020

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface/CMakeLists.txt

-16
This file was deleted.

lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
// LLDB Python header must be included first
1515
#include "lldb-python.h"
1616

17-
#include "Interfaces/OperatingSystemPythonInterface/OperatingSystemPythonInterface.h"
18-
#include "Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.h"
19-
#include "Interfaces/ScriptedProcessPythonInterface/ScriptedProcessPythonInterface.h"
20-
#include "Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.h"
17+
#include "Interfaces/ScriptInterpreterPythonInterfaces.h"
2118
#include "PythonDataObjects.h"
2219
#include "PythonReadline.h"
2320
#include "SWIGPythonBridge.h"

0 commit comments

Comments
 (0)