1//===-- ScriptedProcessInterface.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_INTERPRETER_INTERFACES_SCRIPTEDPROCESSINTERFACE_H
10#define LLDB_INTERPRETER_INTERFACES_SCRIPTEDPROCESSINTERFACE_H
11
12#include "ScriptedInterface.h"
13#include "lldb/Core/StructuredDataImpl.h"
14#include "lldb/Target/MemoryRegionInfo.h"
15
16#include "lldb/lldb-private.h"
17
18#include <optional>
19#include <string>
20
21namespace lldb_private {
22class ScriptedProcessInterface : virtual public ScriptedInterface {
23public:
24 virtual llvm::Expected<StructuredData::GenericSP>
25 CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx,
26 StructuredData::DictionarySP args_sp,
27 StructuredData::Generic *script_obj = nullptr) = 0;
28
29 virtual StructuredData::DictionarySP GetCapabilities() { return {}; }
30
31 virtual Status Attach(const ProcessAttachInfo &attach_info) {
32 return Status("ScriptedProcess did not attach");
33 }
34
35 virtual Status Launch() { return Status("ScriptedProcess did not launch"); }
36
37 virtual Status Resume() { return Status("ScriptedProcess did not resume"); }
38
39 virtual std::optional<MemoryRegionInfo>
40 GetMemoryRegionContainingAddress(lldb::addr_t address, Status &error) {
41 error.SetErrorString("ScriptedProcess have no memory region.");
42 return {};
43 }
44
45 virtual StructuredData::DictionarySP GetThreadsInfo() { return {}; }
46
47 virtual bool CreateBreakpoint(lldb::addr_t addr, Status &error) {
48 error.SetErrorString("ScriptedProcess don't support creating breakpoints.");
49 return {};
50 }
51
52 virtual lldb::DataExtractorSP
53 ReadMemoryAtAddress(lldb::addr_t address, size_t size, Status &error) {
54 return {};
55 }
56
57 virtual lldb::offset_t WriteMemoryAtAddress(lldb::addr_t addr,
58 lldb::DataExtractorSP data_sp,
59 Status &error) {
60 return LLDB_INVALID_OFFSET;
61 };
62
63 virtual StructuredData::ArraySP GetLoadedImages() { return {}; }
64
65 virtual lldb::pid_t GetProcessID() { return LLDB_INVALID_PROCESS_ID; }
66
67 virtual bool IsAlive() { return true; }
68
69 virtual std::optional<std::string> GetScriptedThreadPluginName() {
70 return std::nullopt;
71 }
72
73 virtual StructuredData::DictionarySP GetMetadata() { return {}; }
74
75protected:
76 friend class ScriptedThread;
77 virtual lldb::ScriptedThreadInterfaceSP CreateScriptedThreadInterface() {
78 return {};
79 }
80};
81} // namespace lldb_private
82
83#endif // LLDB_INTERPRETER_INTERFACES_SCRIPTEDPROCESSINTERFACE_H
84

source code of lldb/include/lldb/Interpreter/Interfaces/ScriptedProcessInterface.h