diff options
author | Zachary Turner <zturner@google.com> | 2014-12-17 18:02:19 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2014-12-17 18:02:19 +0000 |
commit | 0b9d3eefdbf2c9bb50e139c5272b413e8227d842 (patch) | |
tree | fa6ac73e658e94d59432d15646ce1416662954f0 /lldb/source/Interpreter/ScriptInterpreterPython.cpp | |
parent | 06b2c54db9132bc7b6e599c2a3252ea7f2a8b33b (diff) | |
download | bcm5719-llvm-0b9d3eefdbf2c9bb50e139c5272b413e8227d842.tar.gz bcm5719-llvm-0b9d3eefdbf2c9bb50e139c5272b413e8227d842.zip |
Enhance the Pipe interface for better portability.
This patch makes a number of improvements to the Pipe interface.
1) An interface (PipeBase) is provided which exposes pure virtual
methods for any implementation of Pipe to override. While not
strictly necessary, this helps catch errors where the interfaces
are out of sync.
2) All methods return lldb_private::Error instead of returning bool
or void. This allows richer error information to be propagated
up to LLDB.
3) A new ReadWithTimeout() method is exposed in the base class and
implemented on Windows.
4) Support for both named and anonymous pipes is exposed through the
base interface and implemented on Windows. For creating a new
pipe, both named and anonymous pipes are supported, and for
opening an existing pipe, only named pipes are supported.
New methods described in points #3 and #4 are stubbed out on posix,
but fully implemented on Windows. These should be implemented by
someone on the linux / mac / bsd side.
Reviewed by: Greg Clayton, Oleksiy Vyalov
Differential Revision: http://reviews.llvm.org/D6686
llvm-svn: 224442
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreterPython.cpp')
-rw-r--r-- | lldb/source/Interpreter/ScriptInterpreterPython.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index d53a16bc820..cf7a3019268 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -603,18 +603,14 @@ ScriptInterpreterPython::ExecuteOneLine (const char *command, CommandReturnObjec // Set output to a temporary file so we can forward the results on to the result object Pipe pipe; -#if defined(_WIN32) - // By default Windows does not create a pipe object that can be used for a non-blocking read. - // We must explicitly request it. Furthermore, we can't use an fd for non-blocking read - // operations, and must use the native os HANDLE. - if (pipe.Open(true, false)) + Error pipe_result = pipe.CreateNew(false); + if (pipe_result.Success()) { +#if defined(_WIN32) lldb::file_t read_file = pipe.GetReadNativeHandle(); pipe.ReleaseReadFileDescriptor(); std::unique_ptr<ConnectionGenericFile> conn_ap(new ConnectionGenericFile(read_file, true)); #else - if (pipe.Open()) - { std::unique_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor(pipe.ReleaseReadFileDescriptor(), true)); #endif if (conn_ap->IsConnected()) |