[Lldb-commits] [PATCH] D70387: [LLDB] [Windows] Allow making subprocesses use the debugger's console with LLDB_INHERIT_CONSOLE=true

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 19 00:22:21 PST 2019

labath added a comment.

In D70387#1750578 <https://reviews.llvm.org/D70387#1750578>, @mstorsjo wrote:

> Thanks for the excellent explanations of the situation so far. I'll have a look at how it behaves with input and other aspects of console sharing. You might be right that it can cause some issues, as I did run into cases where the main lldb console UI hung if the lldb-server subprocess crashed (due to unchecked Error), but I didn't realize and correlate this to the inherited/shared console at that time.

You'll probably want to look at the IOHandler classes at some point. The way input forwarding works on unixes is that we create a separate IOHandler object when the process is running. This object reads the lldb input and forwards it to the inferior pty (instead of the "normal" IOHandler, which interprets the input as commands to execute). If you'll have the inferior read from the console directly, then we don't want to have the forwarding IOHandler there. However, we also don't want the "normal" IOHandler to be active, as that will race with the inferior in reading the input (I am not sure what windows does in these cases). So you may need to create some "fake" IOHandler, which will not read anything, but just prevent the regular IOHandler from kicking in.

It's good that you mentioned lldb-server, because it's presence complicates this behavior even further. If we wanted the console sharing approach to work, then we'd have to have both lldb-server and the inferior launched in the console-sharing mode, I presume? This would be quite different from the unix scenario where we can just send the pty device name to the lldb-server, and have it connect the inferior to that. I'm not entirely sure what that means though...

> When passing flags like `--tty` or `--disable-stdio` to `process launch`, is it possible to set a persistent preference for that somehow via e.g. the `.lldbinit` file?

There's a `target.disable-stdio` setting. You could set that in your .lldbinit, if you wanted to. I doesn't look like there is a `--tty` equivalent of that, but I don't see a problem with adding one.




More information about the lldb-commits mailing list