summaryrefslogtreecommitdiff
path: root/source/Target/ThreadPlanPython.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Target/ThreadPlanPython.cpp')
-rw-r--r--source/Target/ThreadPlanPython.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/source/Target/ThreadPlanPython.cpp b/source/Target/ThreadPlanPython.cpp
index 7796b8a0ab20..84b93bdc6583 100644
--- a/source/Target/ThreadPlanPython.cpp
+++ b/source/Target/ThreadPlanPython.cpp
@@ -9,12 +9,7 @@
#include "lldb/Target/ThreadPlan.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/State.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/Target/Process.h"
@@ -24,6 +19,7 @@
#include "lldb/Target/ThreadPlan.h"
#include "lldb/Target/ThreadPlanPython.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/State.h"
using namespace lldb;
using namespace lldb_private;
@@ -35,7 +31,7 @@ using namespace lldb_private;
ThreadPlanPython::ThreadPlanPython(Thread &thread, const char *class_name)
: ThreadPlan(ThreadPlan::eKindPython, "Python based Thread Plan", thread,
eVoteNoOpinion, eVoteNoOpinion),
- m_class_name(class_name) {
+ m_class_name(class_name), m_did_push(false) {
SetIsMasterPlan(true);
SetOkayToDiscard(true);
SetPrivate(false);
@@ -47,20 +43,22 @@ ThreadPlanPython::~ThreadPlanPython() {
}
bool ThreadPlanPython::ValidatePlan(Stream *error) {
- // I have to postpone setting up the implementation till after the constructor
- // because I need to call
- // shared_from_this, which you can't do in the constructor. So I'll do it
- // here.
- if (m_implementation_sp)
+ if (!m_did_push)
return true;
- else
+
+ if (!m_implementation_sp) {
+ if (error)
+ error->Printf("Python thread plan does not have an implementation");
return false;
+ }
+
+ return true;
}
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()