[Lldb-commits] [lldb] r124110 - in /lldb/trunk/tools/debugserver/source/MacOSX: MachThreadList.cpp MachThreadList.h

Greg Clayton gclayton at apple.com
Sun Jan 23 22:11:50 PST 2011


Author: gclayton
Date: Mon Jan 24 00:11:50 2011
New Revision: 124110

URL: http://llvm.org/viewvc/llvm-project?rev=124110&view=rev
Log:
Added logging for threads that are spawned while we stop. We log their
existence if the "thread" log bit is enabled right before we resume.


Modified:
    lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp
    lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp?rev=124110&r1=124109&r2=124110&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp Mon Jan 24 00:11:50 2011
@@ -194,7 +194,7 @@
 }
 
 uint32_t
-MachThreadList::UpdateThreadList(MachProcess *process, bool update)
+MachThreadList::UpdateThreadList(MachProcess *process, bool update, MachThreadList::collection *new_threads)
 {
     // locker will keep a mutex locked until it goes out of scope
     DNBLogThreadedIf (LOG_THREAD, "MachThreadList::UpdateThreadList (pid = %4.4x, update = %u) process stop count = %u", process->ProcessID(), update, process->StopCount());
@@ -250,6 +250,11 @@
                 {
                     // We don't have this thread, lets add it.
                     thread_sp.reset(new MachThread(process, tid));
+
+                    // Add the new thread regardless of its is user ready state...
+                    if (new_threads)
+                        new_threads->push_back(thread_sp);
+
                     // Make sure the thread is ready to be displayed and shown to users
                     // before we add this thread to our list...
                     if (thread_sp->IsUserReady())
@@ -320,6 +325,24 @@
         assert (thread_action);
         thread->ThreadWillResume (thread_action);
     }
+    
+    if (DNBLogCheckLogBit(LOG_THREAD))
+    {
+        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)
+            {
+                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());
+            }
+        }
+    }
 }
 
 uint32_t

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h?rev=124110&r1=124109&r2=124110&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h Mon Jan 24 00:11:50 2011
@@ -59,7 +59,7 @@
     typedef collection::iterator        iterator;
     typedef collection::const_iterator  const_iterator;
 
-    uint32_t        UpdateThreadList (MachProcess *process, bool update);
+    uint32_t        UpdateThreadList (MachProcess *process, bool update, collection *num_threads = NULL);
 //  const_iterator  FindThreadByID (thread_t tid) const;
 
     collection      m_threads;





More information about the lldb-commits mailing list