aboutsummaryrefslogtreecommitdiff
path: root/source/Target/ThreadPlan.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-07-30 00:23:06 +0000
committerGreg Clayton <gclayton@apple.com>2013-07-30 00:23:06 +0000
commite4923ddaa18bf003e339e6ab33bfd137a632fc0f (patch)
tree16c5945b76cc002ce58f6af66a20eab29ac92802 /source/Target/ThreadPlan.cpp
parent21f98a38a0cfa10b9935248f1b3628b5ba914402 (diff)
downloadlldb-e4923ddaa18bf003e339e6ab33bfd137a632fc0f.tar.gz
<rdar://problem/14526890>
Fixed a crasher when using memory threads where a thread is sticking around too long and was causing problems when it didn't have a thread plan. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@187395 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'source/Target/ThreadPlan.cpp')
-rw-r--r--source/Target/ThreadPlan.cpp141
1 files changed, 141 insertions, 0 deletions
diff --git a/source/Target/ThreadPlan.cpp b/source/Target/ThreadPlan.cpp
index ba35db19c..11240dbe2 100644
--- a/source/Target/ThreadPlan.cpp
+++ b/source/Target/ThreadPlan.cpp
@@ -210,3 +210,144 @@ ThreadPlan::RunState ()
else
return GetPlanRunState();
}
+
+//----------------------------------------------------------------------
+// ThreadPlanNull
+//----------------------------------------------------------------------
+
+ThreadPlanNull::ThreadPlanNull (Thread &thread) :
+ ThreadPlan (ThreadPlan::eKindNull,
+ "Null Thread Plan",
+ thread,
+ eVoteNoOpinion,
+ eVoteNoOpinion)
+{
+}
+
+ThreadPlanNull::~ThreadPlanNull ()
+{
+}
+
+void
+ThreadPlanNull::GetDescription (Stream *s,
+ lldb::DescriptionLevel level)
+{
+ s->PutCString("Null thread plan - thread has been destroyed.");
+}
+
+bool
+ThreadPlanNull::ValidatePlan (Stream *error)
+{
+#ifdef LLDB_CONFIGURATION_DEBUG
+ fprintf(stderr, "error: %s called on thread that has been destroyed (tid = 0x%llx, ptid = 0x%llx)",
+ __PRETTY_FUNCTION__,
+ m_thread.GetID(),
+ m_thread.GetProtocolID());
+#else
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));
+ if (log)
+ log->Error("%s called on thread that has been destroyed (tid = 0x%llx, ptid = 0x%llx)",
+ __PRETTY_FUNCTION__,
+ m_thread.GetID(),
+ m_thread.GetProtocolID());
+#endif
+ return true;
+}
+
+bool
+ThreadPlanNull::ShouldStop (Event *event_ptr)
+{
+#ifdef LLDB_CONFIGURATION_DEBUG
+ fprintf(stderr, "error: %s called on thread that has been destroyed (tid = 0x%llx, ptid = 0x%llx)",
+ __PRETTY_FUNCTION__,
+ m_thread.GetID(),
+ m_thread.GetProtocolID());
+#else
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));
+ if (log)
+ log->Error("%s called on thread that has been destroyed (tid = 0x%llx, ptid = 0x%llx)",
+ __PRETTY_FUNCTION__,
+ m_thread.GetID(),
+ m_thread.GetProtocolID());
+#endif
+ return true;
+}
+
+bool
+ThreadPlanNull::WillStop ()
+{
+#ifdef LLDB_CONFIGURATION_DEBUG
+ fprintf(stderr, "error: %s called on thread that has been destroyed (tid = 0x%llx, ptid = 0x%llx)",
+ __PRETTY_FUNCTION__,
+ m_thread.GetID(),
+ m_thread.GetProtocolID());
+#else
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));
+ if (log)
+ log->Error("%s called on thread that has been destroyed (tid = 0x%llx, ptid = 0x%llx)",
+ __PRETTY_FUNCTION__,
+ m_thread.GetID(),
+ m_thread.GetProtocolID());
+#endif
+ return true;
+}
+
+bool
+ThreadPlanNull::DoPlanExplainsStop (Event *event_ptr)
+{
+#ifdef LLDB_CONFIGURATION_DEBUG
+ fprintf(stderr, "error: %s called on thread that has been destroyed (tid = 0x%llx, ptid = 0x%llx)",
+ __PRETTY_FUNCTION__,
+ m_thread.GetID(),
+ m_thread.GetProtocolID());
+#else
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));
+ if (log)
+ log->Error("%s called on thread that has been destroyed (tid = 0x%llx, ptid = 0x%llx)",
+ __PRETTY_FUNCTION__,
+ m_thread.GetID(),
+ m_thread.GetProtocolID());
+#endif
+ return true;
+}
+
+// The null plan is never done.
+bool
+ThreadPlanNull::MischiefManaged ()
+{
+ // The null plan is never done.
+#ifdef LLDB_CONFIGURATION_DEBUG
+ fprintf(stderr, "error: %s called on thread that has been destroyed (tid = 0x%llx, ptid = 0x%llx)",
+ __PRETTY_FUNCTION__,
+ m_thread.GetID(),
+ m_thread.GetProtocolID());
+#else
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));
+ if (log)
+ log->Error("%s called on thread that has been destroyed (tid = 0x%llx, ptid = 0x%llx)",
+ __PRETTY_FUNCTION__,
+ m_thread.GetID(),
+ m_thread.GetProtocolID());
+#endif
+ return false;
+}
+
+lldb::StateType
+ThreadPlanNull::GetPlanRunState ()
+{
+ // Not sure what to return here. This is a dead thread.
+#ifdef LLDB_CONFIGURATION_DEBUG
+ fprintf(stderr, "error: %s called on thread that has been destroyed (tid = 0x%llx, ptid = 0x%llx)",
+ __PRETTY_FUNCTION__,
+ m_thread.GetID(),
+ m_thread.GetProtocolID());
+#else
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));
+ if (log)
+ log->Error("%s called on thread that has been destroyed (tid = 0x%llx, ptid = 0x%llx)",
+ __PRETTY_FUNCTION__,
+ m_thread.GetID(),
+ m_thread.GetProtocolID());
+#endif
+ return eStateRunning;
+}