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 12 #include "lldb/Core/StructuredDataImpl.h" 13 #include "lldb/Interpreter/ScriptedInterface.h" 14 #include "lldb/Target/MemoryRegionInfo.h" 15 16 #include "lldb/lldb-private.h" 17 18 #include <optional> 19 #include <string> 20 21 namespace lldb_private { 22 class ScriptedProcessInterface : virtual public ScriptedInterface { 23 public: 24 StructuredData::GenericSP 25 CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx, 26 StructuredData::DictionarySP args_sp, 27 StructuredData::Generic *script_obj = nullptr) override { 28 return {}; 29 } 30 Launch()31 virtual Status Launch() { return Status("ScriptedProcess did not launch"); } 32 Resume()33 virtual Status Resume() { return Status("ScriptedProcess did not resume"); } 34 ShouldStop()35 virtual bool ShouldStop() { return true; } 36 Stop()37 virtual Status Stop() { return Status("ScriptedProcess did not stop"); } 38 39 virtual std::optional<MemoryRegionInfo> GetMemoryRegionContainingAddress(lldb::addr_t address,Status & error)40 GetMemoryRegionContainingAddress(lldb::addr_t address, Status &error) { 41 error.SetErrorString("ScriptedProcess have no memory region."); 42 return {}; 43 } 44 GetThreadsInfo()45 virtual StructuredData::DictionarySP GetThreadsInfo() { return {}; } 46 GetThreadWithID(lldb::tid_t tid)47 virtual StructuredData::DictionarySP GetThreadWithID(lldb::tid_t tid) { 48 return {}; 49 } 50 GetRegistersForThread(lldb::tid_t tid)51 virtual StructuredData::DictionarySP GetRegistersForThread(lldb::tid_t tid) { 52 return {}; 53 } 54 55 virtual lldb::DataExtractorSP ReadMemoryAtAddress(lldb::addr_t address,size_t size,Status & error)56 ReadMemoryAtAddress(lldb::addr_t address, size_t size, Status &error) { 57 return {}; 58 } 59 GetLoadedImages()60 virtual StructuredData::ArraySP GetLoadedImages() { return {}; } 61 GetProcessID()62 virtual lldb::pid_t GetProcessID() { return LLDB_INVALID_PROCESS_ID; } 63 IsAlive()64 virtual bool IsAlive() { return true; } 65 GetScriptedThreadPluginName()66 virtual std::optional<std::string> GetScriptedThreadPluginName() { 67 return std::nullopt; 68 } 69 GetMetadata()70 virtual StructuredData::DictionarySP GetMetadata() { return {}; } 71 72 protected: 73 friend class ScriptedThread; CreateScriptedThreadInterface()74 virtual lldb::ScriptedThreadInterfaceSP CreateScriptedThreadInterface() { 75 return {}; 76 } 77 }; 78 79 class ScriptedThreadInterface : virtual public ScriptedInterface { 80 public: 81 StructuredData::GenericSP 82 CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx, 83 StructuredData::DictionarySP args_sp, 84 StructuredData::Generic *script_obj = nullptr) override { 85 return {}; 86 } 87 GetThreadID()88 virtual lldb::tid_t GetThreadID() { return LLDB_INVALID_THREAD_ID; } 89 GetName()90 virtual std::optional<std::string> GetName() { return std::nullopt; } 91 GetState()92 virtual lldb::StateType GetState() { return lldb::eStateInvalid; } 93 GetQueue()94 virtual std::optional<std::string> GetQueue() { return std::nullopt; } 95 GetStopReason()96 virtual StructuredData::DictionarySP GetStopReason() { return {}; } 97 GetStackFrames()98 virtual StructuredData::ArraySP GetStackFrames() { return {}; } 99 GetRegisterInfo()100 virtual StructuredData::DictionarySP GetRegisterInfo() { return {}; } 101 GetRegisterContext()102 virtual std::optional<std::string> GetRegisterContext() { 103 return std::nullopt; 104 } 105 GetExtendedInfo()106 virtual StructuredData::ArraySP GetExtendedInfo() { return {}; } 107 }; 108 } // namespace lldb_private 109 110 #endif // LLDB_INTERPRETER_SCRIPTEDPROCESSINTERFACE_H 111