[Lldb-commits] [lldb] r366187 - [lldb] Handle EOF from `lldb-vscode`

Jan Kratochvil via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 15 23:34:44 PDT 2019


Author: jankratochvil
Date: Mon Jul 15 23:34:44 2019
New Revision: 366187

URL: http://llvm.org/viewvc/llvm-project?rev=366187&view=rev
Log:
[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

Modified:
    lldb/trunk/tools/lldb-vscode/IOStream.cpp

Modified: lldb/trunk/tools/lldb-vscode/IOStream.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-vscode/IOStream.cpp?rev=366187&r1=366186&r2=366187&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-vscode/IOStream.cpp (original)
+++ lldb/trunk/tools/lldb-vscode/IOStream.cpp Mon Jul 15 23:34:44 2019
@@ -101,6 +101,11 @@ bool InputStream::read_full(std::ofstrea
     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)




More information about the lldb-commits mailing list