summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksiy Vyalov <ovyalov@google.com>2015-01-14 01:31:27 +0000
committerOleksiy Vyalov <ovyalov@google.com>2015-01-14 01:31:27 +0000
commit2b588ecdbb6fee1f1c22a792a64455677f38575b (patch)
tree978a05a8f0e8637c713db5d01b53994085b32a2a
parentc2c23c27253e46fc1526558fb93cd650b510a1dd (diff)
Extend PipePosix with support for named pipes/timeout-based IO and integrate it with GDBRemoteCommunication / lldb-gdbserver - include reviews fixes.
http://reviews.llvm.org/D6954 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@225923 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/lldb/Host/PipeBase.h3
-rw-r--r--include/lldb/Host/posix/PipePosix.h2
-rw-r--r--include/lldb/Host/windows/PipeWindows.h2
-rw-r--r--source/Host/common/PipeBase.cpp6
-rw-r--r--source/Host/posix/PipePosix.cpp2
-rw-r--r--source/Host/windows/PipeWindows.cpp2
-rw-r--r--source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp5
7 files changed, 7 insertions, 15 deletions
diff --git a/include/lldb/Host/PipeBase.h b/include/lldb/Host/PipeBase.h
index b22b2734a..8cad2507d 100644
--- a/include/lldb/Host/PipeBase.h
+++ b/include/lldb/Host/PipeBase.h
@@ -26,8 +26,7 @@ class PipeBase
virtual Error CreateNew(bool child_process_inherit) = 0;
virtual Error CreateNew(llvm::StringRef name, bool child_process_inherit) = 0;
- Error OpenAsReader(llvm::StringRef name, bool child_process_inherit);
- virtual Error OpenAsReaderWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) = 0;
+ virtual Error OpenAsReader(llvm::StringRef name, bool child_process_inherit) = 0;
Error OpenAsWriter(llvm::StringRef name, bool child_process_inherit);
virtual Error OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) = 0;
diff --git a/include/lldb/Host/posix/PipePosix.h b/include/lldb/Host/posix/PipePosix.h
index 6a29e6f4d..0ab3ff7f6 100644
--- a/include/lldb/Host/posix/PipePosix.h
+++ b/include/lldb/Host/posix/PipePosix.h
@@ -36,7 +36,7 @@ public:
Error
CreateNew(llvm::StringRef name, bool child_process_inherit) override;
Error
- OpenAsReaderWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) override;
+ OpenAsReader(llvm::StringRef name, bool child_process_inherit) override;
Error
OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) override;
diff --git a/include/lldb/Host/windows/PipeWindows.h b/include/lldb/Host/windows/PipeWindows.h
index a29239250..02b7d470c 100644
--- a/include/lldb/Host/windows/PipeWindows.h
+++ b/include/lldb/Host/windows/PipeWindows.h
@@ -31,7 +31,7 @@ class PipeWindows : public PipeBase
Error CreateNew(bool child_process_inherit) override;
Error CreateNew(llvm::StringRef name, bool child_process_inherit) override;
- Error OpenAsReaderWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) override;
+ Error OpenAsReader(llvm::StringRef name, bool child_process_inherit) override;
Error OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) override;
bool CanRead() const override;
diff --git a/source/Host/common/PipeBase.cpp b/source/Host/common/PipeBase.cpp
index 3b1932c54..a9d6e6f46 100644
--- a/source/Host/common/PipeBase.cpp
+++ b/source/Host/common/PipeBase.cpp
@@ -15,12 +15,6 @@ using namespace lldb_private;
PipeBase::~PipeBase() = default;
Error
-PipeBase::OpenAsReader(llvm::StringRef name, bool child_process_inherit)
-{
- return OpenAsReaderWithTimeout(name, child_process_inherit, std::chrono::microseconds::zero());
-}
-
-Error
PipeBase::OpenAsWriter(llvm::StringRef name, bool child_process_inherit)
{
return OpenAsWriterWithTimeout(name, child_process_inherit, std::chrono::microseconds::zero());
diff --git a/source/Host/posix/PipePosix.cpp b/source/Host/posix/PipePosix.cpp
index c4706cd02..02838ec51 100644
--- a/source/Host/posix/PipePosix.cpp
+++ b/source/Host/posix/PipePosix.cpp
@@ -183,7 +183,7 @@ PipePosix::CreateNew(llvm::StringRef name, bool child_process_inherit)
}
Error
-PipePosix::OpenAsReaderWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout)
+PipePosix::OpenAsReader(llvm::StringRef name, bool child_process_inherit)
{
if (CanRead() || CanWrite())
return Error("Pipe is already opened");
diff --git a/source/Host/windows/PipeWindows.cpp b/source/Host/windows/PipeWindows.cpp
index ad87b9e3a..852630eb0 100644
--- a/source/Host/windows/PipeWindows.cpp
+++ b/source/Host/windows/PipeWindows.cpp
@@ -90,7 +90,7 @@ PipeWindows::CreateNew(llvm::StringRef name, bool child_process_inherit)
}
Error
-PipeWindows::OpenAsReaderWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout)
+PipeWindows::OpenAsReader(llvm::StringRef name, bool child_process_inherit)
{
if (CanRead() || CanWrite())
return Error(ERROR_ALREADY_EXISTS, eErrorTypeWin32);
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 2a944a769..919fa5405 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -876,15 +876,14 @@ GDBRemoteCommunication::StartDebugserverProcess (const char *hostname,
{
if (named_pipe_path[0])
{
- const auto timeout = std::chrono::microseconds(10 * 1000000);
- error = port_named_pipe.OpenAsReaderWithTimeout(named_pipe_path, false, timeout);
+ error = port_named_pipe.OpenAsReader(named_pipe_path, false);
if (error.Success())
{
char port_cstr[256];
port_cstr[0] = '\0';
size_t num_bytes = sizeof(port_cstr);
// Read port from pipe with 10 second timeout.
- error = port_named_pipe.ReadWithTimeout(port_cstr, num_bytes, timeout, num_bytes);
+ error = port_named_pipe.ReadWithTimeout(port_cstr, num_bytes, std::chrono::microseconds(10 * 1000000), num_bytes);
if (error.Success())
{
assert (num_bytes > 0 && port_cstr[num_bytes-1] == '\0');