[Lldb-commits] [lldb] r124084 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Core/Broadcaster.cpp source/Target/Process.cpp

Jim Ingham jingham at apple.com
Sun Jan 23 13:14:08 PST 2011


Author: jingham
Date: Sun Jan 23 15:14:08 2011
New Revision: 124084

URL: http://llvm.org/viewvc/llvm-project?rev=124084&view=rev
Log:
Add some more logging of broadcaster and Process.  Also, protect the event broadcasting against hijacking in mid-event delivery.

Modified:
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/source/Core/Broadcaster.cpp
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=124084&r1=124083&r2=124084&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Sun Jan 23 15:14:08 2011
@@ -2384,7 +2384,6 @@
 			isa = PBXProject;
 			buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */;
 			compatibilityVersion = "Xcode 3.1";
-			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				en,

Modified: lldb/trunk/source/Core/Broadcaster.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Broadcaster.cpp?rev=124084&r1=124083&r2=124084&view=diff
==============================================================================
--- lldb/trunk/source/Core/Broadcaster.cpp (original)
+++ lldb/trunk/source/Core/Broadcaster.cpp Sun Jan 23 15:14:08 2011
@@ -213,16 +213,18 @@
 
     const uint32_t event_type = event_sp->GetType();
 
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
+    Mutex::Locker event_types_locker(m_listeners_mutex);
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_EVENTS | LIBLLDB_LOG_PROCESS));
     if (log)
     {
         StreamString event_description;
         event_sp->Dump  (&event_description);
-        log->Printf ("%p Broadcaster(\"%s\")::BroadcastEvent (event_sp = {%s}, unique =%i)",
+        log->Printf ("%p Broadcaster(\"%s\")::BroadcastEvent (event_sp = {%s}, unique =%i) hijack = %p",
                      this,
                      m_broadcaster_name.AsCString(""),
                      event_description.GetData(),
-                     unique);
+                     unique,
+                     m_hijacking_listener);
     }
 
     if (m_hijacking_listener != NULL && m_hijacking_mask & event_type)
@@ -233,7 +235,6 @@
     }
     else
     {
-        Mutex::Locker event_types_locker(m_listeners_mutex);
         collection::iterator pos, end = m_listeners.end();
 
 
@@ -270,7 +271,8 @@
 Broadcaster::HijackBroadcaster (Listener *listener, uint32_t event_mask)
 {
     Mutex::Locker event_types_locker(m_listeners_mutex);
-
+    assert (m_hijacking_listener == NULL);
+    
     if (m_hijacking_listener != NULL)
         return false;
     

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=124084&r1=124083&r2=124084&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Sun Jan 23 15:14:08 2011
@@ -2627,15 +2627,15 @@
 
     exe_ctx.thread->QueueThreadPlan(thread_plan_sp, true);
     
-    Listener listener("ClangFunction temporary listener");
+    Listener listener("lldb.process.listener.run-thread-plan");
     exe_ctx.process->HijackProcessEvents(&listener);
     
-    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
+    lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS));
     if (log)
     {
         StreamString s;
         thread_plan_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
-        log->Printf ("Resuming thread 0x%x to run thread plan \"%s\".", tid, s.GetData());
+        log->Printf ("Resuming thread %u - 0x%4.4x to run thread plan \"%s\".",  exe_ctx.thread->GetIndexID(), exe_ctx.thread->GetID(), s.GetData());
     }
     
     Error resume_error = exe_ctx.process->Resume ();
@@ -2738,14 +2738,15 @@
                 if (log)
                     log->Printf ("Halt failed: \"%s\", I'm just going to wait a little longer and see if the world gets nicer to me.", 
                                  halt_error.AsCString());
+                abort();
                 
-                    if (single_thread_timeout_usec != 0)
-                    {
-                        real_timeout = TimeValue::Now();
-                        real_timeout.OffsetWithMicroSeconds(single_thread_timeout_usec);
-                        timeout_ptr = &real_timeout;
-                    }
-                    continue;
+                if (single_thread_timeout_usec != 0)
+                {
+                    real_timeout = TimeValue::Now();
+                    real_timeout.OffsetWithMicroSeconds(single_thread_timeout_usec);
+                    timeout_ptr = &real_timeout;
+                }
+                continue;
             }
 
         }





More information about the lldb-commits mailing list