1 //===-- ScriptedProcessPythonInterface.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_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTEDPROCESSPYTHONINTERFACE_H 10 #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTEDPROCESSPYTHONINTERFACE_H 11 12 #include "lldb/Host/Config.h" 13 14 #if LLDB_ENABLE_PYTHON 15 16 #include "lldb/Interpreter/ScriptedProcessInterface.h" 17 18 namespace lldb_private { 19 class ScriptInterpreterPythonImpl; 20 class ScriptedProcessPythonInterface : public ScriptedProcessInterface { 21 public: 22 ScriptedProcessPythonInterface(ScriptInterpreterPythonImpl &interpreter) 23 : ScriptedProcessInterface(), m_interpreter(interpreter) {} 24 25 StructuredData::GenericSP 26 CreatePluginObject(const llvm::StringRef class_name, lldb::TargetSP target_sp, 27 StructuredData::DictionarySP args_sp) override; 28 29 Status Launch() override; 30 31 Status Resume() override; 32 33 lldb::MemoryRegionInfoSP 34 GetMemoryRegionContainingAddress(lldb::addr_t address) override; 35 36 StructuredData::DictionarySP GetThreadWithID(lldb::tid_t tid) override; 37 38 StructuredData::DictionarySP GetRegistersForThread(lldb::tid_t tid) override; 39 40 lldb::DataExtractorSP ReadMemoryAtAddress(lldb::addr_t address, size_t size, 41 Status &error) override; 42 43 StructuredData::DictionarySP GetLoadedImages() override; 44 45 lldb::pid_t GetProcessID() override; 46 47 bool IsAlive() override; 48 49 protected: 50 size_t GetGenericInteger(llvm::StringRef method_name); 51 Status LaunchOrResume(llvm::StringRef method_name); 52 53 private: 54 // The lifetime is managed by the ScriptInterpreter 55 ScriptInterpreterPythonImpl &m_interpreter; 56 StructuredData::GenericSP m_object_instance_sp; 57 }; 58 } // namespace lldb_private 59 60 #endif // LLDB_ENABLE_PYTHON 61 #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTEDPROCESSPYTHONINTERFACE_H 62