lanza updated this revision to Diff 234586. lanza added a comment. fixup according to Greg's requests
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71633/new/ https://reviews.llvm.org/D71633 Files: lldb/tools/lldb-vscode/lldb-vscode.cpp Index: lldb/tools/lldb-vscode/lldb-vscode.cpp =================================================================== --- lldb/tools/lldb-vscode/lldb-vscode.cpp +++ lldb/tools/lldb-vscode/lldb-vscode.cpp @@ -1199,14 +1199,18 @@ // before we are given an executable to launch in a "launch" request, or a // executable when attaching to a process by process ID in a "attach" // request. - FILE *out = llvm::sys::RetryAfterSignal(nullptr, fopen, dev_null_path, "w"); - if (out) { - // Set the output and error file handles to redirect into nothing otherwise - // if any code in LLDB prints to the debugger file handles, the output and - // error file handles are initialized to STDOUT and STDERR and any output - // will kill our debug session. - g_vsc.debugger.SetOutputFileHandle(out, true); - g_vsc.debugger.SetErrorFileHandle(out, false); + if (!g_vsc.input.descriptor.m_is_socket) { + FILE *out = llvm::sys::RetryAfterSignal(nullptr, fopen, dev_null_path, "w"); + if (out) { + // If the input and output descriptors are STDIN and STDOUT then we need + // to set the output and error file handles to redirect into nothing + // otherwise if any code in LLDB prints to the debugger file handles, the + // output and error file handles are initialized to STDOUT and STDERR and + // any output will kill our debug session. However, if the communication + // is via sockets then we can leave these open. + g_vsc.debugger.SetOutputFileHandle(out, true); + g_vsc.debugger.SetErrorFileHandle(out, false); + } } g_vsc.target = g_vsc.debugger.CreateTarget(nullptr);
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp =================================================================== --- lldb/tools/lldb-vscode/lldb-vscode.cpp +++ lldb/tools/lldb-vscode/lldb-vscode.cpp @@ -1199,14 +1199,18 @@ // before we are given an executable to launch in a "launch" request, or a // executable when attaching to a process by process ID in a "attach" // request. - FILE *out = llvm::sys::RetryAfterSignal(nullptr, fopen, dev_null_path, "w"); - if (out) { - // Set the output and error file handles to redirect into nothing otherwise - // if any code in LLDB prints to the debugger file handles, the output and - // error file handles are initialized to STDOUT and STDERR and any output - // will kill our debug session. - g_vsc.debugger.SetOutputFileHandle(out, true); - g_vsc.debugger.SetErrorFileHandle(out, false); + if (!g_vsc.input.descriptor.m_is_socket) { + FILE *out = llvm::sys::RetryAfterSignal(nullptr, fopen, dev_null_path, "w"); + if (out) { + // If the input and output descriptors are STDIN and STDOUT then we need + // to set the output and error file handles to redirect into nothing + // otherwise if any code in LLDB prints to the debugger file handles, the + // output and error file handles are initialized to STDOUT and STDERR and + // any output will kill our debug session. However, if the communication + // is via sockets then we can leave these open. + g_vsc.debugger.SetOutputFileHandle(out, true); + g_vsc.debugger.SetErrorFileHandle(out, false); + } } g_vsc.target = g_vsc.debugger.CreateTarget(nullptr);
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits