1//===-- ScriptInterpreterPython.h -------------------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
10#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
11
12#include "lldb/Host/Config.h"
13
14#if LLDB_ENABLE_PYTHON
15
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"
21
22#include <memory>
23#include <string>
24#include <vector>
25
26namespace lldb_private {
27/// Abstract interface for the Python script interpreter.
28class ScriptInterpreterPython : public ScriptInterpreter,
29 public IOHandlerDelegateMultiline {
30public:
31 class CommandDataPython : public BreakpointOptions::CommandData {
32 public:
33 CommandDataPython() : BreakpointOptions::CommandData() {
34 interpreter = lldb::eScriptLanguagePython;
35 }
36 CommandDataPython(StructuredData::ObjectSP extra_args_sp)
37 : BreakpointOptions::CommandData(),
38 m_extra_args(std::move(extra_args_sp)) {
39 interpreter = lldb::eScriptLanguagePython;
40 }
41 StructuredDataImpl m_extra_args;
42 };
43
44 ScriptInterpreterPython(Debugger &debugger)
45 : ScriptInterpreter(debugger, lldb::eScriptLanguagePython),
46 IOHandlerDelegateMultiline("DONE") {}
47
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);
55
56protected:
57 static void ComputePythonDirForApple(llvm::SmallVectorImpl<char> &path);
58 static void ComputePythonDir(llvm::SmallVectorImpl<char> &path);
59};
60} // namespace lldb_private
61
62#endif // LLDB_ENABLE_PYTHON
63#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
64

source code of lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h