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 12d68983e3SPavel Labath #ifdef LLDB_DISABLE_PYTHON 13d68983e3SPavel Labath 14d68983e3SPavel Labath // Python is disabled in this build 15d68983e3SPavel Labath 16d68983e3SPavel Labath #else 17d68983e3SPavel Labath 1863dd5d25SJonas Devlieghere #include "lldb/Breakpoint/BreakpointOptions.h" 1963dd5d25SJonas Devlieghere #include "lldb/Core/IOHandler.h" 20*738af7a6SJim Ingham #include "lldb/Core/StructuredDataImpl.h" 2163dd5d25SJonas Devlieghere #include "lldb/Interpreter/ScriptInterpreter.h" 2263dd5d25SJonas Devlieghere #include "lldb/lldb-private.h" 2363dd5d25SJonas Devlieghere 24edb35d95SEugene Zelenko #include <memory> 25edb35d95SEugene Zelenko #include <string> 26edb35d95SEugene Zelenko #include <vector> 27edb35d95SEugene Zelenko 282c1f46dcSZachary Turner namespace lldb_private { 2963dd5d25SJonas Devlieghere /// Abstract interface for the Python script interpreter. 30b9c1b51eSKate Stone class ScriptInterpreterPython : public ScriptInterpreter, 31b9c1b51eSKate Stone public IOHandlerDelegateMultiline { 322c1f46dcSZachary Turner public: 33f7e07256SJim Ingham class CommandDataPython : public BreakpointOptions::CommandData { 34f7e07256SJim Ingham public: 35f7e07256SJim Ingham CommandDataPython() : BreakpointOptions::CommandData() { 36f7e07256SJim Ingham interpreter = lldb::eScriptLanguagePython; 37f7e07256SJim Ingham } 38*738af7a6SJim Ingham CommandDataPython(StructuredData::ObjectSP extra_args_sp) : 39*738af7a6SJim Ingham BreakpointOptions::CommandData(), 40*738af7a6SJim Ingham m_extra_args_up(new StructuredDataImpl()) { 41*738af7a6SJim Ingham interpreter = lldb::eScriptLanguagePython; 42*738af7a6SJim Ingham m_extra_args_up->SetObjectSP(extra_args_sp); 43*738af7a6SJim Ingham } 44*738af7a6SJim Ingham lldb::StructuredDataImplUP m_extra_args_up; 45f7e07256SJim Ingham }; 46f7e07256SJim Ingham 478d1fb843SJonas Devlieghere ScriptInterpreterPython(Debugger &debugger) 488d1fb843SJonas Devlieghere : ScriptInterpreter(debugger, lldb::eScriptLanguagePython), 4963dd5d25SJonas Devlieghere IOHandlerDelegateMultiline("DONE") {} 502c1f46dcSZachary Turner 51b9c1b51eSKate Stone static void Initialize(); 52b9c1b51eSKate Stone static void Terminate(); 53b9c1b51eSKate Stone static lldb_private::ConstString GetPluginNameStatic(); 54b9c1b51eSKate Stone static const char *GetPluginDescriptionStatic(); 552df331b0SPavel Labath static FileSpec GetPythonDir(); 562df331b0SPavel Labath 572c1f46dcSZachary Turner protected: 582df331b0SPavel Labath static void ComputePythonDirForApple(llvm::SmallVectorImpl<char> &path); 5961f471a7SHaibo Huang static void ComputePythonDir(llvm::SmallVectorImpl<char> &path); 602c1f46dcSZachary Turner }; 612c1f46dcSZachary Turner } // namespace lldb_private 622c1f46dcSZachary Turner 63d68983e3SPavel Labath #endif // LLDB_DISABLE_PYTHON 64280eb8abSPavel Labath #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H 65