LLDB mainline
ScriptedProcessInterface.h
Go to the documentation of this file.
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"
15
16#include "lldb/lldb-private.h"
17
18#include <optional>
19#include <string>
20
21namespace lldb_private {
23public:
24 virtual llvm::Expected<StructuredData::GenericSP>
25 CreatePluginObject(const ScriptedMetadata &scripted_metadata,
26 ExecutionContext &exe_ctx,
27 StructuredData::Generic *script_obj = nullptr) = 0;
28
30
31 /// The number of bits this process uses for addressing, as a dictionary
32 /// with optional "lowmem" and "highmem" keys.
34
35 virtual Status Attach(const ProcessAttachInfo &attach_info) {
36 return Status::FromErrorString("ScriptedProcess did not attach");
37 }
38
39 virtual Status Launch() {
40 return Status::FromErrorString("ScriptedProcess did not launch");
41 }
42
43 virtual Status Resume() {
44 return Status::FromErrorString("ScriptedProcess did not resume");
45 }
46
47 virtual std::optional<MemoryRegionInfo>
49 error = Status::FromErrorString("ScriptedProcess have no memory region.");
50 return {};
51 }
52
54
57 "ScriptedProcess don't support creating breakpoints.");
58 return {};
59 }
60
62 ReadMemoryAtAddress(lldb::addr_t address, size_t size, Status &error) {
63 return {};
64 }
65
71
73
75
76 virtual bool IsAlive() { return true; }
77
78 virtual std::optional<std::string> GetScriptedThreadPluginName() {
79 return std::nullopt;
80 }
81
83
84protected:
85 friend class ScriptedThread;
89};
90} // namespace lldb_private
91
92#endif // LLDB_INTERPRETER_INTERFACES_SCRIPTEDPROCESSINTERFACE_H
static llvm::raw_ostream & error(Stream &strm)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
virtual lldb::DataExtractorSP ReadMemoryAtAddress(lldb::addr_t address, size_t size, Status &error)
virtual lldb::ScriptedThreadInterfaceSP CreateScriptedThreadInterface()
virtual StructuredData::DictionarySP GetThreadsInfo()
virtual StructuredData::DictionarySP GetCapabilities()
virtual std::optional< std::string > GetScriptedThreadPluginName()
virtual Status Attach(const ProcessAttachInfo &attach_info)
virtual StructuredData::DictionarySP GetAddressableBits()
The number of bits this process uses for addressing, as a dictionary with optional "lowmem" and "high...
virtual bool CreateBreakpoint(lldb::addr_t addr, Status &error)
virtual StructuredData::DictionarySP GetMetadata()
virtual StructuredData::ArraySP GetLoadedImages()
virtual lldb::offset_t WriteMemoryAtAddress(lldb::addr_t addr, lldb::DataExtractorSP data_sp, Status &error)
virtual llvm::Expected< StructuredData::GenericSP > CreatePluginObject(const ScriptedMetadata &scripted_metadata, ExecutionContext &exe_ctx, StructuredData::Generic *script_obj=nullptr)=0
virtual std::optional< MemoryRegionInfo > GetMemoryRegionContainingAddress(lldb::addr_t address, Status &error)
An error handling class.
Definition Status.h:118
static Status FromErrorString(const char *str)
Definition Status.h:141
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Array > ArraySP
#define LLDB_INVALID_OFFSET
#define LLDB_INVALID_PROCESS_ID
A class that represents a running process on the host machine.
uint64_t offset_t
Definition lldb-types.h:86
std::shared_ptr< lldb_private::ScriptedThreadInterface > ScriptedThreadInterfaceSP
uint64_t pid_t
Definition lldb-types.h:84
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::DataExtractor > DataExtractorSP