10#include "lldb/Host/Config.h"
19#include "../lldb-python.h"
22#include "../SWIGPythonBridge.h"
23#include "../ScriptInterpreterPythonImpl.h"
29using Locker = ScriptInterpreterPythonImpl::Locker;
31OperatingSystemPythonInterface::OperatingSystemPythonInterface(
32 ScriptInterpreterPythonImpl &interpreter)
35llvm::Expected<StructuredData::GenericSP>
36OperatingSystemPythonInterface::CreatePluginObject(
39 return ScriptedPythonInterface::CreatePluginObject(class_name,
nullptr,
44OperatingSystemPythonInterface::CreateThread(
lldb::tid_t tid,
48 "create_thread",
error, tid, context);
50 if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, dict,
60 Dispatch<StructuredData::ArraySP>(
"get_thread_info",
error);
62 if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, arr,
70 return ScriptedThreadPythonInterface::GetRegisterInfo();
73std::optional<std::string>
74OperatingSystemPythonInterface::GetRegisterContextForTID(
lldb::tid_t tid) {
78 if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj,
82 return obj->GetAsString()->GetValue().str();
85void OperatingSystemPythonInterface::Initialize() {
86 const std::vector<llvm::StringRef> ci_usages = {
87 "settings set target.process.python-os-plugin-path <script-path>",
88 "settings set process.experimental.os-plugin-reports-all-threads [0/1]"};
89 const std::vector<llvm::StringRef> api_usages = {};
90 PluginManager::RegisterPlugin(
91 GetPluginNameStatic(), llvm::StringRef(
"Mock thread state"),
92 CreateInstance, eScriptLanguagePython, {ci_usages, api_usages});
95void OperatingSystemPythonInterface::Terminate() {
96 PluginManager::UnregisterPlugin(CreateInstance);
static llvm::raw_ostream & error(Stream &strm)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
const lldb::ProcessSP & GetProcessSP() const
Get accessor to get the process shared pointer.
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
std::shared_ptr< Array > ArraySP
A class that represents a running process on the host machine.