1 //===-- ScriptedProcessPythonInterface.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_INTERFACES_SCRIPTEDPROCESSPYTHONINTERFACE_H
10 #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_SCRIPTEDPROCESSPYTHONINTERFACE_H
11 
12 #include "lldb/Host/Config.h"
13 
14 #if LLDB_ENABLE_PYTHON
15 
16 #include "ScriptedPythonInterface.h"
17 #include "lldb/Interpreter/Interfaces/ScriptedProcessInterface.h"
18 #include <optional>
19 
20 namespace lldb_private {
21 class ScriptedProcessPythonInterface : public ScriptedProcessInterface,
22                                        public ScriptedPythonInterface {
23 public:
24   ScriptedProcessPythonInterface(ScriptInterpreterPythonImpl &interpreter);
25 
26   llvm::Expected<StructuredData::GenericSP>
27   CreatePluginObject(const llvm::StringRef class_name,
28                      ExecutionContext &exe_ctx,
29                      StructuredData::DictionarySP args_sp,
30                      StructuredData::Generic *script_obj = nullptr) override;
31 
32   StructuredData::DictionarySP GetCapabilities() override;
33 
34   Status Attach(const ProcessAttachInfo &attach_info) override;
35 
36   Status Launch() override;
37 
38   Status Resume() override;
39 
40   std::optional<MemoryRegionInfo>
41   GetMemoryRegionContainingAddress(lldb::addr_t address,
42                                    Status &error) override;
43 
44   StructuredData::DictionarySP GetThreadsInfo() override;
45 
46   bool CreateBreakpoint(lldb::addr_t addr, Status &error) override;
47 
48   lldb::DataExtractorSP ReadMemoryAtAddress(lldb::addr_t address, size_t size,
49                                             Status &error) override;
50 
51   lldb::offset_t WriteMemoryAtAddress(lldb::addr_t addr,
52                                       lldb::DataExtractorSP data_sp,
53                                       Status &error) override;
54 
55   StructuredData::ArraySP GetLoadedImages() override;
56 
57   lldb::pid_t GetProcessID() override;
58 
59   bool IsAlive() override;
60 
61   std::optional<std::string> GetScriptedThreadPluginName() override;
62 
63   StructuredData::DictionarySP GetMetadata() override;
64 
65 private:
66   lldb::ScriptedThreadInterfaceSP CreateScriptedThreadInterface() override;
67 };
68 } // namespace lldb_private
69 
70 #endif // LLDB_ENABLE_PYTHON
71 #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_SCRIPTEDPROCESSPYTHONINTERFACE_H
72