10#include "lldb/Host/Config.h"
18#include "../lldb-python.h"
21#include "../SWIGPythonBridge.h"
22#include "../ScriptInterpreterPythonImpl.h"
29ScriptedThreadPlanPythonInterface::ScriptedThreadPlanPythonInterface(
30 ScriptInterpreterPythonImpl &interpreter)
33llvm::Expected<StructuredData::GenericSP>
34ScriptedThreadPlanPythonInterface::CreatePluginObject(
37 return ScriptedPythonInterface::CreatePluginObject(class_name,
nullptr,
38 thread_plan_sp, args_sp);
42ScriptedThreadPlanPythonInterface::ExplainsStop(
Event *event) {
46 if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj,
50 return error.ToError();
53 return obj->GetBooleanValue();
57ScriptedThreadPlanPythonInterface::ShouldStop(
Event *event) {
61 if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj,
65 return error.ToError();
68 return obj->GetBooleanValue();
71llvm::Expected<bool> ScriptedThreadPlanPythonInterface::IsStale() {
75 if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj,
79 return error.ToError();
82 return obj->GetBooleanValue();
89 if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj,
98ScriptedThreadPlanPythonInterface::GetStopDescription(
lldb::StreamSP &stream) {
100 Dispatch(
"stop_description",
error, stream);
103 return error.ToError();
105 return llvm::Error::success();
108void ScriptedThreadPlanPythonInterface::Initialize() {
109 const std::vector<llvm::StringRef> ci_usages = {
110 "thread step-scripted -C <script-name> [-k key -v value ...]"};
111 const std::vector<llvm::StringRef> api_usages = {
112 "SBThread.StepUsingScriptedThreadPlan"};
113 PluginManager::RegisterPlugin(
114 GetPluginNameStatic(),
115 llvm::StringRef(
"Alter thread stepping logic and stop reason"),
116 CreateInstance, eScriptLanguagePython, {ci_usages, api_usages});
119void ScriptedThreadPlanPythonInterface::Terminate() {
120 PluginManager::UnregisterPlugin(CreateInstance);
static llvm::raw_ostream & error(Stream &strm)
std::shared_ptr< Object > ObjectSP
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
StateType
Process and Thread States.
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
std::shared_ptr< lldb_private::Stream > StreamSP