[Lldb-commits] [PATCH] D64698: Handle EOF from `lldb-vscode`

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Jul 13 15:51:45 PDT 2019


jankratochvil created this revision.
jankratochvil added reviewers: clayborg, labath, JDevlieghere.
jankratochvil added a project: LLDB.

Sometimes (when running `lldb-vscode` under `strace`) I get:

  read(0, "", 16)                         = 0
  read(0, "", 16)                         = 0
  read(0, "", 16)                         = 0
  ...

Patch is obvious, isn't it?  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 +++


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D64698

Files:
  lldb/tools/lldb-vscode/IOStream.cpp


Index: lldb/tools/lldb-vscode/IOStream.cpp
===================================================================
--- lldb/tools/lldb-vscode/IOStream.cpp
+++ lldb/tools/lldb-vscode/IOStream.cpp
@@ -101,6 +101,11 @@
     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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64698.209707.patch
Type: text/x-patch
Size: 490 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190713/dff23477/attachment.bin>


More information about the lldb-commits mailing list