[Lldb-commits] [lldb] r225923 - Extend PipePosix with support for named pipes/timeout-based IO and integrate it with GDBRemoteCommunication / lldb-gdbserver - include reviews fixes.

Oleksiy Vyalov ovyalov at google.com
Tue Jan 13 17:31:27 PST 2015


Author: ovyalov
Date: Tue Jan 13 19:31:27 2015
New Revision: 225923

URL: http://llvm.org/viewvc/llvm-project?rev=225923&view=rev
Log:
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


Modified:
    lldb/trunk/include/lldb/Host/PipeBase.h
    lldb/trunk/include/lldb/Host/posix/PipePosix.h
    lldb/trunk/include/lldb/Host/windows/PipeWindows.h
    lldb/trunk/source/Host/common/PipeBase.cpp
    lldb/trunk/source/Host/posix/PipePosix.cpp
    lldb/trunk/source/Host/windows/PipeWindows.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Modified: lldb/trunk/include/lldb/Host/PipeBase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/PipeBase.h?rev=225923&r1=225922&r2=225923&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/PipeBase.h (original)
+++ lldb/trunk/include/lldb/Host/PipeBase.h Tue Jan 13 19:31:27 2015
@@ -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;

Modified: lldb/trunk/include/lldb/Host/posix/PipePosix.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/PipePosix.h?rev=225923&r1=225922&r2=225923&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/posix/PipePosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/PipePosix.h Tue Jan 13 19:31:27 2015
@@ -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;
 

Modified: lldb/trunk/include/lldb/Host/windows/PipeWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/PipeWindows.h?rev=225923&r1=225922&r2=225923&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/PipeWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/PipeWindows.h Tue Jan 13 19:31:27 2015
@@ -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;

Modified: lldb/trunk/source/Host/common/PipeBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/PipeBase.cpp?rev=225923&r1=225922&r2=225923&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/PipeBase.cpp (original)
+++ lldb/trunk/source/Host/common/PipeBase.cpp Tue Jan 13 19:31:27 2015
@@ -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());

Modified: lldb/trunk/source/Host/posix/PipePosix.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/PipePosix.cpp?rev=225923&r1=225922&r2=225923&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/PipePosix.cpp (original)
+++ lldb/trunk/source/Host/posix/PipePosix.cpp Tue Jan 13 19:31:27 2015
@@ -183,7 +183,7 @@ PipePosix::CreateNew(llvm::StringRef nam
 }
 
 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");

Modified: lldb/trunk/source/Host/windows/PipeWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/PipeWindows.cpp?rev=225923&r1=225922&r2=225923&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/PipeWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/PipeWindows.cpp Tue Jan 13 19:31:27 2015
@@ -90,7 +90,7 @@ PipeWindows::CreateNew(llvm::StringRef n
 }
 
 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);

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=225923&r1=225922&r2=225923&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Tue Jan 13 19:31:27 2015
@@ -876,15 +876,14 @@ GDBRemoteCommunication::StartDebugserver
         {
             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');





More information about the lldb-commits mailing list