aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
diff options
context:
space:
mode:
authorVince Harron <vince@nethacker.com>2015-05-13 00:25:54 +0000
committerVince Harron <vince@nethacker.com>2015-05-13 00:25:54 +0000
commitd7e6a4f2f07464acfe4fe98b4e4038c67c7b2975 (patch)
tree329d2a720739a7140401e3842b751aa7f0651c93 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
parent9bbc3653c5ccb170167b2ab3c4ec098be83a3d04 (diff)
downloadllvm-d7e6a4f2f07464acfe4fe98b4e4038c67c7b2975.zip
llvm-d7e6a4f2f07464acfe4fe98b4e4038c67c7b2975.tar.gz
llvm-d7e6a4f2f07464acfe4fe98b4e4038c67c7b2975.tar.bz2
Fixed a ton of gcc compile warnings
Removed some unused variables, added some consts, changed some casts to const_cast. I don't think any of these changes are very controversial. Differential Revision: http://reviews.llvm.org/D9674 llvm-svn: 237218
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp54
1 files changed, 23 insertions, 31 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 89d9876..fbd2047 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -772,48 +772,40 @@ GDBRemoteCommunication::StartDebugserverProcess (const char *hostname,
llvm::SmallString<PATH_MAX> named_pipe_path;
Pipe port_pipe;
- bool listen = false;
- if (host_and_port[0])
+ if (host_and_port[0] && in_port == 0)
{
// Create a temporary file to get the stdout/stderr and redirect the
// 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 (in_port == 0)
+ // 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())
{
- // 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())
- {
- debugserver_args.AppendArgument("--named-pipe");
- debugserver_args.AppendArgument(named_pipe_path.c_str());
- }
- else
+ debugserver_args.AppendArgument("--named-pipe");
+ debugserver_args.AppendArgument(named_pipe_path.c_str());
+ }
+ else
+ {
+ if (log)
+ log->Printf("GDBRemoteCommunication::%s() "
+ "named 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() "
- "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;
}
- }
- else
- {
- listen = true;
+ 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());
}
}
else