Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:49

0001 //===-- ScriptedProcessInterface.h ------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_INTERPRETER_INTERFACES_SCRIPTEDPROCESSINTERFACE_H
0010 #define LLDB_INTERPRETER_INTERFACES_SCRIPTEDPROCESSINTERFACE_H
0011 
0012 #include "ScriptedInterface.h"
0013 #include "lldb/Core/StructuredDataImpl.h"
0014 #include "lldb/Target/MemoryRegionInfo.h"
0015 
0016 #include "lldb/lldb-private.h"
0017 
0018 #include <optional>
0019 #include <string>
0020 
0021 namespace lldb_private {
0022 class ScriptedProcessInterface : virtual public ScriptedInterface {
0023 public:
0024   virtual llvm::Expected<StructuredData::GenericSP>
0025   CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx,
0026                      StructuredData::DictionarySP args_sp,
0027                      StructuredData::Generic *script_obj = nullptr) = 0;
0028 
0029   virtual StructuredData::DictionarySP GetCapabilities() { return {}; }
0030 
0031   virtual Status Attach(const ProcessAttachInfo &attach_info) {
0032     return Status::FromErrorString("ScriptedProcess did not attach");
0033   }
0034 
0035   virtual Status Launch() {
0036     return Status::FromErrorString("ScriptedProcess did not launch");
0037   }
0038 
0039   virtual Status Resume() {
0040     return Status::FromErrorString("ScriptedProcess did not resume");
0041   }
0042 
0043   virtual std::optional<MemoryRegionInfo>
0044   GetMemoryRegionContainingAddress(lldb::addr_t address, Status &error) {
0045     error = Status::FromErrorString("ScriptedProcess have no memory region.");
0046     return {};
0047   }
0048 
0049   virtual StructuredData::DictionarySP GetThreadsInfo() { return {}; }
0050 
0051   virtual bool CreateBreakpoint(lldb::addr_t addr, Status &error) {
0052     error = Status::FromErrorString(
0053         "ScriptedProcess don't support creating breakpoints.");
0054     return {};
0055   }
0056 
0057   virtual lldb::DataExtractorSP
0058   ReadMemoryAtAddress(lldb::addr_t address, size_t size, Status &error) {
0059     return {};
0060   }
0061 
0062   virtual lldb::offset_t WriteMemoryAtAddress(lldb::addr_t addr,
0063                                               lldb::DataExtractorSP data_sp,
0064                                               Status &error) {
0065     return LLDB_INVALID_OFFSET;
0066   };
0067 
0068   virtual StructuredData::ArraySP GetLoadedImages() { return {}; }
0069 
0070   virtual lldb::pid_t GetProcessID() { return LLDB_INVALID_PROCESS_ID; }
0071 
0072   virtual bool IsAlive() { return true; }
0073 
0074   virtual std::optional<std::string> GetScriptedThreadPluginName() {
0075     return std::nullopt;
0076   }
0077 
0078   virtual StructuredData::DictionarySP GetMetadata() { return {}; }
0079 
0080 protected:
0081   friend class ScriptedThread;
0082   virtual lldb::ScriptedThreadInterfaceSP CreateScriptedThreadInterface() {
0083     return {};
0084   }
0085 };
0086 } // namespace lldb_private
0087 
0088 #endif // LLDB_INTERPRETER_INTERFACES_SCRIPTEDPROCESSINTERFACE_H