Bug ID 32149
Summary Interrupting inferior during a getline causes the stream to fail
Product lldb
Version 4.0
Hardware Macintosh
OS MacOS X
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter malaperle@gmail.com
CC llvm-bugs@lists.llvm.org
- macOS 10.12.3
- LLDB from trunk or lldb-360.1.70 (Xcode 8.2.1)
1. Create an executable with this code:
#include <iostream>
#include <string>
int main() {
while (std::cin.good()) {
std::string Line;
std::getline(std::cin, Line);
}
return 0;
}
2. Start debugging it with LLDB (lldb a.out)
3. "run"
4. Once it starts running, interrupt it (Ctrl-C)
5. Once it's stopped, do "continue"
Process terminates!
If I look at the error state bits of the stream, the fail and eof bits are set.
This bug is particularly an issue for me as I am trying to debug clangd (part
of clang-tools-extra) which spends much of its time waiting for input on stdin.
If I try to attach to it, it interrupt it then when I resume, it terminates.
Interestingly, on Linux with LLDB 3.8, this problem doesn't occur.