From aa794b38fedea0f2e99519975acab0b289714b41 Mon Sep 17 00:00:00 2001 From: emaste Date: Wed, 23 Jul 2014 19:35:02 +0000 Subject: MFC r262528: Update LLDB snapshot to upstream r202189 Highlights include (upstream revs in parens): - Improvements to the remote GDB protocol client (r196610, r197579, r197857, r200072, and others) - Bug fixes for big-endian targets (r196808) - Initial support for libdispatch (GCD) queues in the debuggee (r197190) - Add "step-avoid-libraries" setting (r199943) - IO subsystem improvements (including initial work on a curses gui) (r200263) - Support hardware watchpoints on FreeBSD (r201706) - Improved unwinding through hand-written assembly functions (r201839) - Handle DW_TAG_unspecified_parameters for variadic functions (r202061) - Fix Ctrl+C interrupting a running inferior process (r202086, r202154) - Various bug fixes for memory leaks, LLDB segfaults, the C++ demangler, ELF core files, DWARF debug info, and others. Sponsored by: DARPA, AFRL --- .../llvm/tools/lldb/source/Target/ThreadList.cpp | 35 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'contrib/llvm/tools/lldb/source/Target/ThreadList.cpp') diff --git a/contrib/llvm/tools/lldb/source/Target/ThreadList.cpp b/contrib/llvm/tools/lldb/source/Target/ThreadList.cpp index 1f8b351..4fffdac 100644 --- a/contrib/llvm/tools/lldb/source/Target/ThreadList.cpp +++ b/contrib/llvm/tools/lldb/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; -- cgit v1.1