Skip to content

Commit d0ac188

Browse files
committed
[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
1 parent e215996 commit d0ac188

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lldb/tools/lldb-vscode/IOStream.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ bool InputStream::read_full(std::ofstream *log, size_t length,
101101
else
102102
bytes_read = ::read(descriptor.m_fd, ptr, length);
103103

104+
if (bytes_read == 0) {
105+
if (log)
106+
*log << "End of file (EOF) reading from input file.\n";
107+
return false;
108+
}
104109
if (bytes_read < 0) {
105110
int reason = 0;
106111
#if defined(_WIN32)

0 commit comments

Comments
 (0)