[Lldb-commits] [lldb] r202536 - Be sure to propagate the error back out SBTarget::Attach() when we fail to launch debugserver as root.

Greg Clayton gclayton at apple.com
Fri Feb 28 12:47:08 PST 2014


Author: gclayton
Date: Fri Feb 28 14:47:08 2014
New Revision: 202536

URL: http://llvm.org/viewvc/llvm-project?rev=202536&view=rev
Log:
Be sure to propagate the error back out SBTarget::Attach() when we fail to launch debugserver as root.

<rdar://problem/15669788>


Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=202536&r1=202535&r2=202536&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Fri Feb 28 14:47:08 2014
@@ -768,31 +768,34 @@ GDBRemoteCommunication::StartDebugserver
         
         error = Host::LaunchProcess(launch_info);
         
-        if (named_pipe_path[0])
+        if (error.Success() && launch_info.GetProcessID() != LLDB_INVALID_PROCESS_ID)
         {
-            File name_pipe_file;
-            error = name_pipe_file.Open(named_pipe_path, File::eOpenOptionRead);
-            if (error.Success())
+            if (named_pipe_path[0])
             {
-                char port_cstr[256];
-                port_cstr[0] = '\0';
-                size_t num_bytes = sizeof(port_cstr);
-                error = name_pipe_file.Read(port_cstr, num_bytes);
-                assert (error.Success());
-                assert (num_bytes > 0 && port_cstr[num_bytes-1] == '\0');
-                out_port = Args::StringToUInt32(port_cstr, 0);
-                name_pipe_file.Close();
+                File name_pipe_file;
+                error = name_pipe_file.Open(named_pipe_path, File::eOpenOptionRead);
+                if (error.Success())
+                {
+                    char port_cstr[256];
+                    port_cstr[0] = '\0';
+                    size_t num_bytes = sizeof(port_cstr);
+                    error = name_pipe_file.Read(port_cstr, num_bytes);
+                    assert (error.Success());
+                    assert (num_bytes > 0 && port_cstr[num_bytes-1] == '\0');
+                    out_port = Args::StringToUInt32(port_cstr, 0);
+                    name_pipe_file.Close();
+                }
+                Host::Unlink(named_pipe_path);
+            }
+            else if (listen)
+            {
+                
+            }
+            else
+            {
+                // Make sure we actually connect with the debugserver...
+                JoinListenThread();
             }
-            Host::Unlink(named_pipe_path);
-        }
-        else if (listen)
-        {
-            
-        }
-        else
-        {
-            // Make sure we actually connect with the debugserver...
-            JoinListenThread();
         }
     }
     else





More information about the lldb-commits mailing list