summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2014-12-04 22:06:42 +0000
committerZachary Turner <zturner@google.com>2014-12-04 22:06:42 +0000
commit9b69327b43c165b81fcd7012b6174c3bbd30bfc1 (patch)
tree2dfdd2151d78b8f079044bf411717105712834ca /lldb/source/Plugins/Process
parent7fc6f1e7945c8f704df9f779c6d0ab0f010c8d12 (diff)
downloadbcm5719-llvm-9b69327b43c165b81fcd7012b6174c3bbd30bfc1.tar.gz
bcm5719-llvm-9b69327b43c165b81fcd7012b6174c3bbd30bfc1.zip
Revert "Use timeout when reading debugserver's port from a named pipe."
This reverts commit 4a5ad2c077166cc3d6e7ab4cc6e3dcbbe922af86. Windows doesn't support select() for pipe objects, and this also fails to compile on Windows. Reverting this until we can get it sorted out to keep the windows build working. llvm-svn: 223392
Diffstat (limited to 'lldb/source/Plugins/Process')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp67
1 files changed, 12 insertions, 55 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index e0b9ce01f80..032d74cbbe0 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -13,7 +13,6 @@
// C Includes
#include <limits.h>
#include <string.h>
-#include <sys/select.h>
#include <sys/stat.h>
// C++ Includes
@@ -43,50 +42,6 @@
using namespace lldb;
using namespace lldb_private;
-namespace
-{
-
-Error
-ReadPortFromPipe (const char *const named_pipe_path, uint16_t& port, const int timeout_secs)
-{
- File name_pipe_file;
- auto error = name_pipe_file.Open (named_pipe_path, File::eOpenOptionRead | File::eOpenOptionNonBlocking);
- if (error.Fail ())
- return error;
-
- struct timeval tv = {timeout_secs, 0};
- const auto pipe_handle = name_pipe_file.GetWaitableHandle ();
- fd_set rfds;
- FD_ZERO(&rfds);
- FD_SET(pipe_handle, &rfds);
-
- const auto retval = ::select (pipe_handle + 1, &rfds, NULL, NULL, &tv);
- if (retval == -1)
- {
- error.SetErrorToErrno ();
- return error;
- }
- if (retval == 0)
- {
- error.SetErrorString ("timeout exceeded");
- return error;
- }
-
- char port_cstr[256];
- port_cstr[0] = '\0';
- size_t num_bytes = sizeof(port_cstr);
- error = name_pipe_file.Read (port_cstr, num_bytes);
-
- if (error.Success ())
- {
- assert (num_bytes > 0 && port_cstr[num_bytes-1] == '\0');
- port = Args::StringToUInt32 (port_cstr, 0);
- }
- return error;
-}
-
-}
-
GDBRemoteCommunication::History::History (uint32_t size) :
m_packets(),
m_curr_idx (0),
@@ -917,23 +872,25 @@ GDBRemoteCommunication::StartDebugserverProcess (const char *hostname,
launch_info.AppendSuppressFileAction (STDIN_FILENO, true, false);
launch_info.AppendSuppressFileAction (STDOUT_FILENO, false, true);
launch_info.AppendSuppressFileAction (STDERR_FILENO, false, true);
-
+
error = Host::LaunchProcess(launch_info);
-
+
if (error.Success() && launch_info.GetProcessID() != LLDB_INVALID_PROCESS_ID)
{
if (named_pipe_path[0])
{
- error = ReadPortFromPipe(named_pipe_path, out_port, 10);
+ File name_pipe_file;
+ error = name_pipe_file.Open(named_pipe_path, File::eOpenOptionRead);
if (error.Success())
{
- if (log)
- log->Printf("GDBRemoteCommunication::%s() debugserver listens %u port", __FUNCTION__, out_port);
- }
- else
- {
- if (log)
- log->Printf("GDBRemoteCommunication::%s() failed to read a port value from named pipe %s: %s", __FUNCTION__, named_pipe_path, error.AsCString());
+ 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();
}
FileSystem::Unlink(named_pipe_path);
}
OpenPOWER on IntegriCloud