aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
diff options
context:
space:
mode:
authorChaoren Lin <chaorenl@google.com>2015-07-30 17:48:44 +0000
committerChaoren Lin <chaorenl@google.com>2015-07-30 17:48:44 +0000
commit46951b596870d0e8895c355a8ad3459c54e78fb2 (patch)
tree8a89cd68bf3446c8add0a03017fe059b846e40b3 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
parentd6f7252e2ec08a66f5765b25ce70c4358392d6c1 (diff)
downloadllvm-46951b596870d0e8895c355a8ad3459c54e78fb2.zip
llvm-46951b596870d0e8895c355a8ad3459c54e78fb2.tar.gz
llvm-46951b596870d0e8895c355a8ad3459c54e78fb2.tar.bz2
Use only unnamed pipes to launch lldb-server gdbserver.
Summary: If we used unnamed pipes instead of named pipes, we can avoid having the file system littered with debugserver-named-pipes if lldb-server happens to crash for whatever reason. Also, on some buggy systems, it's possible to be able to create but not to delete a fifo. Ideally, support for unnamed pipes should be added to debugserver as well, so we can avoid the `#ifdef` here. Reviewers: clayborg, vharron, chying Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11609 llvm-svn: 243667
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 9c263c8..578f21c 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -1200,35 +1200,37 @@ GDBRemoteCommunication::StartDebugserverProcess (const char *hostname,
// 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
{