12c1f46dcSZachary Turner //===-- ScriptInterpreterPython.h -------------------------------*- C++ -*-===//
22c1f46dcSZachary Turner //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
62c1f46dcSZachary Turner //
72c1f46dcSZachary Turner //===----------------------------------------------------------------------===//
82c1f46dcSZachary Turner 
92c1f46dcSZachary Turner #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
102c1f46dcSZachary Turner #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
112c1f46dcSZachary Turner 
12*59998b7bSJonas Devlieghere #include "lldb/Host/Config.h"
13*59998b7bSJonas Devlieghere 
14d68983e3SPavel Labath #ifdef LLDB_DISABLE_PYTHON
15d68983e3SPavel Labath 
16d68983e3SPavel Labath // Python is disabled in this build
17d68983e3SPavel Labath 
18d68983e3SPavel Labath #else
19d68983e3SPavel Labath 
2063dd5d25SJonas Devlieghere #include "lldb/Breakpoint/BreakpointOptions.h"
2163dd5d25SJonas Devlieghere #include "lldb/Core/IOHandler.h"
22738af7a6SJim Ingham #include "lldb/Core/StructuredDataImpl.h"
2363dd5d25SJonas Devlieghere #include "lldb/Interpreter/ScriptInterpreter.h"
2463dd5d25SJonas Devlieghere #include "lldb/lldb-private.h"
2563dd5d25SJonas Devlieghere 
26edb35d95SEugene Zelenko #include <memory>
27edb35d95SEugene Zelenko #include <string>
28edb35d95SEugene Zelenko #include <vector>
29edb35d95SEugene Zelenko 
302c1f46dcSZachary Turner namespace lldb_private {
3163dd5d25SJonas Devlieghere /// Abstract interface for the Python script interpreter.
32b9c1b51eSKate Stone class ScriptInterpreterPython : public ScriptInterpreter,
33b9c1b51eSKate Stone                                 public IOHandlerDelegateMultiline {
342c1f46dcSZachary Turner public:
35f7e07256SJim Ingham   class CommandDataPython : public BreakpointOptions::CommandData {
36f7e07256SJim Ingham   public:
37f7e07256SJim Ingham     CommandDataPython() : BreakpointOptions::CommandData() {
38f7e07256SJim Ingham       interpreter = lldb::eScriptLanguagePython;
39f7e07256SJim Ingham     }
40738af7a6SJim Ingham     CommandDataPython(StructuredData::ObjectSP extra_args_sp) :
41738af7a6SJim Ingham         BreakpointOptions::CommandData(),
42738af7a6SJim Ingham         m_extra_args_up(new StructuredDataImpl()) {
43738af7a6SJim Ingham         interpreter = lldb::eScriptLanguagePython;
44738af7a6SJim Ingham         m_extra_args_up->SetObjectSP(extra_args_sp);
45738af7a6SJim Ingham     }
46738af7a6SJim Ingham     lldb::StructuredDataImplUP m_extra_args_up;
47f7e07256SJim Ingham   };
48f7e07256SJim Ingham 
498d1fb843SJonas Devlieghere   ScriptInterpreterPython(Debugger &debugger)
508d1fb843SJonas Devlieghere       : ScriptInterpreter(debugger, lldb::eScriptLanguagePython),
5163dd5d25SJonas Devlieghere         IOHandlerDelegateMultiline("DONE") {}
522c1f46dcSZachary Turner 
53b9c1b51eSKate Stone   static void Initialize();
54b9c1b51eSKate Stone   static void Terminate();
55b9c1b51eSKate Stone   static lldb_private::ConstString GetPluginNameStatic();
56b9c1b51eSKate Stone   static const char *GetPluginDescriptionStatic();
572df331b0SPavel Labath   static FileSpec GetPythonDir();
582df331b0SPavel Labath 
592c1f46dcSZachary Turner protected:
602df331b0SPavel Labath   static void ComputePythonDirForApple(llvm::SmallVectorImpl<char> &path);
6161f471a7SHaibo Huang   static void ComputePythonDir(llvm::SmallVectorImpl<char> &path);
622c1f46dcSZachary Turner };
632c1f46dcSZachary Turner } // namespace lldb_private
642c1f46dcSZachary Turner 
65d68983e3SPavel Labath #endif // LLDB_DISABLE_PYTHON
66280eb8abSPavel Labath #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
67