http://bugs.llvm.org/show_bug.cgi?id=32149

Jim Ingham <jing...@apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #3 from Jim Ingham <jing...@apple.com> ---
Looks like getline uses LibC's getc on macOS.  All of the getc family can get
EINTR if something interrupts this read call.  

That attaching with a debugger interrupts an ongoing system call most likely
varies from system to system.  But it does happen on macOS, and isn't something
the debugger can control.

It looks like getline doesn't handle EINTR itself.  It also sets both bad and
eof to true on EINTR on OSX.  But I don't think you can rely on that because if
I close the input by sending ^D I get the same result.

Something like this works, but it's a little ugly:

#include <iostream>
#include <string>
#include <stdio.h>

int main() {
  errno = 0;
  while (errno == EINTR || !std::cin.eof()) {
    std::string Line;
    errno = 0;
    std::cin.clear();
    std::getline(std::cin, Line);
  }
  return 0;
}

Anyway, this isn't an issue with lldb.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

Reply via email to