1 //===-- ScriptInterpreterPython.h -------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
10 #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
12 #include "lldb/Host/Config.h"
14 #if LLDB_ENABLE_PYTHON
16 #include "lldb/Breakpoint/BreakpointOptions.h"
17 #include "lldb/Core/IOHandler.h"
18 #include "lldb/Core/StructuredDataImpl.h"
19 #include "lldb/Interpreter/ScriptInterpreter.h"
20 #include "lldb/lldb-private.h"
26 namespace lldb_private
{
27 /// Abstract interface for the Python script interpreter.
28 class ScriptInterpreterPython
: public ScriptInterpreter
,
29 public IOHandlerDelegateMultiline
{
31 class CommandDataPython
: public BreakpointOptions::CommandData
{
33 CommandDataPython() : BreakpointOptions::CommandData() {
34 interpreter
= lldb::eScriptLanguagePython
;
36 CommandDataPython(StructuredData::ObjectSP extra_args_sp
)
37 : BreakpointOptions::CommandData(),
38 m_extra_args(std::move(extra_args_sp
)) {
39 interpreter
= lldb::eScriptLanguagePython
;
41 StructuredDataImpl m_extra_args
;
44 ScriptInterpreterPython(Debugger
&debugger
)
45 : ScriptInterpreter(debugger
, lldb::eScriptLanguagePython
),
46 IOHandlerDelegateMultiline("DONE") {}
48 StructuredData::DictionarySP
GetInterpreterInfo() override
;
49 static void Initialize();
50 static void Terminate();
51 static llvm::StringRef
GetPluginNameStatic() { return "script-python"; }
52 static llvm::StringRef
GetPluginDescriptionStatic();
53 static FileSpec
GetPythonDir();
54 static void SharedLibraryDirectoryHelper(FileSpec
&this_file
);
57 static void ComputePythonDirForApple(llvm::SmallVectorImpl
<char> &path
);
58 static void ComputePythonDir(llvm::SmallVectorImpl
<char> &path
);
60 } // namespace lldb_private
62 #endif // LLDB_ENABLE_PYTHON
63 #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H