10#include "lldb/Host/Config.h"
30using Locker = ScriptInterpreterPythonImpl::Locker;
32ScriptedPlatformPythonInterface::ScriptedPlatformPythonInterface(
33 ScriptInterpreterPythonImpl &interpreter)
36llvm::Expected<StructuredData::GenericSP>
37ScriptedPlatformPythonInterface::CreatePluginObject(
41 std::make_shared<ExecutionContextRef>(exe_ctx);
43 return ScriptedPythonInterface::CreatePluginObject(class_name, script_obj,
44 exe_ctx_ref_sp, sd_impl);
50 Dispatch<StructuredData::DictionarySP>(
"list_processes",
error);
52 if (!dict_sp || !dict_sp->IsValid() ||
error.Fail()) {
55 llvm::Twine(
"Null or invalid object (" +
56 llvm::Twine(
error.AsCString()) + llvm::Twine(
")."))
65ScriptedPlatformPythonInterface::GetProcessInfo(
lldb::pid_t pid) {
68 Dispatch<StructuredData::DictionarySP>(
"get_process_info",
error, pid);
70 if (!dict_sp || !dict_sp->IsValid() ||
error.Fail()) {
73 llvm::Twine(
"Null or invalid object (" +
74 llvm::Twine(
error.AsCString()) + llvm::Twine(
")."))
82Status ScriptedPlatformPythonInterface::AttachToProcess(
85 return GetStatusFromMethod(
"attach_to_process");
88Status ScriptedPlatformPythonInterface::LaunchProcess(
91 return GetStatusFromMethod(
"launch_process");
95 return GetStatusFromMethod(
"kill_process", pid);
98void ScriptedPlatformPythonInterface::Initialize() {
100 GetPluginNameStatic(),
"Mock platform and interact with its processes.",
104void ScriptedPlatformPythonInterface::Terminate() {
static llvm::raw_ostream & error(Stream &strm)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
static Ret ErrorWithMessage(llvm::StringRef caller_name, llvm::StringRef error_msg, Status &error, LLDBLog log_category=LLDBLog::Process)
std::shared_ptr< Dictionary > DictionarySP
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ProcessAttachInfo > ProcessAttachInfoSP
std::shared_ptr< lldb_private::ProcessLaunchInfo > ProcessLaunchInfoSP
std::shared_ptr< lldb_private::ExecutionContextRef > ExecutionContextRefSP