<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/152935>152935</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            lldb interferes with some stdin input
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          markpizz
      </td>
    </tr>
</table>

<pre>
    Using lldb to debug an application which reads raw characters from stdin has unexpected behavior when Enter (aka ^M or \r) is entered.  The character that read returns is newline (aka ^J or \n).

Running the same program without the debugger or under gdb does not have this problem.  I have observed this on macOS and various Linux distros.

The attached program demonstrates the problem:
```
    % clang -g lldb_demo.c -o lldb_demo
    mark@marks-mac-mini ~ % sudo bash
 Password:
    # lldb ./lldb_demo
    (lldb) target create "./lldb_demo"
 Current executable set to '/Users/mark/lldb_demo' (arm64).
    (lldb) run
    Process 41466 launched: '/Users/mark/lldb_demo' (arm64)
    Type to see what happens.  See what ^M (aka Enter) produces
    Exit with ^D
 Character read was: '^J' - 0x0A
    Character read was: '^D' - 0x04
 Exiting
    Process 41466 exited with status = 0 (0x00000000) 
    (lldb) q
    # 
```

[lldb_demo.c.gz](https://github.com/user-attachments/files/21706954/lldb_demo.c.gz)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVE2P2zYQ_TX0ZWCBpiSvfdBhE6-BBi0aNMm5GIljkY1EqhzSdvbQ315Q1n5kWwSIIYAwZ-bN47xHIrPtHVEj6neiPqwwReNDM2L4OtnHx1Xr9bfmC1vXwzDoFqIHTW3qAR3gNA22w2i9g4uxnYFAqBkCXqAzGLCLFBhOwY_AUVsHBhmSo-tEXSQNLRk8Wx_gYsjBg4sUQKgdfkUQ9cNv4AOI-n0Qag-WgXKcdAHw2dBLA4gG49wZAsUUHOdkR5fBOnoF92GBc0LtCyHvhbz_IzmXTxYNAeNIMAXfBxzhYqP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