From 3fcbed6bda344dbf16dd0db8930b28d95bc4b4b4 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Tue, 19 Oct 2010 03:25:40 +0000 Subject: 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. llvm-svn: 116792 --- lldb/source/Commands/CommandObjectProcess.cpp | 29 +++++++-------------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'lldb/source/Commands/CommandObjectProcess.cpp') diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index ea3bd95d..82d664b 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -216,29 +216,14 @@ public: 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(""); - - 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 { -- cgit v1.1