34 m_class_name(class_name), m_args_data(args_data), m_did_push(false),
35 m_stop_others(false) {
67 error->Printf(
"Error constructing Python ThreadPlan: %s",
88 m_error_str = llvm::toString(obj_or_err.takeError());
97 LLDB_LOGF(log,
"%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
100 bool should_stop =
true;
102 auto should_stop_or_err =
m_interface->ShouldStop(event_ptr);
103 if (!should_stop_or_err) {
105 "Can't call ScriptedThreadPlan::ShouldStop.");
108 should_stop = *should_stop_or_err;
115 LLDB_LOGF(log,
"%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
118 bool is_stale =
true;
121 if (!is_stale_or_err) {
123 "Can't call ScriptedThreadPlan::IsStale.");
126 is_stale = *is_stale_or_err;
133 LLDB_LOGF(log,
"%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
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;
152 LLDB_LOGF(log,
"%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
154 bool mischief_managed =
true;
159 if (mischief_managed) {
165 return mischief_managed;
170 LLDB_LOGF(log,
"%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
180 LLDB_LOGF(log,
"%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
185 lldb::StreamSP stream = std::make_shared<lldb_private::StreamString>();
186 llvm::Error err =
m_interface->GetStopDescription(stream);
189 "Can't call ScriptedThreadPlan::GetStopDescription.");
190 s->
Printf(
"Python thread plan implemented by class %s.",
201 s->
Printf(
"Python thread plan implemented by class %s.",
209 LLDB_LOGF(log,
"%s called on Python Thread Plan: %s )", LLVM_PRETTY_FUNCTION,
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()
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.
ScriptInterpreter * GetScriptInterpreter()
bool ValidatePlan(Stream *error) override
Returns whether this plan could be successfully created.
bool DoPlanExplainsStop(Event *event_ptr) override
StructuredDataImpl m_args_data
StructuredData::ObjectSP m_implementation_sp
bool ShouldStop(Event *event_ptr) override
lldb::ScriptedThreadPlanInterfaceSP m_interface
bool IsPlanStale() override
bool DoWillResume(lldb::StateType resume_state, bool current_plan) override
ThreadPlanPython(Thread &thread, const char *class_name, const StructuredDataImpl &args_data)
StreamString m_stop_description
bool MischiefManaged() override
void GetDescription(Stream *s, lldb::DescriptionLevel level) override
Print a description of this thread to the stream s.
lldb::StateType GetPlanRunState() override
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