LLDB  mainline
ScriptInterpreterPython.h
Go to the documentation of this file.
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 
17 #include "lldb/Core/IOHandler.h"
20 #include "lldb/lldb-private.h"
21 
22 #include <memory>
23 #include <string>
24 #include <vector>
25 
26 namespace lldb_private {
27 /// Abstract interface for the Python script interpreter.
28 class ScriptInterpreterPython : public ScriptInterpreter,
29  public IOHandlerDelegateMultiline {
30 public:
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_up(new StructuredDataImpl()) {
39  interpreter = lldb::eScriptLanguagePython;
40  m_extra_args_up->SetObjectSP(extra_args_sp);
41  }
42  lldb::StructuredDataImplUP m_extra_args_up;
43  };
44 
45  ScriptInterpreterPython(Debugger &debugger)
46  : ScriptInterpreter(debugger, lldb::eScriptLanguagePython),
47  IOHandlerDelegateMultiline("DONE") {}
48 
49  StructuredData::DictionarySP GetInterpreterInfo() override;
50  static void Initialize();
51  static void Terminate();
52  static llvm::StringRef GetPluginNameStatic() { return "script-python"; }
53  static llvm::StringRef GetPluginDescriptionStatic();
54  static FileSpec GetPythonDir();
55  static void SharedLibraryDirectoryHelper(FileSpec &this_file);
56 
57 protected:
58  static void ComputePythonDirForApple(llvm::SmallVectorImpl<char> &path);
59  static void ComputePythonDir(llvm::SmallVectorImpl<char> &path);
60 };
61 } // namespace lldb_private
62 
63 #endif // LLDB_ENABLE_PYTHON
64 #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
IOHandler.h
lldb_private::StructuredData::ObjectSP
std::shared_ptr< Object > ObjectSP
Definition: StructuredData.h:59
lldb::eScriptLanguagePython
@ eScriptLanguagePython
Definition: lldb-enumerations.h:218
lldb_private::StructuredData::DictionarySP
std::shared_ptr< Dictionary > DictionarySP
Definition: StructuredData.h:67
BreakpointOptions.h
lldb-private.h
StructuredDataImpl.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
llvm::SmallVectorImpl
Definition: Disassembler.h:42
ScriptInterpreter.h
lldb
Definition: SBAddress.h:15