1
- // ===-- ThreadPlanPython .cpp -- --------------------------------------------===//
1
+ // ===-- ScriptedThreadPlan .cpp --------------------------------------------===//
2
2
//
3
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
4
// See https://llvm.org/LICENSE.txt for license information.
14
14
#include " lldb/Interpreter/ScriptInterpreter.h"
15
15
#include " lldb/Target/Process.h"
16
16
#include " lldb/Target/RegisterContext.h"
17
+ #include " lldb/Target/ScriptedThreadPlan.h"
17
18
#include " lldb/Target/Target.h"
18
19
#include " lldb/Target/Thread.h"
19
20
#include " lldb/Target/ThreadPlan.h"
20
- #include " lldb/Target/ThreadPlanPython.h"
21
21
#include " lldb/Utility/LLDBLog.h"
22
22
#include " lldb/Utility/Log.h"
23
23
#include " lldb/Utility/State.h"
24
24
25
25
using namespace lldb ;
26
26
using namespace lldb_private ;
27
27
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,
33
31
eVoteNoOpinion, eVoteNoOpinion),
34
32
m_class_name(class_name), m_args_data(args_data), m_did_push(false ),
35
33
m_stop_others(false ) {
@@ -38,7 +36,7 @@ ThreadPlanPython::ThreadPlanPython(Thread &thread, const char *class_name,
38
36
SetPlanComplete (false );
39
37
// FIXME: error handling
40
38
// error.SetErrorStringWithFormat(
41
- // "ThreadPlanPython ::%s () - ERROR: %s", __FUNCTION__,
39
+ // "ScriptedThreadPlan ::%s () - ERROR: %s", __FUNCTION__,
42
40
// "Couldn't get script interpreter");
43
41
return ;
44
42
}
@@ -48,7 +46,7 @@ ThreadPlanPython::ThreadPlanPython(Thread &thread, const char *class_name,
48
46
SetPlanComplete (false );
49
47
// FIXME: error handling
50
48
// error.SetErrorStringWithFormat(
51
- // "ThreadPlanPython ::%s () - ERROR: %s", __FUNCTION__,
49
+ // "ScriptedThreadPlan ::%s () - ERROR: %s", __FUNCTION__,
52
50
// "Script interpreter couldn't create Scripted Thread Plan Interface");
53
51
return ;
54
52
}
@@ -58,26 +56,26 @@ ThreadPlanPython::ThreadPlanPython(Thread &thread, const char *class_name,
58
56
SetPrivate (false );
59
57
}
60
58
61
- bool ThreadPlanPython ::ValidatePlan (Stream *error) {
59
+ bool ScriptedThreadPlan ::ValidatePlan (Stream *error) {
62
60
if (!m_did_push)
63
61
return true ;
64
62
65
63
if (!m_implementation_sp) {
66
64
if (error)
67
65
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 ());
70
68
return false ;
71
69
}
72
70
73
71
return true ;
74
72
}
75
73
76
- ScriptInterpreter *ThreadPlanPython ::GetScriptInterpreter () {
74
+ ScriptInterpreter *ScriptedThreadPlan ::GetScriptInterpreter () {
77
75
return m_process.GetTarget ().GetDebugger ().GetScriptInterpreter ();
78
76
}
79
77
80
- void ThreadPlanPython ::DidPush () {
78
+ void ScriptedThreadPlan ::DidPush () {
81
79
// We set up the script side in DidPush, so that it can push other plans in
82
80
// the constructor, and doesn't have to care about the details of DidPush.
83
81
m_did_push = true ;
@@ -92,10 +90,10 @@ void ThreadPlanPython::DidPush() {
92
90
}
93
91
}
94
92
95
- bool ThreadPlanPython ::ShouldStop (Event *event_ptr) {
93
+ bool ScriptedThreadPlan ::ShouldStop (Event *event_ptr) {
96
94
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 ());
99
97
100
98
bool should_stop = true ;
101
99
if (m_implementation_sp) {
@@ -110,10 +108,10 @@ bool ThreadPlanPython::ShouldStop(Event *event_ptr) {
110
108
return should_stop;
111
109
}
112
110
113
- bool ThreadPlanPython ::IsPlanStale () {
111
+ bool ScriptedThreadPlan ::IsPlanStale () {
114
112
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 ());
117
115
118
116
bool is_stale = true ;
119
117
if (m_implementation_sp) {
@@ -128,10 +126,10 @@ bool ThreadPlanPython::IsPlanStale() {
128
126
return is_stale;
129
127
}
130
128
131
- bool ThreadPlanPython ::DoPlanExplainsStop (Event *event_ptr) {
129
+ bool ScriptedThreadPlan ::DoPlanExplainsStop (Event *event_ptr) {
132
130
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 ());
135
133
136
134
bool explains_stop = true ;
137
135
if (m_implementation_sp) {
@@ -147,10 +145,10 @@ bool ThreadPlanPython::DoPlanExplainsStop(Event *event_ptr) {
147
145
return explains_stop;
148
146
}
149
147
150
- bool ThreadPlanPython ::MischiefManaged () {
148
+ bool ScriptedThreadPlan ::MischiefManaged () {
151
149
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 ());
154
152
bool mischief_managed = true ;
155
153
if (m_implementation_sp) {
156
154
// I don't really need mischief_managed, since it's simpler to just call
@@ -165,20 +163,21 @@ bool ThreadPlanPython::MischiefManaged() {
165
163
return mischief_managed;
166
164
}
167
165
168
- lldb::StateType ThreadPlanPython ::GetPlanRunState () {
166
+ lldb::StateType ScriptedThreadPlan ::GetPlanRunState () {
169
167
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 ());
172
170
lldb::StateType run_state = eStateRunning;
173
171
if (m_implementation_sp)
174
172
run_state = m_interface->GetRunState ();
175
173
return run_state;
176
174
}
177
175
178
- void ThreadPlanPython::GetDescription (Stream *s, lldb::DescriptionLevel level) {
176
+ void ScriptedThreadPlan::GetDescription (Stream *s,
177
+ lldb::DescriptionLevel level) {
179
178
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 ());
182
181
if (m_implementation_sp) {
183
182
ScriptInterpreter *script_interp = GetScriptInterpreter ();
184
183
if (script_interp) {
@@ -187,8 +186,8 @@ void ThreadPlanPython::GetDescription(Stream *s, lldb::DescriptionLevel level) {
187
186
if (err) {
188
187
LLDB_LOG_ERROR (GetLog (LLDBLog::Thread), std::move (err),
189
188
" 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 ());
192
191
} else
193
192
s->PutCString (
194
193
reinterpret_cast <StreamString *>(stream.get ())->GetData ());
@@ -198,21 +197,21 @@ void ThreadPlanPython::GetDescription(Stream *s, lldb::DescriptionLevel level) {
198
197
// It's an error not to have a description, so if we get here, we should
199
198
// add something.
200
199
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." ,
202
201
m_class_name.c_str ());
203
202
s->PutCString (m_stop_description.GetData ());
204
203
}
205
204
206
205
// The ones below are not currently exported to Python.
207
- bool ThreadPlanPython ::WillStop () {
206
+ bool ScriptedThreadPlan ::WillStop () {
208
207
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 ());
211
210
return true ;
212
211
}
213
212
214
- bool ThreadPlanPython ::DoWillResume (lldb::StateType resume_state,
215
- bool current_plan) {
213
+ bool ScriptedThreadPlan ::DoWillResume (lldb::StateType resume_state,
214
+ bool current_plan) {
216
215
m_stop_description.Clear ();
217
- return true ;
216
+ return true ;
218
217
}
0 commit comments