[docs] Add guide about Undefined Behavior (#119220)
[llvm-project.git] / lldb / source / Plugins / ScriptInterpreter / Python / ScriptInterpreterPython.h
blob2e8301a85eb6c4dc69f6c38de160f657f79ebea7
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 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
10 #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
12 #include "lldb/Host/Config.h"
14 #if LLDB_ENABLE_PYTHON
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"
22 #include <memory>
23 #include <string>
24 #include <vector>
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;
36 CommandDataPython(StructuredData::ObjectSP extra_args_sp)
37 : BreakpointOptions::CommandData(),
38 m_extra_args(std::move(extra_args_sp)) {
39 interpreter = lldb::eScriptLanguagePython;
41 StructuredDataImpl m_extra_args;
44 ScriptInterpreterPython(Debugger &debugger)
45 : ScriptInterpreter(debugger, lldb::eScriptLanguagePython),
46 IOHandlerDelegateMultiline("DONE") {}
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);
56 protected:
57 static void ComputePythonDirForApple(llvm::SmallVectorImpl<char> &path);
58 static void ComputePythonDir(llvm::SmallVectorImpl<char> &path);
60 } // namespace lldb_private
62 #endif // LLDB_ENABLE_PYTHON
63 #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H