[Lldb-commits] [PATCH] D71633: [lldb-vscode] Only close the debuggers in/out when DAP is over stdin/out
Nathan Lanza via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 17 15:34:10 PST 2019
lanza created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
The DAP is usually communicated over STDIN and STDOUT and thus lldb's
Debugger instance printing and reading from these files can cause
conflicts. However, if the DAP communication was set up to be done via
a socket then we can leave these files open as they can provide
valueable logging and feedback to the user.
Repository:
rG LLVM Github Monorepo
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
@@ -1200,11 +1200,13 @@
// 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 (out && !g_vsc.input.descriptor.m_is_socket) {
+ // 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.
+ // 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);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71633.234405.patch
Type: text/x-patch
Size: 1127 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191217/722492b6/attachment.bin>
More information about the lldb-commits
mailing list