Now that I fixed the uninitialized callback problem, I can enable GCD pid
monitoring on darwin in the host layer.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@144918 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Host/common/Host.cpp b/source/Host/common/Host.cpp
index 464afdc..0f2f3ef 100644
--- a/source/Host/common/Host.cpp
+++ b/source/Host/common/Host.cpp
@@ -57,7 +57,7 @@
 using namespace lldb_private;
 
 
-#if 1 // !defined (__APPLE__)
+#if !defined (__APPLE__)
 struct MonitorInfo
 {
     lldb::pid_t pid;                            // The process ID to monitor
diff --git a/source/Host/macosx/Host.mm b/source/Host/macosx/Host.mm
index db5c8e2..84c79c8 100644
--- a/source/Host/macosx/Host.mm
+++ b/source/Host/macosx/Host.mm
@@ -1421,8 +1421,6 @@
     return error;
 }
 
-#if 0
-
 lldb::thread_t
 Host::StartMonitoringChildProcess (Host::MonitorChildProcessCallback callback,
                                    void *callback_baton,
@@ -1434,29 +1432,29 @@
     if (monitor_signals)
         mask |= DISPATCH_PROC_SIGNAL;
 
+    LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST | LIBLLDB_LOG_PROCESS));
+
 
     dispatch_source_t source = ::dispatch_source_create (DISPATCH_SOURCE_TYPE_PROC, 
                                                          pid, 
                                                          mask, 
                                                          ::dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT,0));
 
-    printf ("Host::StartMonitoringChildProcess (callback=%p, baton=%p, pid=%i, monitor_signals=%i) source = %p\n", 
-            callback, 
-            callback_baton, 
-            (int)pid, 
-            monitor_signals, 
-            source);
+    if (log)
+        log->Printf ("Host::StartMonitoringChildProcess (callback=%p, baton=%p, pid=%i, monitor_signals=%i) source = %p\n", 
+                     callback, 
+                     callback_baton, 
+                     (int)pid, 
+                     monitor_signals, 
+                     source);
 
     if (source)
     {
         ::dispatch_source_set_cancel_handler (source, ^{
-            printf ("::dispatch_source_set_cancel_handler (source=%p, ^{...\n", source);
             ::dispatch_release (source);
         });
         ::dispatch_source_set_event_handler (source, ^{
             
-            printf ("::dispatch_source_set_event_handler (source=%p, ^{...\n", source);
-
             int status= 0;
             int wait_pid = 0;
             bool cancel = false;
@@ -1494,7 +1492,6 @@
                     status_cstr = "???";
                 }
 
-                LogSP log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
                 if (log)
                     log->Printf ("::waitpid (pid = %i, &status, 0) => pid = %i, status = 0x%8.8x (%s), signal = %i, exit_status = %i",
                                  pid,
@@ -1509,7 +1506,6 @@
                 
                 if (exited)
                 {
-                    printf ("::dispatch_source_set_event_handler (source=%p, ^{...  dispatch_source_cancel(source);\n", source);
                     ::dispatch_source_cancel(source);
                 }
             }
@@ -1519,6 +1515,3 @@
     }
     return thread;
 }
-
-
-#endif