1- // ===-- ThreadPlanPython .cpp -- --------------------------------------------===//
1+ // ===-- ScriptedThreadPlan .cpp --------------------------------------------===//
22//
33// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44// See https://llvm.org/LICENSE.txt for license information.
1414#include " lldb/Interpreter/ScriptInterpreter.h"
1515#include " lldb/Target/Process.h"
1616#include " lldb/Target/RegisterContext.h"
17+ #include " lldb/Target/ScriptedThreadPlan.h"
1718#include " lldb/Target/Target.h"
1819#include " lldb/Target/Thread.h"
1920#include " lldb/Target/ThreadPlan.h"
20- #include " lldb/Target/ThreadPlanPython.h"
2121#include " lldb/Utility/LLDBLog.h"
2222#include " lldb/Utility/Log.h"
2323#include " lldb/Utility/State.h"
2424
2525using namespace lldb ;
2626using namespace lldb_private ;
2727
28- // ThreadPlanPython
29-
30- ThreadPlanPython::ThreadPlanPython (Thread &thread, const char *class_name,
31- const StructuredDataImpl &args_data)
32- : ThreadPlan(ThreadPlan::eKindPython, " Python based Thread Plan" , thread,
28+ ScriptedThreadPlan::ScriptedThreadPlan (Thread &thread, const char *class_name,
29+ const StructuredDataImpl &args_data)
30+ : ThreadPlan(ThreadPlan::eKindPython, " Script based Thread Plan" , thread,
3331 eVoteNoOpinion, eVoteNoOpinion),
3432 m_class_name(class_name), m_args_data(args_data), m_did_push(false ),
3533 m_stop_others(false ) {
@@ -38,7 +36,7 @@ ThreadPlanPython::ThreadPlanPython(Thread &thread, const char *class_name,
3836 SetPlanComplete (false );
3937 // FIXME: error handling
4038 // error.SetErrorStringWithFormat(
41- // "ThreadPlanPython ::%s () - ERROR: %s", __FUNCTION__,
39+ // "ScriptedThreadPlan ::%s () - ERROR: %s", __FUNCTION__,
4240 // "Couldn't get script interpreter");
4341 return ;
4442 }
@@ -48,7 +46,7 @@ ThreadPlanPython::ThreadPlanPython(Thread &thread, const char *class_name,
4846 SetPlanComplete (false );
4947 // FIXME: error handling
5048 // error.SetErrorStringWithFormat(
51- // "ThreadPlanPython ::%s () - ERROR: %s", __FUNCTION__,
49+ // "ScriptedThreadPlan ::%s () - ERROR: %s", __FUNCTION__,
5250 // "Script interpreter couldn't create Scripted Thread Plan Interface");
5351 return ;
5452 }
@@ -58,26 +56,26 @@ ThreadPlanPython::ThreadPlanPython(Thread &thread, const char *class_name,
5856 SetPrivate (false );
5957}
6058
61- bool ThreadPlanPython ::ValidatePlan (Stream *error) {
59+ bool ScriptedThreadPlan ::ValidatePlan (Stream *error) {
6260 if (!m_did_push)
6361 return true ;
6462
6563 if (!m_implementation_sp) {
6664 if (error)
6765 error->Printf (" Error constructing Python ThreadPlan: %s" ,
68- m_error_str.empty () ? " <unknown error>"
69- : m_error_str.c_str ());
66+ m_error_str.empty () ? " <unknown error>"
67+ : m_error_str.c_str ());
7068 return false ;
7169 }
7270
7371 return true ;
7472}
7573
76- ScriptInterpreter *ThreadPlanPython ::GetScriptInterpreter () {
74+ ScriptInterpreter *ScriptedThreadPlan ::GetScriptInterpreter () {
7775 return m_process.GetTarget ().GetDebugger ().GetScriptInterpreter ();
7876}
7977
80- void ThreadPlanPython ::DidPush () {
78+ void ScriptedThreadPlan ::DidPush () {
8179 // We set up the script side in DidPush, so that it can push other plans in
8280 // the constructor, and doesn't have to care about the details of DidPush.
8381 m_did_push = true ;
@@ -92,10 +90,10 @@ void ThreadPlanPython::DidPush() {
9290 }
9391}
9492
95- bool ThreadPlanPython ::ShouldStop (Event *event_ptr) {
93+ bool ScriptedThreadPlan ::ShouldStop (Event *event_ptr) {
9694 Log *log = GetLog (LLDBLog::Thread);
97- LLDB_LOGF (log, " %s called on Python Thread Plan: %s )" , LLVM_PRETTY_FUNCTION ,
98- m_class_name.c_str ());
95+ LLDB_LOGF (log, " %s called on Scripted Thread Plan: %s )" ,
96+ LLVM_PRETTY_FUNCTION, m_class_name.c_str ());
9997
10098 bool should_stop = true ;
10199 if (m_implementation_sp) {
@@ -110,10 +108,10 @@ bool ThreadPlanPython::ShouldStop(Event *event_ptr) {
110108 return should_stop;
111109}
112110
113- bool ThreadPlanPython ::IsPlanStale () {
111+ bool ScriptedThreadPlan ::IsPlanStale () {
114112 Log *log = GetLog (LLDBLog::Thread);
115- LLDB_LOGF (log, " %s called on Python Thread Plan: %s )" , LLVM_PRETTY_FUNCTION ,
116- m_class_name.c_str ());
113+ LLDB_LOGF (log, " %s called on Scripted Thread Plan: %s )" ,
114+ LLVM_PRETTY_FUNCTION, m_class_name.c_str ());
117115
118116 bool is_stale = true ;
119117 if (m_implementation_sp) {
@@ -128,10 +126,10 @@ bool ThreadPlanPython::IsPlanStale() {
128126 return is_stale;
129127}
130128
131- bool ThreadPlanPython ::DoPlanExplainsStop (Event *event_ptr) {
129+ bool ScriptedThreadPlan ::DoPlanExplainsStop (Event *event_ptr) {
132130 Log *log = GetLog (LLDBLog::Thread);
133- LLDB_LOGF (log, " %s called on Python Thread Plan: %s )" , LLVM_PRETTY_FUNCTION ,
134- m_class_name.c_str ());
131+ LLDB_LOGF (log, " %s called on Scripted Thread Plan: %s )" ,
132+ LLVM_PRETTY_FUNCTION, m_class_name.c_str ());
135133
136134 bool explains_stop = true ;
137135 if (m_implementation_sp) {
@@ -147,10 +145,10 @@ bool ThreadPlanPython::DoPlanExplainsStop(Event *event_ptr) {
147145 return explains_stop;
148146}
149147
150- bool ThreadPlanPython ::MischiefManaged () {
148+ bool ScriptedThreadPlan ::MischiefManaged () {
151149 Log *log = GetLog (LLDBLog::Thread);
152- LLDB_LOGF (log, " %s called on Python Thread Plan: %s )" , LLVM_PRETTY_FUNCTION ,
153- m_class_name.c_str ());
150+ LLDB_LOGF (log, " %s called on Scripted Thread Plan: %s )" ,
151+ LLVM_PRETTY_FUNCTION, m_class_name.c_str ());
154152 bool mischief_managed = true ;
155153 if (m_implementation_sp) {
156154 // I don't really need mischief_managed, since it's simpler to just call
@@ -165,20 +163,21 @@ bool ThreadPlanPython::MischiefManaged() {
165163 return mischief_managed;
166164}
167165
168- lldb::StateType ThreadPlanPython ::GetPlanRunState () {
166+ lldb::StateType ScriptedThreadPlan ::GetPlanRunState () {
169167 Log *log = GetLog (LLDBLog::Thread);
170- LLDB_LOGF (log, " %s called on Python Thread Plan: %s )" , LLVM_PRETTY_FUNCTION ,
171- m_class_name.c_str ());
168+ LLDB_LOGF (log, " %s called on Scripted Thread Plan: %s )" ,
169+ LLVM_PRETTY_FUNCTION, m_class_name.c_str ());
172170 lldb::StateType run_state = eStateRunning;
173171 if (m_implementation_sp)
174172 run_state = m_interface->GetRunState ();
175173 return run_state;
176174}
177175
178- void ThreadPlanPython::GetDescription (Stream *s, lldb::DescriptionLevel level) {
176+ void ScriptedThreadPlan::GetDescription (Stream *s,
177+ lldb::DescriptionLevel level) {
179178 Log *log = GetLog (LLDBLog::Thread);
180- LLDB_LOGF (log, " %s called on Python Thread Plan: %s )" , LLVM_PRETTY_FUNCTION ,
181- m_class_name.c_str ());
179+ LLDB_LOGF (log, " %s called on Scripted Thread Plan: %s )" ,
180+ LLVM_PRETTY_FUNCTION, m_class_name.c_str ());
182181 if (m_implementation_sp) {
183182 ScriptInterpreter *script_interp = GetScriptInterpreter ();
184183 if (script_interp) {
@@ -187,8 +186,8 @@ void ThreadPlanPython::GetDescription(Stream *s, lldb::DescriptionLevel level) {
187186 if (err) {
188187 LLDB_LOG_ERROR (GetLog (LLDBLog::Thread), std::move (err),
189188 " Can't call ScriptedThreadPlan::GetStopDescription." );
190- s->Printf (" Python thread plan implemented by class %s." ,
191- m_class_name.c_str ());
189+ s->Printf (" Scripted thread plan implemented by class %s." ,
190+ m_class_name.c_str ());
192191 } else
193192 s->PutCString (
194193 reinterpret_cast <StreamString *>(stream.get ())->GetData ());
@@ -198,21 +197,21 @@ void ThreadPlanPython::GetDescription(Stream *s, lldb::DescriptionLevel level) {
198197 // It's an error not to have a description, so if we get here, we should
199198 // add something.
200199 if (m_stop_description.Empty ())
201- s->Printf (" Python thread plan implemented by class %s." ,
200+ s->Printf (" Scripted thread plan implemented by class %s." ,
202201 m_class_name.c_str ());
203202 s->PutCString (m_stop_description.GetData ());
204203}
205204
206205// The ones below are not currently exported to Python.
207- bool ThreadPlanPython ::WillStop () {
206+ bool ScriptedThreadPlan ::WillStop () {
208207 Log *log = GetLog (LLDBLog::Thread);
209- LLDB_LOGF (log, " %s called on Python Thread Plan: %s )" , LLVM_PRETTY_FUNCTION ,
210- m_class_name.c_str ());
208+ LLDB_LOGF (log, " %s called on Scripted Thread Plan: %s )" ,
209+ LLVM_PRETTY_FUNCTION, m_class_name.c_str ());
211210 return true ;
212211}
213212
214- bool ThreadPlanPython ::DoWillResume (lldb::StateType resume_state,
215- bool current_plan) {
213+ bool ScriptedThreadPlan ::DoWillResume (lldb::StateType resume_state,
214+ bool current_plan) {
216215 m_stop_description.Clear ();
217- return true ;
216+ return true ;
218217}
0 commit comments