Nerixyz wrote:

> It sounds like the ProcessLaunchInfo is leaking the PTY reference somewhere, 
> should we also fix that? Is that Windows specific?

In the case of running the process with `process launch`, the 
`ProcessLaunchInfo` comes from the 
[`CommandObjectProcessLaunch`](https://github.com/llvm/llvm-project/blob/e2cbb0266b02777d4f510b0e2a5f41b0760b9850/lldb/source/Commands/CommandObjectProcess.cpp#L246),
 so it's destroyed when the command object is destroyed. For lldb-dap, the 
launch info from the target is used - it's destroyed when the target is 
destroyed.

When running a program multiple times with `process launch`, we'll reuse the 
same `ProcessLaunchInfo`, and thus the same `PTY` instance. On Unix, if I 
understand the `PseudoTerminal` correctly, then when we call 
[`OpenFirstAvailablePrimary`](https://github.com/llvm/llvm-project/blob/98adb3665883572bfcb6c7956d51fadb8af0311a/lldb/source/Host/common/PseudoTerminal.cpp#L65),
 the previous file descriptor will be overwritten. But I haven't debugged that 
this is actually what happens there.

At least on Windows, we should also close the handles in the destructor and in 
`OpenPseudoConsole`. Probably in a separate PR.




https://github.com/llvm/llvm-project/pull/175837
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to