Stop the driver from handling SIGPIPE in case we communicate with stale 
sockets so the driver doesn't just crash.

Added support for connecting to named sockets (unix IPC sockets) in
ConnectionFileDescriptor.

Modified the Host::LaunchInNewTerminal() for MacOSX to return the process
ID of the inferior process instead of the process ID of the Terminal.app. This
was done by modifying the "darwin-debug" executable to connect to lldb through
a named unix socket which is passed down as an argument. This allows a quick
handshake between "lldb" and "darwin-debug" so we can get the process ID
of the inferior and then attach by process ID and avoid attaching to the 
inferior by process name since there could be more than one process with 
that name. This still has possible race conditions, those will be fixed
in the near future. This fixes the SIGPIPE issues that were sometimes being
seen when task_for_pid was failing.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116792 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectProcess.cpp b/source/Commands/CommandObjectProcess.cpp
index ea3bd95..82d664b 100644
--- a/source/Commands/CommandObjectProcess.cpp
+++ b/source/Commands/CommandObjectProcess.cpp
@@ -216,29 +216,14 @@
         if (m_options.in_new_tty)
         {
         
-            lldb::pid_t terminal_pid = Host::LaunchInNewTerminal (inferior_argv,
-                                                                  inferior_envp,
-                                                                  &exe_module->GetArchitecture(),
-                                                                  true,
-                                                                  process->GetDisableASLR());
+            lldb::pid_t pid = Host::LaunchInNewTerminal (inferior_argv,
+                                                         inferior_envp,
+                                                         &exe_module->GetArchitecture(),
+                                                         true,
+                                                         process->GetDisableASLR());
             
-            // Let the app get launched and stopped...
-            const char *process_name = exe_module->GetFileSpec().GetFilename().AsCString("<invalid>");
-
-            if (terminal_pid == LLDB_INVALID_PROCESS_ID)
-            {
-                error.SetErrorStringWithFormat ("failed to launch '%s' in new terminal", process_name);
-            }
-            else
-            {
-                for (int i=0; i<20; i++)
-                {
-                    usleep (250000);
-                    error = process->Attach (process_name, false);
-                    if (error.Success())
-                        break;
-                }
-            }
+            if (pid != LLDB_INVALID_PROCESS_ID)
+                error = process->Attach (pid);
         }
         else
         {