From 692538db269ddf46c12b8727a579a224b0a4bf57 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Mon, 24 Jan 2011 07:10:48 +0000 Subject: One more thing... Resume any threads that we discover were created while we stop as they may be in sensitive areas and we set breakpoints on the thread creation routines if we are running expressions, so the threads should quickly get to a safe spot. llvm-svn: 124115 --- .../debugserver/source/MacOSX/MachThreadList.cpp | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'lldb/tools/debugserver/source/MacOSX') diff --git a/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp b/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp index 961e7e53b7b..27c0016c4fe 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp @@ -322,20 +322,36 @@ MachThreadList::ProcessWillResume(MachProcess *process, const DNBThreadResumeAct UpdateThreadList(process, true, &new_threads); + DNBThreadResumeAction resume_new_threads = { -1, eStateRunning, 0, INVALID_NUB_ADDRESS }; + + const uint32_t num_new_threads = new_threads.size(); const uint32_t num_threads = m_threads.size(); for (uint32_t idx = 0; idx < num_threads; ++idx) { MachThread *thread = m_threads[idx].get(); + bool handled = false; + for (uint32_t new_idx = 0; new_idx < num_new_threads; ++new_idx) + { + if (thread == new_threads[new_idx].get()) + { + thread->ThreadWillResume(&resume_new_threads); + handled = true; + break; + } + } - const DNBThreadResumeAction *thread_action = thread_actions.GetActionForThread (thread->ThreadID(), true); - // There must always be a thread action for every thread. - assert (thread_action); - thread->ThreadWillResume (thread_action); + if (!handled) + { + const DNBThreadResumeAction *thread_action = thread_actions.GetActionForThread (thread->ThreadID(), true); + // There must always be a thread action for every thread. + assert (thread_action); + thread->ThreadWillResume (thread_action); + } } if (new_threads.size()) { - for (uint32_t idx = 0, num_new_threads = new_threads.size(); idx < num_new_threads; ++idx) + for (uint32_t idx = 0; idx < num_new_threads; ++idx) { DNBLogThreadedIf (LOG_THREAD, "MachThreadList::ProcessWillResume (pid = %4.4x) stop-id=%u, resuming newly discovered thread: 0x%4.4x, thread-is-user-ready=%i)", process->ProcessID(), -- cgit v1.2.3