10b57cec5SDimitry Andric //===-- ScriptInterpreterPython.h -------------------------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
100b57cec5SDimitry Andric #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
110b57cec5SDimitry Andric 
12480093f4SDimitry Andric #include "lldb/Host/Config.h"
130b57cec5SDimitry Andric 
14480093f4SDimitry Andric #if LLDB_ENABLE_PYTHON
150b57cec5SDimitry Andric 
16*5f7ddb14SDimitry Andric #include "ScriptedProcessPythonInterface.h"
17*5f7ddb14SDimitry Andric 
180b57cec5SDimitry Andric #include "lldb/Breakpoint/BreakpointOptions.h"
190b57cec5SDimitry Andric #include "lldb/Core/IOHandler.h"
20480093f4SDimitry Andric #include "lldb/Core/StructuredDataImpl.h"
210b57cec5SDimitry Andric #include "lldb/Interpreter/ScriptInterpreter.h"
220b57cec5SDimitry Andric #include "lldb/lldb-private.h"
230b57cec5SDimitry Andric 
240b57cec5SDimitry Andric #include <memory>
250b57cec5SDimitry Andric #include <string>
260b57cec5SDimitry Andric #include <vector>
270b57cec5SDimitry Andric 
280b57cec5SDimitry Andric namespace lldb_private {
290b57cec5SDimitry Andric /// Abstract interface for the Python script interpreter.
300b57cec5SDimitry Andric class ScriptInterpreterPython : public ScriptInterpreter,
310b57cec5SDimitry Andric                                 public IOHandlerDelegateMultiline {
320b57cec5SDimitry Andric public:
330b57cec5SDimitry Andric   class CommandDataPython : public BreakpointOptions::CommandData {
340b57cec5SDimitry Andric   public:
CommandDataPython()350b57cec5SDimitry Andric     CommandDataPython() : BreakpointOptions::CommandData() {
360b57cec5SDimitry Andric       interpreter = lldb::eScriptLanguagePython;
370b57cec5SDimitry Andric     }
CommandDataPython(StructuredData::ObjectSP extra_args_sp)38480093f4SDimitry Andric     CommandDataPython(StructuredData::ObjectSP extra_args_sp) :
39480093f4SDimitry Andric         BreakpointOptions::CommandData(),
40480093f4SDimitry Andric         m_extra_args_up(new StructuredDataImpl()) {
41480093f4SDimitry Andric         interpreter = lldb::eScriptLanguagePython;
42480093f4SDimitry Andric         m_extra_args_up->SetObjectSP(extra_args_sp);
43480093f4SDimitry Andric     }
44480093f4SDimitry Andric     lldb::StructuredDataImplUP m_extra_args_up;
450b57cec5SDimitry Andric   };
460b57cec5SDimitry Andric 
ScriptInterpreterPython(Debugger & debugger)470b57cec5SDimitry Andric   ScriptInterpreterPython(Debugger &debugger)
480b57cec5SDimitry Andric       : ScriptInterpreter(debugger, lldb::eScriptLanguagePython),
490b57cec5SDimitry Andric         IOHandlerDelegateMultiline("DONE") {}
500b57cec5SDimitry Andric 
510b57cec5SDimitry Andric   static void Initialize();
520b57cec5SDimitry Andric   static void Terminate();
530b57cec5SDimitry Andric   static lldb_private::ConstString GetPluginNameStatic();
540b57cec5SDimitry Andric   static const char *GetPluginDescriptionStatic();
550b57cec5SDimitry Andric   static FileSpec GetPythonDir();
56*5f7ddb14SDimitry Andric   static void SharedLibraryDirectoryHelper(FileSpec &this_file);
570b57cec5SDimitry Andric 
580b57cec5SDimitry Andric protected:
590b57cec5SDimitry Andric   static void ComputePythonDirForApple(llvm::SmallVectorImpl<char> &path);
609dba64beSDimitry Andric   static void ComputePythonDir(llvm::SmallVectorImpl<char> &path);
610b57cec5SDimitry Andric };
620b57cec5SDimitry Andric } // namespace lldb_private
630b57cec5SDimitry Andric 
64480093f4SDimitry Andric #endif // LLDB_ENABLE_PYTHON
650b57cec5SDimitry Andric #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
66