diff options
Diffstat (limited to 'source/Target/ThreadList.cpp')
| -rw-r--r-- | source/Target/ThreadList.cpp | 35 | 
1 files changed, 30 insertions, 5 deletions
| diff --git a/source/Target/ThreadList.cpp b/source/Target/ThreadList.cpp index 1f8b351100a6..4fffdac9a34e 100644 --- a/source/Target/ThreadList.cpp +++ b/source/Target/ThreadList.cpp @@ -85,6 +85,17 @@ ThreadList::AddThread (const ThreadSP &thread_sp)      m_threads.push_back(thread_sp);  } +void +ThreadList::InsertThread (const lldb::ThreadSP &thread_sp, uint32_t idx) +{ +    Mutex::Locker locker(GetMutex()); +    if (idx < m_threads.size()) +        m_threads.insert(m_threads.begin() + idx, thread_sp); +    else +        m_threads.push_back (thread_sp); +} + +  uint32_t  ThreadList::GetSize (bool can_update)  { @@ -293,17 +304,31 @@ ThreadList::ShouldStop (Event *event_ptr)      {          ThreadSP thread_sp(*pos); -        did_anybody_stop_for_a_reason |= thread_sp->ThreadStoppedForAReason(); +        // 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. +        // +        // Note, this causes a problem when you have a thread specific breakpoint, and a bunch of threads hit the breakpoint, +        // but not the thread which we are waiting for.  All the threads that are not "supposed" to hit the breakpoint +        // are marked as having no stop reason, which is right, they should not show a stop reason.  But that triggers this +        // code and causes us to stop seemingly for no reason. +        // +        // Since the only way we ever saw this error was on first attach, I'm only going to trigger set did_anybody_stop_for_a_reason +        // to true unless this is the first stop. +        // +        // If this becomes a problem, we'll have to have another StopReason like "StopInfoHidden" which will look invalid +        // everywhere but at this check. +     +        if (thread_sp->GetProcess()->GetStopID() > 1) +            did_anybody_stop_for_a_reason = true; +        else +            did_anybody_stop_for_a_reason |= thread_sp->ThreadStoppedForAReason();          const bool thread_should_stop = thread_sp->ShouldStop(event_ptr);          if (thread_should_stop)              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; | 
