Skip to content

Commit c35c4c7

Browse files
committed
[lldb] Reland 2402b32 with -H to debug the windows build issue
This patch relands 2402b32 to investigate the ambigious typedef issue happening on the windows bots: https://lab.llvm.org/buildbot/#/builders/141/builds/1175/ However this patch adds the `-H` compiler flag when building the ScriptedProcessPythonInterface library to be able to investigate the include order issue. This patch will be revert after 1 failing run on the windows bot. Signed-off-by: Med Ismail Bennani <[email protected]>
1 parent 6aaf870 commit c35c4c7

File tree

5 files changed

+68
-12
lines changed

5 files changed

+68
-12
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ endif()
2121

2222
add_lldb_library(lldbPluginScriptInterpreterPythonInterfaces
2323
ScriptedPythonInterface.cpp
24-
ScriptedProcessPythonInterface.cpp
2524
ScriptedThreadPythonInterface.cpp
2625

2726
LINK_LIBS
@@ -38,5 +37,9 @@ add_lldb_library(lldbPluginScriptInterpreterPythonInterfaces
3837

3938
add_subdirectory(OperatingSystemPythonInterface)
4039
add_subdirectory(ScriptedPlatformPythonInterface)
40+
set(ORIGINAL_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
41+
set(CMAKE_CXX_FLAGS "${ORIGINAL_CMAKE_CXX_FLAGS} -H")
42+
add_subdirectory(ScriptedProcessPythonInterface)
43+
set(CMAKE_CXX_FLAGS "${ORIGINAL_CMAKE_CXX_FLAGS}")
4144
add_subdirectory(ScriptedThreadPlanPythonInterface)
4245

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
add_lldb_library(lldbPluginScriptInterpreterPythonScriptedProcessPythonInterface PLUGIN
2+
3+
ScriptedProcessPythonInterface.cpp
4+
5+
LINK_LIBS
6+
lldbCore
7+
lldbHost
8+
lldbInterpreter
9+
lldbTarget
10+
lldbPluginScriptInterpreterPython
11+
${Python3_LIBRARIES}
12+
${LLDB_LIBEDIT_LIBS}
13+
14+
LINK_COMPONENTS
15+
Support
16+
)

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp renamed to lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface/ScriptedProcessPythonInterface.cpp

+32-7
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,34 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "lldb/Core/PluginManager.h"
910
#include "lldb/Host/Config.h"
10-
#if LLDB_ENABLE_PYTHON
11-
// LLDB Python header must be included first
12-
#include "../lldb-python.h"
13-
#endif
1411
#include "lldb/Target/Process.h"
1512
#include "lldb/Utility/Log.h"
1613
#include "lldb/Utility/Status.h"
1714
#include "lldb/lldb-enumerations.h"
1815

1916
#if LLDB_ENABLE_PYTHON
2017

21-
#include "../SWIGPythonBridge.h"
22-
#include "../ScriptInterpreterPythonImpl.h"
18+
// clang-format off
19+
// LLDB Python header must be included first
20+
#include "../../lldb-python.h"
21+
//clang-format on
22+
23+
#include "../../SWIGPythonBridge.h"
24+
#include "../../ScriptInterpreterPythonImpl.h"
25+
#include "../ScriptedThreadPythonInterface.h"
2326
#include "ScriptedProcessPythonInterface.h"
24-
#include "ScriptedThreadPythonInterface.h"
27+
2528
#include <optional>
2629

2730
using namespace lldb;
2831
using namespace lldb_private;
2932
using namespace lldb_private::python;
3033
using Locker = ScriptInterpreterPythonImpl::Locker;
3134

35+
LLDB_PLUGIN_DEFINE_ADV(ScriptedProcessPythonInterface, ScriptInterpreterPythonScriptedProcessPythonInterface)
36+
3237
ScriptedProcessPythonInterface::ScriptedProcessPythonInterface(
3338
ScriptInterpreterPythonImpl &interpreter)
3439
: ScriptedProcessInterface(), ScriptedPythonInterface(interpreter) {}
@@ -208,4 +213,24 @@ StructuredData::DictionarySP ScriptedProcessPythonInterface::GetMetadata() {
208213
return dict;
209214
}
210215

216+
void ScriptedProcessPythonInterface::Initialize() {
217+
const std::vector<llvm::StringRef> ci_usages = {
218+
"process attach -C <script-name> [-k key -v value ...]",
219+
"process launch -C <script-name> [-k key -v value ...]"};
220+
const std::vector<llvm::StringRef> api_usages = {
221+
"SBAttachInfo.SetScriptedProcessClassName",
222+
"SBAttachInfo.SetScriptedProcessDictionary",
223+
"SBTarget.Attach",
224+
"SBLaunchInfo.SetScriptedProcessClassName",
225+
"SBLaunchInfo.SetScriptedProcessDictionary",
226+
"SBTarget.Launch"};
227+
PluginManager::RegisterPlugin(
228+
GetPluginNameStatic(), llvm::StringRef("Mock process state"),
229+
CreateInstance, eScriptLanguagePython, {ci_usages, api_usages});
230+
}
231+
232+
void ScriptedProcessPythonInterface::Terminate() {
233+
PluginManager::UnregisterPlugin(CreateInstance);
234+
}
235+
211236
#endif

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.h renamed to lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface/ScriptedProcessPythonInterface.h

+15-3
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@
1010
#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_SCRIPTEDPROCESSPYTHONINTERFACE_H
1111

1212
#include "lldb/Host/Config.h"
13+
#include "lldb/Interpreter/Interfaces/ScriptedProcessInterface.h"
1314

1415
#if LLDB_ENABLE_PYTHON
1516

16-
#include "ScriptedPythonInterface.h"
17-
#include "lldb/Interpreter/Interfaces/ScriptedProcessInterface.h"
17+
#include "../ScriptedPythonInterface.h"
18+
1819
#include <optional>
1920

2021
namespace lldb_private {
2122
class ScriptedProcessPythonInterface : public ScriptedProcessInterface,
22-
public ScriptedPythonInterface {
23+
public ScriptedPythonInterface,
24+
public PluginInterface {
2325
public:
2426
ScriptedProcessPythonInterface(ScriptInterpreterPythonImpl &interpreter);
2527

@@ -67,6 +69,16 @@ class ScriptedProcessPythonInterface : public ScriptedProcessInterface,
6769

6870
StructuredData::DictionarySP GetMetadata() override;
6971

72+
static void Initialize();
73+
74+
static void Terminate();
75+
76+
static llvm::StringRef GetPluginNameStatic() {
77+
return "ScriptedProcessPythonInterface";
78+
}
79+
80+
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
81+
7082
private:
7183
lldb::ScriptedThreadInterfaceSP CreateScriptedThreadInterface() override;
7284
};

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include "Interfaces/OperatingSystemPythonInterface/OperatingSystemPythonInterface.h"
1818
#include "Interfaces/ScriptedPlatformPythonInterface/ScriptedPlatformPythonInterface.h"
19-
#include "Interfaces/ScriptedProcessPythonInterface.h"
19+
#include "Interfaces/ScriptedProcessPythonInterface/ScriptedProcessPythonInterface.h"
2020
#include "Interfaces/ScriptedThreadPlanPythonInterface/ScriptedThreadPlanPythonInterface.h"
2121
#include "PythonDataObjects.h"
2222
#include "PythonReadline.h"

0 commit comments

Comments
 (0)