diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2019-07-16 06:34:44 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2019-07-16 06:34:44 +0000 |
commit | ea3642c9cefb0c33d05f580609c5600dd80a5531 (patch) | |
tree | 17c5aa5d3dd50f90a1732469b4a6e291a9856c3a | |
parent | eea64000857628f1d85677504d9267ea7ca2efac (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@366187 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/lldb-vscode/IOStream.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/lldb-vscode/IOStream.cpp b/tools/lldb-vscode/IOStream.cpp index e07ae079f..4b11b90b4 100644 --- a/tools/lldb-vscode/IOStream.cpp +++ b/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) |