[Lldb-commits] [PATCH] D56196: ProcessLaunchInfo: Remove Target reference

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Jan 27 23:35:27 PST 2019

labath marked an inline comment as done.
labath added inline comments.

Comment at: lldb/trunk/source/Target/ProcessLaunchInfo.cpp:220
+  if (!m_pty->OpenFirstAvailableMaster(open_flags, nullptr, 0)) {
+    return llvm::createStringError(llvm::inconvertibleErrorCode(),
+                                   "PTY::OpenFirstAvailableMaster failed");
Hui wrote:
> Look like the windows implementation of OpenFirstAvailableMaster is missing.
> There was no error before these changes. 
> $ ./lldb-server.exe g *:2000 --log-channels="lldb all:gdb-remote all" "d:\\m.exe"
> 1548354703.504552364 lldb-server launch
> 1548354703.504905224 argv[0] = 'g'
> 1548354703.505040407 argv[1] = '--log-channels=lldb all:gdb-remote all'
> 1548354703.505141735 argv[2] = '*:2000'
> 1548354703.505235672 argv[3] = 'd:\m.exe'
> 1548354703.505473614 000000DBF458F040 Broadcaster::Broadcaster("gdb-remote.server")
> 1548354703.505620718 000000DBF458F040 Communication::Communication (name = gdb-remote.server)
> 1548354703.507417917 000000DBF458F658 Broadcaster::Broadcaster("process.stdio")
> 1548354703.507594585 000000DBF458F658 Communication::Communication (name = process.stdio)
> 1548354703.510816097 processlaunchinfo.cpp:SetUpPtyRedirection                    Generating a pty to use for stdin/out/err
> error: failed to launch 'd:\m.exe': PTY::OpenFirstAvailableMaster failed
Yes, there was no error before, though that doesn't mean that the code was correct. The reason you're seeing the error now is because I changed `GDBRemoteCommunicationServerLLGS::LaunchProcess` to check the error code, whereas previously it was ignoring it.

Overall, I think you'll have to figure out stdio forwarding sooner or later, but if it's enough for you right now to replicate the !lldb_server path and open a new terminal for the debugged app, then the easiest way to achieve that would be to move the pty setup code into the NativeProcess class. So, NativeProcessLinux/NetBSD would call `SetUpPtyRedirection` to do the usual stdout forwarding, and the windows process would do whatever it takes to create a new terminal window (and return -1 for `GetTerminalFileDescriptor`).




More information about the lldb-commits mailing list