LLDB mainline
ScriptedProcessPythonInterface.h
Go to the documentation of this file.
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"
14
15#if LLDB_ENABLE_PYTHON
16
18
19#include <optional>
20
21namespace lldb_private {
22class ScriptedProcessPythonInterface : public ScriptedProcessInterface,
23 public ScriptedPythonInterface,
24 public PluginInterface {
25public:
26 ScriptedProcessPythonInterface(ScriptInterpreterPythonImpl &interpreter);
27
28 llvm::Expected<StructuredData::GenericSP>
29 CreatePluginObject(const llvm::StringRef class_name,
30 ExecutionContext &exe_ctx,
31 StructuredData::DictionarySP args_sp,
32 StructuredData::Generic *script_obj = nullptr) override;
33
34 llvm::SmallVector<llvm::StringLiteral> GetAbstractMethods() const override {
35 return llvm::SmallVector<llvm::StringLiteral>(
36 {"read_memory_at_address", "is_alive", "get_scripted_thread_plugin"});
37 }
38
39 StructuredData::DictionarySP GetCapabilities() override;
40
41 Status Attach(const ProcessAttachInfo &attach_info) override;
42
43 Status Launch() override;
44
45 Status Resume() override;
46
47 std::optional<MemoryRegionInfo>
48 GetMemoryRegionContainingAddress(lldb::addr_t address,
49 Status &error) override;
50
51 StructuredData::DictionarySP GetThreadsInfo() override;
52
53 bool CreateBreakpoint(lldb::addr_t addr, Status &error) override;
54
55 lldb::DataExtractorSP ReadMemoryAtAddress(lldb::addr_t address, size_t size,
56 Status &error) override;
57
58 lldb::offset_t WriteMemoryAtAddress(lldb::addr_t addr,
60 Status &error) override;
61
62 StructuredData::ArraySP GetLoadedImages() override;
63
64 lldb::pid_t GetProcessID() override;
65
66 bool IsAlive() override;
67
68 std::optional<std::string> GetScriptedThreadPluginName() override;
69
70 StructuredData::DictionarySP GetMetadata() override;
71
72 static void Initialize();
73
74 static void Terminate();
75
76 static llvm::StringRef GetPluginNameStatic() {
77 return "ScriptedProcessPythonInterface";
78 }
79
80 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
81
82private:
83 lldb::ScriptedThreadInterfaceSP CreateScriptedThreadInterface() override;
84};
85} // namespace lldb_private
86
87#endif // LLDB_ENABLE_PYTHON
88#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_INTERFACES_SCRIPTEDPROCESSPYTHONINTERFACE_H
static llvm::raw_ostream & error(Stream &strm)
A class that represents a running process on the host machine.
uint64_t offset_t
Definition: lldb-types.h:85
std::shared_ptr< lldb_private::ScriptedThreadInterface > ScriptedThreadInterfaceSP
Definition: lldb-forward.h:411
uint64_t pid_t
Definition: lldb-types.h:83
uint64_t addr_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::DataExtractor > DataExtractorSP
Definition: lldb-forward.h:336