[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
This commit is contained in:
Jan Kratochvil 2019-07-16 06:34:44 +00:00
parent e215996a29
commit d0ac1888aa
1 changed files with 5 additions and 0 deletions

View File

@ -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)