[Lldb-commits] [PATCH] D11609: Use only unnamed pipes to launch lldb-server gdbserver.

Chaoren Lin chaorenl at google.com
Thu Jul 30 10:49:17 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL243667: Use only unnamed pipes to launch lldb-server gdbserver. (authored by chaoren).

Changed prior to commit:
  http://reviews.llvm.org/D11609?vs=30946&id=31050#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11609

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

Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -1200,35 +1200,37 @@
             // output of the command into this file. We will later read this file
             // if all goes well and fill the data into "command_output_ptr"
 
+#if defined(__APPLE__)
             // Binding to port zero, we need to figure out what port it ends up
             // using using a named pipe...
             error = port_pipe.CreateWithUniqueName("debugserver-named-pipe", false, named_pipe_path);
-            if (error.Success())
+            if (error.Fail())
             {
-                debugserver_args.AppendArgument("--named-pipe");
-                debugserver_args.AppendArgument(named_pipe_path.c_str());
+                if (log)
+                    log->Printf("GDBRemoteCommunication::%s() "
+                            "named pipe creation failed: %s",
+                            __FUNCTION__, error.AsCString());
+                return error;
             }
-            else
+            debugserver_args.AppendArgument("--named-pipe");
+            debugserver_args.AppendArgument(named_pipe_path.c_str());
+#else
+            // Binding to port zero, we need to figure out what port it ends up
+            // using using an unnamed pipe...
+            error = port_pipe.CreateNew(true);
+            if (error.Fail())
             {
                 if (log)
                     log->Printf("GDBRemoteCommunication::%s() "
-                            "named pipe creation failed: %s",
+                            "unnamed pipe creation failed: %s",
                             __FUNCTION__, error.AsCString());
-                // let's try an unnamed pipe
-                error = port_pipe.CreateNew(true);
-                if (error.Fail())
-                {
-                    if (log)
-                        log->Printf("GDBRemoteCommunication::%s() "
-                                "unnamed pipe creation failed: %s",
-                                __FUNCTION__, error.AsCString());
-                    return error;
-                }
-                int write_fd = port_pipe.GetWriteFileDescriptor();
-                debugserver_args.AppendArgument("--pipe");
-                debugserver_args.AppendArgument(std::to_string(write_fd).c_str());
-                launch_info.AppendCloseFileAction(port_pipe.GetReadFileDescriptor());
+                return error;
             }
+            int write_fd = port_pipe.GetWriteFileDescriptor();
+            debugserver_args.AppendArgument("--pipe");
+            debugserver_args.AppendArgument(std::to_string(write_fd).c_str());
+            launch_info.AppendCloseFileAction(port_pipe.GetReadFileDescriptor());
+#endif
         }
         else
         {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11609.31050.patch
Type: text/x-patch
Size: 2996 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150730/ac7698ee/attachment.bin>


More information about the lldb-commits mailing list