[Lldb-commits] [lldb] [lldb][windows] prevent IOHandlerProcessSTDIOWindows from consuming non text inputs (PR #175812)

Charles Zablit via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 21 06:13:45 PST 2026


charles-zablit wrote:

I have been experimenting with this and found 2 things:
1. Running `lldb foo.exe` does not use the conpty. But we were setting up the IOHandler for it anyways. I have added a check in `PlatformWindows.cpp` to fix that:
```cpp
HPCON hPC = launch_info.GetPTY().GetPseudoTerminalHandle();
  if (error.Success()) {
    if (hPC != INVALID_HANDLE_VALUE &&
                 launch_info.GetNumFileActions() == 0 &&
                 launch_info.GetFlags().Test(lldb::eLaunchFlagLaunchInTTY))
      process_sp->SetPseudoConsoleHandle(launch_info.GetPTYSP());
  }
```

This matches the old behavior from release 21.x, where forwarding stdin to the debuggee does not work either.

2. We are using CRT buffered handles in the `File` and `NativeFile` classes. This has side effects, one of them being that `WaitForSingleObject` does not work consistently (from my findings). Fixing this will take a larger amount of refactoring.

I see 2 paths forward to fix `release/22.1`:
1. revert the changes which introduces the ConPTY in the first place. This brings us back to the old behavior, which is also broken.
2. we take the changes in `PlatformWindows.cpp` from above and backport them to `22.x`. This reverts to the old (broken) behavior but allows us to keep the lldb dap tests running.

I'm in favor of 2 since it's the minimal size change.

https://github.com/llvm/llvm-project/pull/175812


More information about the lldb-commits mailing list