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_SCRIPTEDPROCESSINTERFACE_H
10 #define LLDB_INTERPRETER_SCRIPTEDPROCESSINTERFACE_H
11 
15 
16 #include "lldb/lldb-private.h"
17 
18 #include <string>
19 
20 namespace lldb_private {
22 public:
24  CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx,
26  StructuredData::Generic *script_obj = nullptr) override {
27  return nullptr;
28  }
29 
30  virtual Status Launch() { return Status("ScriptedProcess did not launch"); }
31 
32  virtual Status Resume() { return Status("ScriptedProcess did not resume"); }
33 
34  virtual bool ShouldStop() { return true; }
35 
36  virtual Status Stop() { return Status("ScriptedProcess did not stop"); }
37 
38  virtual llvm::Optional<MemoryRegionInfo>
40  error.SetErrorString("ScriptedProcess have no memory region.");
41  return {};
42  }
43 
44  virtual StructuredData::DictionarySP GetThreadsInfo() { return nullptr; }
45 
47  return nullptr;
48  }
49 
51  return nullptr;
52  }
53 
54  virtual lldb::DataExtractorSP
55  ReadMemoryAtAddress(lldb::addr_t address, size_t size, Status &error) {
56  return nullptr;
57  }
58 
59  virtual StructuredData::ArraySP GetLoadedImages() { return nullptr; }
60 
62 
63  virtual bool IsAlive() { return true; }
64 
65  virtual llvm::Optional<std::string> GetScriptedThreadPluginName() {
66  return llvm::None;
67  }
68 
69 protected:
70  friend class ScriptedThread;
71  virtual lldb::ScriptedThreadInterfaceSP CreateScriptedThreadInterface() {
72  return nullptr;
73  }
74 };
75 
77 public:
79  CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx,
81  StructuredData::Generic *script_obj = nullptr) override {
82  return nullptr;
83  }
84 
86 
87  virtual llvm::Optional<std::string> GetName() { return llvm::None; }
88 
90 
91  virtual llvm::Optional<std::string> GetQueue() { return llvm::None; }
92 
93  virtual StructuredData::DictionarySP GetStopReason() { return nullptr; }
94 
95  virtual StructuredData::ArraySP GetStackFrames() { return nullptr; }
96 
97  virtual StructuredData::DictionarySP GetRegisterInfo() { return nullptr; }
98 
99  virtual llvm::Optional<std::string> GetRegisterContext() {
100  return llvm::None;
101  }
102 };
103 } // namespace lldb_private
104 
105 #endif // LLDB_INTERPRETER_SCRIPTEDPROCESSINTERFACE_H
lldb_private::ScriptedProcessInterface::GetLoadedImages
virtual StructuredData::ArraySP GetLoadedImages()
Definition: ScriptedProcessInterface.h:59
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::ScriptedThreadInterface::GetThreadID
virtual lldb::tid_t GetThreadID()
Definition: ScriptedProcessInterface.h:85
lldb_private::ScriptedThreadInterface::GetState
virtual lldb::StateType GetState()
Definition: ScriptedProcessInterface.h:89
lldb_private::ScriptedThreadInterface::GetQueue
virtual llvm::Optional< std::string > GetQueue()
Definition: ScriptedProcessInterface.h:91
LLDB_INVALID_PROCESS_ID
#define LLDB_INVALID_PROCESS_ID
Definition: lldb-defines.h:81
lldb_private::StructuredData::GenericSP
std::shared_ptr< Generic > GenericSP
Definition: StructuredData.h:68
lldb_private::ScriptedProcessInterface::CreatePluginObject
StructuredData::GenericSP CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, StructuredData::Generic *script_obj=nullptr) override
Definition: ScriptedProcessInterface.h:24
lldb_private::ScriptedProcessInterface::GetScriptedThreadPluginName
virtual llvm::Optional< std::string > GetScriptedThreadPluginName()
Definition: ScriptedProcessInterface.h:65
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::ScriptedProcessInterface::GetMemoryRegionContainingAddress
virtual llvm::Optional< MemoryRegionInfo > GetMemoryRegionContainingAddress(lldb::addr_t address, Status &error)
Definition: ScriptedProcessInterface.h:39
lldb_private::ScriptedThreadInterface::CreatePluginObject
StructuredData::GenericSP CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp, StructuredData::Generic *script_obj=nullptr) override
Definition: ScriptedProcessInterface.h:79
lldb_private::ScriptedThreadInterface::GetRegisterInfo
virtual StructuredData::DictionarySP GetRegisterInfo()
Definition: ScriptedProcessInterface.h:97
lldb_private::ScriptedThreadInterface::GetName
virtual llvm::Optional< std::string > GetName()
Definition: ScriptedProcessInterface.h:87
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::ScriptedProcessInterface::GetProcessID
virtual lldb::pid_t GetProcessID()
Definition: ScriptedProcessInterface.h:61
MemoryRegionInfo.h
lldb_private::ScriptedProcessInterface::ReadMemoryAtAddress
virtual lldb::DataExtractorSP ReadMemoryAtAddress(lldb::addr_t address, size_t size, Status &error)
Definition: ScriptedProcessInterface.h:55
lldb_private::ScriptedProcessInterface::GetThreadsInfo
virtual StructuredData::DictionarySP GetThreadsInfo()
Definition: ScriptedProcessInterface.h:44
lldb_private::ScriptedProcessInterface::Launch
virtual Status Launch()
Definition: ScriptedProcessInterface.h:30
lldb_private::ScriptedProcessInterface::Resume
virtual Status Resume()
Definition: ScriptedProcessInterface.h:32
lldb_private::StructuredData::DictionarySP
std::shared_ptr< Dictionary > DictionarySP
Definition: StructuredData.h:67
lldb_private::ScriptedThreadInterface
Definition: ScriptedProcessInterface.h:76
ScriptedInterface.h
lldb_private::StructuredData::Generic
Definition: StructuredData.h:543
lldb_private::ScriptedProcessInterface::GetRegistersForThread
virtual StructuredData::DictionarySP GetRegistersForThread(lldb::tid_t tid)
Definition: ScriptedProcessInterface.h:50
lldb-private.h
lldb_private::ScriptedProcessInterface::CreateScriptedThreadInterface
virtual lldb::ScriptedThreadInterfaceSP CreateScriptedThreadInterface()
Definition: ScriptedProcessInterface.h:71
lldb_private::ScriptedProcessInterface::IsAlive
virtual bool IsAlive()
Definition: ScriptedProcessInterface.h:63
lldb_private::Status
Definition: Status.h:44
lldb_private::ScriptedProcessInterface::Stop
virtual Status Stop()
Definition: ScriptedProcessInterface.h:36
lldb_private::ScriptedInterface
Definition: ScriptedInterface.h:23
lldb_private::ScriptedProcessInterface
Definition: ScriptedProcessInterface.h:21
lldb::pid_t
uint64_t pid_t
Definition: lldb-types.h:85
StructuredDataImpl.h
lldb_private::ScriptedProcessInterface::GetThreadWithID
virtual StructuredData::DictionarySP GetThreadWithID(lldb::tid_t tid)
Definition: ScriptedProcessInterface.h:46
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::ScriptedThreadInterface::GetStopReason
virtual StructuredData::DictionarySP GetStopReason()
Definition: ScriptedProcessInterface.h:93
lldb_private::ScriptedThread
Definition: ScriptedThread.h:27
lldb_private::ScriptedProcessInterface::ShouldStop
virtual bool ShouldStop()
Definition: ScriptedProcessInterface.h:34
lldb::eStateInvalid
@ eStateInvalid
Definition: lldb-enumerations.h:74
LLDB_INVALID_THREAD_ID
#define LLDB_INVALID_THREAD_ID
Definition: lldb-defines.h:82
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
lldb_private::StructuredData::ArraySP
std::shared_ptr< Array > ArraySP
Definition: StructuredData.h:62
lldb_private::ScriptedThreadInterface::GetRegisterContext
virtual llvm::Optional< std::string > GetRegisterContext()
Definition: ScriptedProcessInterface.h:99
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86
lldb_private::ScriptedThreadInterface::GetStackFrames
virtual StructuredData::ArraySP GetStackFrames()
Definition: ScriptedProcessInterface.h:95