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)


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)
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH] ... Jan Kratochvil via Phabricator via lldb-commits

Reply via email to