[Lldb-commits] [lldb] r177670 - If we stopped but no threads had a reason for stopping, we should tell the user about it rather than continuing.
jingham at apple.com
Thu Mar 21 14:46:56 PDT 2013
Date: Thu Mar 21 16:46:56 2013
New Revision: 177670
If we stopped but no threads had a reason for stopping, we should tell the user about it rather than continuing.
<rdar://problem/13273125> Astris thread status replies for single-core device confuse lldb; lldb resumes execution on attaching
--- lldb/trunk/source/Target/ThreadList.cpp (original)
+++ lldb/trunk/source/Target/ThreadList.cpp Thu Mar 21 16:46:56 2013
@@ -198,7 +198,6 @@ ThreadList::FindThreadByIndexID (uint32_
ThreadList::ShouldStop (Event *event_ptr)
- bool should_stop = false;
// Running events should never stop, obviously...
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
@@ -228,15 +227,31 @@ ThreadList::ShouldStop (Event *event_ptr
log->Printf ("ThreadList::%s: %" PRIu64 " threads", __FUNCTION__, (uint64_t)m_threads.size());
+ bool did_anybody_stop_for_a_reason = false;
+ bool should_stop = false;
for (pos = threads_copy.begin(); pos != end; ++pos)
+ did_anybody_stop_for_a_reason |= thread_sp->ThreadStoppedForAReason();
const bool thread_should_stop = thread_sp->ShouldStop(event_ptr);
should_stop |= true;
+ // We should never get a stop for which no thread had a stop reason, but sometimes we do see this -
+ // for instance when we first connect to a remote stub. In that case we should stop, since we can't figure out
+ // the right thing to do and stopping gives the user control over what to do in this instance.
+ if (!should_stop && !did_anybody_stop_for_a_reason)
+ should_stop = true;
+ if (log)
+ log->Printf ("ThreadList::%s we stopped but no threads had a stop reason, overriding should_stop and stopping.", __FUNCTION__);
log->Printf ("ThreadList::%s overall should_stop = %i", __FUNCTION__, should_stop);
More information about the lldb-commits