llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

<details>
<summary>Changes</summary>

This patch ensures lldb will not try to read from a PseudoConsole if it has not 
been opened.

This patch fixes https://github.com/llvm/llvm-project/issues/175652.

---
Full diff: https://github.com/llvm/llvm-project/pull/177934.diff


1 Files Affected:

- (modified) lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp (+7-3) 


``````````diff
diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp 
b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index 7d5a5a503474c..77552f1073879 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -522,9 +522,13 @@ ProcessSP PlatformWindows::DebugProcess(ProcessLaunchInfo 
&launch_info,
     return nullptr;
   error = process_sp->Launch(launch_info);
 #ifdef _WIN32
-  if (error.Success())
-    process_sp->SetPseudoConsoleHandle(launch_info.GetPTYSP());
-  else {
+  if (error.Success()) {
+    if (launch_info.GetPTY().GetPseudoTerminalHandle() !=
+            INVALID_HANDLE_VALUE &&
+        launch_info.GetNumFileActions() == 0 &&
+        launch_info.GetFlags().Test(lldb::eLaunchFlagLaunchInTTY))
+      process_sp->SetPseudoConsoleHandle(launch_info.GetPTYSP());
+  } else {
     Log *log = GetLog(LLDBLog::Platform);
     LLDB_LOGF(log, "Platform::%s LaunchProcess() failed: %s", __FUNCTION__,
               error.AsCString());

``````````

</details>


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

Reply via email to