[lldb-dev] [Bug 32149] New: Interrupting inferior during a getline causes the stream to fail

via lldb-dev lldb-dev at lists.llvm.org
Mon Mar 6 06:39:57 PST 2017


            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 at lists.llvm.org
          Reporter: malaperle at gmail.com
                CC: llvm-bugs at 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.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20170306/de6a9f23/attachment.html>

More information about the lldb-dev mailing list