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 
16 
17 #include "lldb/lldb-private.h"
18 
19 #include <string>
20 
21 namespace lldb_private {
23 public:
25  CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx,
26  StructuredData::DictionarySP args_sp) 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 
45  return nullptr;
46  }
47 
49  return nullptr;
50  }
51 
52  virtual lldb::DataExtractorSP
53  ReadMemoryAtAddress(lldb::addr_t address, size_t size, Status &error) {
54  return nullptr;
55  }
56 
57  virtual StructuredData::DictionarySP GetLoadedImages() { return nullptr; }
58 
60 
61  virtual bool IsAlive() { return true; }
62 
63  virtual llvm::Optional<std::string> GetScriptedThreadPluginName() {
64  return llvm::None;
65  }
66 
67 protected:
68  friend class ScriptedThread;
69  virtual lldb::ScriptedThreadInterfaceSP GetScriptedThreadInterface() {
70  return nullptr;
71  }
72 
73  lldb::ScriptedThreadInterfaceSP m_scripted_thread_interface_sp = nullptr;
74 };
75 
77 public:
79  CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx,
80  StructuredData::DictionarySP args_sp) override {
81  return nullptr;
82  }
83 
85 
86  virtual llvm::Optional<std::string> GetName() { return llvm::None; }
87 
89 
90  virtual llvm::Optional<std::string> GetQueue() { return llvm::None; }
91 
92  virtual StructuredData::DictionarySP GetStopReason() { return nullptr; }
93 
94  virtual StructuredData::ArraySP GetStackFrames() { return nullptr; }
95 
96  virtual StructuredData::DictionarySP GetRegisterInfo() { return nullptr; }
97 
98  virtual llvm::Optional<std::string> GetRegisterContext() {
99  return llvm::None;
100  }
101 };
102 } // namespace lldb_private
103 
104 #endif // LLDB_INTERPRETER_SCRIPTEDPROCESSINTERFACE_H
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::ScriptedThreadInterface::GetThreadID
virtual lldb::tid_t GetThreadID()
Definition: ScriptedProcessInterface.h:84
lldb_private::ScriptedThreadInterface::GetState
virtual lldb::StateType GetState()
Definition: ScriptedProcessInterface.h:88
lldb_private::ScriptedThreadInterface::GetQueue
virtual llvm::Optional< std::string > GetQueue()
Definition: ScriptedProcessInterface.h:90
LLDB_INVALID_PROCESS_ID
#define LLDB_INVALID_PROCESS_ID
Definition: lldb-defines.h:93
lldb_private::StructuredData::GenericSP
std::shared_ptr< Generic > GenericSP
Definition: StructuredData.h:68
lldb_private::ScriptedProcessInterface::m_scripted_thread_interface_sp
lldb::ScriptedThreadInterfaceSP m_scripted_thread_interface_sp
Definition: ScriptedProcessInterface.h:73
lldb_private::ScriptedProcessInterface::GetScriptedThreadPluginName
virtual llvm::Optional< std::string > GetScriptedThreadPluginName()
Definition: ScriptedProcessInterface.h:63
lldb_private::ScriptedProcessInterface::GetLoadedImages
virtual StructuredData::DictionarySP GetLoadedImages()
Definition: ScriptedProcessInterface.h:57
lldb_private::ScriptedProcessInterface::CreatePluginObject
StructuredData::GenericSP CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp) override
Definition: ScriptedProcessInterface.h:25
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::GetRegisterInfo
virtual StructuredData::DictionarySP GetRegisterInfo()
Definition: ScriptedProcessInterface.h:96
lldb_private::ScriptedThreadInterface::GetName
virtual llvm::Optional< std::string > GetName()
Definition: ScriptedProcessInterface.h:86
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::ScriptedProcessInterface::GetProcessID
virtual lldb::pid_t GetProcessID()
Definition: ScriptedProcessInterface.h:59
MemoryRegionInfo.h
lldb_private::ScriptedProcessInterface::ReadMemoryAtAddress
virtual lldb::DataExtractorSP ReadMemoryAtAddress(lldb::addr_t address, size_t size, Status &error)
Definition: ScriptedProcessInterface.h:53
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::ScriptedProcessInterface::GetRegistersForThread
virtual StructuredData::DictionarySP GetRegistersForThread(lldb::tid_t tid)
Definition: ScriptedProcessInterface.h:48
lldb_private::ScriptedThreadInterface::CreatePluginObject
StructuredData::GenericSP CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx, StructuredData::DictionarySP args_sp) override
Definition: ScriptedProcessInterface.h:79
lldb-private.h
lldb_private::ScriptedProcessInterface::IsAlive
virtual bool IsAlive()
Definition: ScriptedProcessInterface.h:61
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:22
lldb::pid_t
uint64_t pid_t
Definition: lldb-types.h:85
lldb_private::ScriptedProcessInterface::GetScriptedThreadInterface
virtual lldb::ScriptedThreadInterfaceSP GetScriptedThreadInterface()
Definition: ScriptedProcessInterface.h:69
StructuredDataImpl.h
lldb_private::ScriptedProcessInterface::GetThreadWithID
virtual StructuredData::DictionarySP GetThreadWithID(lldb::tid_t tid)
Definition: ScriptedProcessInterface.h:44
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:92
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:94
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
ScriptInterpreter.h
lldb_private::ScriptedThreadInterface::GetRegisterContext
virtual llvm::Optional< std::string > GetRegisterContext()
Definition: ScriptedProcessInterface.h:98
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86
lldb_private::ScriptedThreadInterface::GetStackFrames
virtual StructuredData::ArraySP GetStackFrames()
Definition: ScriptedProcessInterface.h:94