Make ThreadPlans use TID and Process, rather than Thread *.

Differential Revision: https://reviews.llvm.org/D75711
This commit is contained in:
Jim Ingham
2020-03-10 14:03:53 -07:00
parent ceb58ad61d
commit e4598dc04a
18 changed files with 279 additions and 319 deletions

View File

@@ -55,15 +55,16 @@ bool ThreadPlanPython::ValidatePlan(Stream *error) {
return true;
}
ScriptInterpreter *ThreadPlanPython::GetScriptInterpreter() {
return m_process.GetTarget().GetDebugger().GetScriptInterpreter();
}
void ThreadPlanPython::DidPush() {
// We set up the script side in DidPush, so that it can push other plans in
// the constructor, and doesn't have to care about the details of DidPush.
m_did_push = true;
if (!m_class_name.empty()) {
ScriptInterpreter *script_interp = m_thread.GetProcess()
->GetTarget()
.GetDebugger()
.GetScriptInterpreter();
ScriptInterpreter *script_interp = GetScriptInterpreter();
if (script_interp) {
m_implementation_sp = script_interp->CreateScriptedThreadPlan(
m_class_name.c_str(), m_args_data, m_error_str,
@@ -79,10 +80,7 @@ bool ThreadPlanPython::ShouldStop(Event *event_ptr) {
bool should_stop = true;
if (m_implementation_sp) {
ScriptInterpreter *script_interp = m_thread.GetProcess()
->GetTarget()
.GetDebugger()
.GetScriptInterpreter();
ScriptInterpreter *script_interp = GetScriptInterpreter();
if (script_interp) {
bool script_error;
should_stop = script_interp->ScriptedThreadPlanShouldStop(
@@ -101,10 +99,7 @@ bool ThreadPlanPython::IsPlanStale() {
bool is_stale = true;
if (m_implementation_sp) {
ScriptInterpreter *script_interp = m_thread.GetProcess()
->GetTarget()
.GetDebugger()
.GetScriptInterpreter();
ScriptInterpreter *script_interp = GetScriptInterpreter();
if (script_interp) {
bool script_error;
is_stale = script_interp->ScriptedThreadPlanIsStale(m_implementation_sp,
@@ -123,10 +118,7 @@ bool ThreadPlanPython::DoPlanExplainsStop(Event *event_ptr) {
bool explains_stop = true;
if (m_implementation_sp) {
ScriptInterpreter *script_interp = m_thread.GetProcess()
->GetTarget()
.GetDebugger()
.GetScriptInterpreter();
ScriptInterpreter *script_interp = GetScriptInterpreter();
if (script_interp) {
bool script_error;
explains_stop = script_interp->ScriptedThreadPlanExplainsStop(
@@ -159,10 +151,7 @@ lldb::StateType ThreadPlanPython::GetPlanRunState() {
m_class_name.c_str());
lldb::StateType run_state = eStateRunning;
if (m_implementation_sp) {
ScriptInterpreter *script_interp = m_thread.GetProcess()
->GetTarget()
.GetDebugger()
.GetScriptInterpreter();
ScriptInterpreter *script_interp = GetScriptInterpreter();
if (script_interp) {
bool script_error;
run_state = script_interp->ScriptedThreadPlanGetRunState(