32 m_class_name(class_name), m_args_data(args_data), m_did_push(false),
33 m_stop_others(false) {
65 error->Printf(
"Error constructing Python ThreadPlan: %s",
86 m_error_str = llvm::toString(obj_or_err.takeError());
95 LLDB_LOGF(log,
"%s called on Scripted Thread Plan: %s )",
98 bool should_stop =
true;
100 auto should_stop_or_err =
m_interface->ShouldStop(event_ptr);
101 if (!should_stop_or_err) {
103 "Can't call ScriptedThreadPlan::ShouldStop.");
106 should_stop = *should_stop_or_err;
113 LLDB_LOGF(log,
"%s called on Scripted Thread Plan: %s )",
116 bool is_stale =
true;
119 if (!is_stale_or_err) {
121 "Can't call ScriptedThreadPlan::IsStale.");
124 is_stale = *is_stale_or_err;
131 LLDB_LOGF(log,
"%s called on Scripted Thread Plan: %s )",
134 bool explains_stop =
true;
136 auto explains_stop_or_error =
m_interface->ExplainsStop(event_ptr);
137 if (!explains_stop_or_error) {
139 explains_stop_or_error.takeError(),
140 "Can't call ScriptedThreadPlan::ExplainsStop.");
143 explains_stop = *explains_stop_or_error;
145 return explains_stop;
150 LLDB_LOGF(log,
"%s called on Scripted Thread Plan: %s )",
152 bool mischief_managed =
true;
157 if (mischief_managed) {
163 return mischief_managed;
168 LLDB_LOGF(log,
"%s called on Scripted Thread Plan: %s )",
179 LLDB_LOGF(log,
"%s called on Scripted Thread Plan: %s )",
184 lldb::StreamSP stream = std::make_shared<lldb_private::StreamString>();
185 llvm::Error err =
m_interface->GetStopDescription(stream);
189 "Can't call ScriptedThreadPlan::GetStopDescription: {0}");
190 s->
Printf(
"Scripted thread plan implemented by class %s.",
201 s->
Printf(
"Scripted thread plan implemented by class %s.",
209 LLDB_LOGF(log,
"%s called on Scripted Thread Plan: %s )",
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
#define LLDB_LOG_ERROR(log, error,...)
ScriptInterpreter * GetScriptInterpreter(bool can_create=true, std::optional< lldb::ScriptLanguage > language={})
Target & GetTarget()
Get the target object pointer for this module.
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
bool DoPlanExplainsStop(Event *event_ptr) override
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
ScriptedThreadPlan(Thread &thread, const char *class_name, const StructuredDataImpl &args_data)
StructuredDataImpl m_args_data
lldb::StateType GetPlanRunState() override
const char * GetData() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
void SetPrivate(bool input)
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