64 error->Printf(
"Error constructing Python ThreadPlan: %s",
74 return m_process.GetTarget().GetDebugger().GetScriptInterpreter();
79 return m_interface->GetScriptedMetadata()->GetClassName();
89 this->shared_from_this());
91 m_error_str = llvm::toString(obj_or_err.takeError());
102 bool should_stop =
true;
104 auto should_stop_or_err =
m_interface->ShouldStop(event_ptr);
105 if (!should_stop_or_err) {
107 "Can't call ScriptedThreadPlan::ShouldStop.");
110 should_stop = *should_stop_or_err;
119 bool is_stale =
true;
122 if (!is_stale_or_err) {
124 "Can't call ScriptedThreadPlan::IsStale.");
127 is_stale = *is_stale_or_err;
136 bool explains_stop =
true;
138 auto explains_stop_or_error =
m_interface->ExplainsStop(event_ptr);
139 if (!explains_stop_or_error) {
141 explains_stop_or_error.takeError(),
142 "Can't call ScriptedThreadPlan::ExplainsStop.");
145 explains_stop = *explains_stop_or_error;
147 return explains_stop;
153 bool mischief_managed =
true;
158 if (mischief_managed) {
164 return mischief_managed;
183 lldb::StreamSP stream = std::make_shared<lldb_private::StreamString>();
184 llvm::Error err =
m_interface->GetStopDescription(stream);
188 "Can't call ScriptedThreadPlan::GetStopDescription: {0}");
189 s->
Format(
"Scripted thread plan implemented by class {0}.",
200 s->
Format(
"Scripted thread plan implemented by class {0}.",
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOG_ERROR(log, error,...)
virtual lldb::ScriptedThreadPlanInterfaceSP CreateScriptedThreadPlanInterface()
StreamString m_stop_description
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
lldb::ScriptedThreadPlanInterfaceSP m_interface
bool ShouldStop(Event *event_ptr) override
StructuredData::ObjectSP m_implementation_sp
ScriptedMetadata m_scripted_metadata
bool DoPlanExplainsStop(Event *event_ptr) override
llvm::StringRef GetScriptClassName() const
bool ValidatePlan(Stream *error) override
Returns whether this plan could be successfully created.
bool MischiefManaged() override
ScriptInterpreter * GetScriptInterpreter()
bool DoWillResume(lldb::StateType resume_state, bool current_plan) override
bool IsPlanStale() override
lldb::StateType GetPlanRunState() override
ScriptedThreadPlan(Thread &thread, const ScriptedMetadata &scripted_metadata)
const char * GetData() const
A stream class that can stream formatted output to a file.
void Format(const char *format, Args &&... args)
Forwards the arguments to llvm::formatv and writes to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
void SetPrivate(bool input)
ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, Vote report_stop_vote, Vote report_run_vote)
void SetPlanComplete(bool success=true)
void SetOkayToDiscard(bool value)
bool SetIsControllingPlan(bool value)
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
StateType
Process and Thread States.
@ eStateRunning
Process or thread is running and can't be examined.
std::shared_ptr< lldb_private::Stream > StreamSP