summaryrefslogtreecommitdiffstats
path: root/lldb/tools/lldb-vscode/IOStream.cpp
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2019-07-16 06:34:44 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2019-07-16 06:34:44 +0000
commitd0ac1888aab490589788bd51a9f44f7745dc5819 (patch)
tree8cd52ea12244ca4d9644382b837afdef72564ab9 /lldb/tools/lldb-vscode/IOStream.cpp
parente215996a2932ed7c472f4e94dc4345b30fd0c373 (diff)
downloadbcm5719-llvm-d0ac1888aab490589788bd51a9f44f7745dc5819.tar.gz
bcm5719-llvm-d0ac1888aab490589788bd51a9f44f7745dc5819.zip
[lldb] Handle EOF from `lldb-vscode`
Sometimes (when running lldb-vscode under strace) I get: read(0, "", 16) = 0 read(0, "", 16) = 0 read(0, "", 16) = 0 ... With this patch testcases finish properly even with strace: read(0, "", 16) = 0 futex(0x1346508, FUTEX_WAKE_PRIVATE, 2147483647) = 0 stat("", 0x7ffe8f2634c8) = -1 ENOENT (No such file or directory) --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=9124, si_uid=1001, si_status=SIGINT, si_utime=1, si_stime=0} --- close(4) = 0 exit_group(0) = ? +++ exited with 0 +++ Differential Revision: https://reviews.llvm.org/D64698 llvm-svn: 366187
Diffstat (limited to 'lldb/tools/lldb-vscode/IOStream.cpp')
-rw-r--r--lldb/tools/lldb-vscode/IOStream.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lldb/tools/lldb-vscode/IOStream.cpp b/lldb/tools/lldb-vscode/IOStream.cpp
index e07ae079f7e..4b11b90b4c2 100644
--- a/lldb/tools/lldb-vscode/IOStream.cpp
+++ b/lldb/tools/lldb-vscode/IOStream.cpp
@@ -101,6 +101,11 @@ bool InputStream::read_full(std::ofstream *log, size_t length,
else
bytes_read = ::read(descriptor.m_fd, ptr, length);
+ if (bytes_read == 0) {
+ if (log)
+ *log << "End of file (EOF) reading from input file.\n";
+ return false;
+ }
if (bytes_read < 0) {
int reason = 0;
#if defined(_WIN32)
OpenPOWER on IntegriCloud