diff options
author | Greg Clayton <gclayton@apple.com> | 2011-01-24 06:22:23 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-01-24 06:22:23 +0000 |
commit | 050f33cee8d42c148150bc78a32c1f5998d2a5de (patch) | |
tree | df93f028bae38aa4b0989a8680c181258b205e77 /lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp | |
parent | 26783fea37bda2abd200eae72828279ba3b6e6e6 (diff) | |
download | bcm5719-llvm-050f33cee8d42c148150bc78a32c1f5998d2a5de.tar.gz bcm5719-llvm-050f33cee8d42c148150bc78a32c1f5998d2a5de.zip |
Discover new threads right before we continue a process since libdispatch has
been known to make threads for us while our process/task is suspended.
llvm-svn: 124111
Diffstat (limited to 'lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp')
-rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp b/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp index 38c25d2f03b..961e7e53b7b 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp @@ -315,6 +315,13 @@ void MachThreadList::ProcessWillResume(MachProcess *process, const DNBThreadResumeActions &thread_actions) { PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex); + + // Update our thread list, because sometimes libdispatch or the kernel + // will spawn threads while a task is suspended. + MachThreadList::collection new_threads; + + UpdateThreadList(process, true, &new_threads); + const uint32_t num_threads = m_threads.size(); for (uint32_t idx = 0; idx < num_threads; ++idx) { @@ -326,21 +333,15 @@ MachThreadList::ProcessWillResume(MachProcess *process, const DNBThreadResumeAct thread->ThreadWillResume (thread_action); } - if (DNBLogCheckLogBit(LOG_THREAD)) + if (new_threads.size()) { - MachThreadList::collection new_threads; - UpdateThreadList(process, true, &new_threads); - 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, num_new_threads = new_threads.size(); idx < num_new_threads; ++idx) - { - DNBLogThreadedIf (LOG_THREAD, "MachThreadList::ProcessWillResume (pid = %4.4x) stop-id=%u, newly discovered thread: 0x%4.4x, thread-is-user-ready=%i)", - process->ProcessID(), - process->StopCount(), - new_threads[idx]->ThreadID(), - new_threads[idx]->IsUserReady()); - } + 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(), + process->StopCount(), + new_threads[idx]->ThreadID(), + new_threads[idx]->IsUserReady()); } } } |