xref: /openbsd-src/gnu/llvm/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h (revision be691f3bb6417f04a68938fadbcaee2d5795e764)
1061da546Spatrick //===-- ScriptInterpreterPython.h -------------------------------*- C++ -*-===//
2061da546Spatrick //
3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information.
5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6061da546Spatrick //
7061da546Spatrick //===----------------------------------------------------------------------===//
8061da546Spatrick 
9061da546Spatrick #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
10061da546Spatrick #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
11061da546Spatrick 
12061da546Spatrick #include "lldb/Host/Config.h"
13061da546Spatrick 
14061da546Spatrick #if LLDB_ENABLE_PYTHON
15061da546Spatrick 
16*be691f3bSpatrick #include "ScriptedProcessPythonInterface.h"
17*be691f3bSpatrick 
18061da546Spatrick #include "lldb/Breakpoint/BreakpointOptions.h"
19061da546Spatrick #include "lldb/Core/IOHandler.h"
20061da546Spatrick #include "lldb/Core/StructuredDataImpl.h"
21061da546Spatrick #include "lldb/Interpreter/ScriptInterpreter.h"
22061da546Spatrick #include "lldb/lldb-private.h"
23061da546Spatrick 
24061da546Spatrick #include <memory>
25061da546Spatrick #include <string>
26061da546Spatrick #include <vector>
27061da546Spatrick 
28061da546Spatrick namespace lldb_private {
29061da546Spatrick /// Abstract interface for the Python script interpreter.
30061da546Spatrick class ScriptInterpreterPython : public ScriptInterpreter,
31061da546Spatrick                                 public IOHandlerDelegateMultiline {
32061da546Spatrick public:
33061da546Spatrick   class CommandDataPython : public BreakpointOptions::CommandData {
34061da546Spatrick   public:
35061da546Spatrick     CommandDataPython() : BreakpointOptions::CommandData() {
36061da546Spatrick       interpreter = lldb::eScriptLanguagePython;
37061da546Spatrick     }
38061da546Spatrick     CommandDataPython(StructuredData::ObjectSP extra_args_sp) :
39061da546Spatrick         BreakpointOptions::CommandData(),
40061da546Spatrick         m_extra_args_up(new StructuredDataImpl()) {
41061da546Spatrick         interpreter = lldb::eScriptLanguagePython;
42061da546Spatrick         m_extra_args_up->SetObjectSP(extra_args_sp);
43061da546Spatrick     }
44061da546Spatrick     lldb::StructuredDataImplUP m_extra_args_up;
45061da546Spatrick   };
46061da546Spatrick 
47061da546Spatrick   ScriptInterpreterPython(Debugger &debugger)
48061da546Spatrick       : ScriptInterpreter(debugger, lldb::eScriptLanguagePython),
49061da546Spatrick         IOHandlerDelegateMultiline("DONE") {}
50061da546Spatrick 
51061da546Spatrick   static void Initialize();
52061da546Spatrick   static void Terminate();
53061da546Spatrick   static lldb_private::ConstString GetPluginNameStatic();
54061da546Spatrick   static const char *GetPluginDescriptionStatic();
55061da546Spatrick   static FileSpec GetPythonDir();
56*be691f3bSpatrick   static void SharedLibraryDirectoryHelper(FileSpec &this_file);
57061da546Spatrick 
58061da546Spatrick protected:
59061da546Spatrick   static void ComputePythonDirForApple(llvm::SmallVectorImpl<char> &path);
60061da546Spatrick   static void ComputePythonDir(llvm::SmallVectorImpl<char> &path);
61061da546Spatrick };
62061da546Spatrick } // namespace lldb_private
63061da546Spatrick 
64061da546Spatrick #endif // LLDB_ENABLE_PYTHON
65061da546Spatrick #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
66