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

Martin Storsjö via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 19 01:09:19 PST 2019

mstorsjo added a comment.

In D70387#1751090 <https://reviews.llvm.org/D70387#1751090>, @labath wrote:

> 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...

Yeah, I hadn't really thought much about that initially, and when using the environment variable, it was propagated implicitly to lldb-server as well, so this aspect worked just as I would have hoped.

>> 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.

Ok, thanks for the pointers!

So it turns out this is a harder (and messier) thing than I first expected (even though my naive fix worked fine for the simplest cases at least). I'm not sure if I have time to actually complete this right now, so it might end up on the pile of unfinished things for now.

FWIW, I did test with a command line executable that does a loop of fgets+printf, to read lines of input and echo them back. This seems very prone to hanging; on arm64 I manage to read one line and print it back, before the debuggee becomes hung, stuck in some IO write call, and later on (after interrupting and resuming it) the debugger itself also seems to easily get hung, waiting for some event from the debuggee. On x86_64, the same setup even seems to hang even earlier, before managing to type the first line to the separate console.




More information about the lldb-commits mailing list