1*061da546Spatrick //===-- ScriptInterpreterPython.h -------------------------------*- C++ -*-===// 2*061da546Spatrick // 3*061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*061da546Spatrick // See https://llvm.org/LICENSE.txt for license information. 5*061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*061da546Spatrick // 7*061da546Spatrick //===----------------------------------------------------------------------===// 8*061da546Spatrick 9*061da546Spatrick #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H 10*061da546Spatrick #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H 11*061da546Spatrick 12*061da546Spatrick #include "lldb/Host/Config.h" 13*061da546Spatrick 14*061da546Spatrick #if LLDB_ENABLE_PYTHON 15*061da546Spatrick 16*061da546Spatrick #include "lldb/Breakpoint/BreakpointOptions.h" 17*061da546Spatrick #include "lldb/Core/IOHandler.h" 18*061da546Spatrick #include "lldb/Core/StructuredDataImpl.h" 19*061da546Spatrick #include "lldb/Interpreter/ScriptInterpreter.h" 20*061da546Spatrick #include "lldb/lldb-private.h" 21*061da546Spatrick 22*061da546Spatrick #include <memory> 23*061da546Spatrick #include <string> 24*061da546Spatrick #include <vector> 25*061da546Spatrick 26*061da546Spatrick namespace lldb_private { 27*061da546Spatrick /// Abstract interface for the Python script interpreter. 28*061da546Spatrick class ScriptInterpreterPython : public ScriptInterpreter, 29*061da546Spatrick public IOHandlerDelegateMultiline { 30*061da546Spatrick public: 31*061da546Spatrick class CommandDataPython : public BreakpointOptions::CommandData { 32*061da546Spatrick public: 33*061da546Spatrick CommandDataPython() : BreakpointOptions::CommandData() { 34*061da546Spatrick interpreter = lldb::eScriptLanguagePython; 35*061da546Spatrick } 36*061da546Spatrick CommandDataPython(StructuredData::ObjectSP extra_args_sp) : 37*061da546Spatrick BreakpointOptions::CommandData(), 38*061da546Spatrick m_extra_args_up(new StructuredDataImpl()) { 39*061da546Spatrick interpreter = lldb::eScriptLanguagePython; 40*061da546Spatrick m_extra_args_up->SetObjectSP(extra_args_sp); 41*061da546Spatrick } 42*061da546Spatrick lldb::StructuredDataImplUP m_extra_args_up; 43*061da546Spatrick }; 44*061da546Spatrick 45*061da546Spatrick ScriptInterpreterPython(Debugger &debugger) 46*061da546Spatrick : ScriptInterpreter(debugger, lldb::eScriptLanguagePython), 47*061da546Spatrick IOHandlerDelegateMultiline("DONE") {} 48*061da546Spatrick 49*061da546Spatrick static void Initialize(); 50*061da546Spatrick static void Terminate(); 51*061da546Spatrick static lldb_private::ConstString GetPluginNameStatic(); 52*061da546Spatrick static const char *GetPluginDescriptionStatic(); 53*061da546Spatrick static FileSpec GetPythonDir(); 54*061da546Spatrick 55*061da546Spatrick protected: 56*061da546Spatrick static void ComputePythonDirForApple(llvm::SmallVectorImpl<char> &path); 57*061da546Spatrick static void ComputePythonDir(llvm::SmallVectorImpl<char> &path); 58*061da546Spatrick }; 59*061da546Spatrick } // namespace lldb_private 60*061da546Spatrick 61*061da546Spatrick #endif // LLDB_ENABLE_PYTHON 62*061da546Spatrick #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H 63