[Lldb-commits] [PATCH] D71633: [lldb-vscode] Only close the debuggers in/out when DAP is over stdin/out
Greg Clayton via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 17 19:14:27 PST 2019
clayborg requested changes to this revision.
clayborg added inline comments.
This revision now requires changes to proceed.
================
Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:1202-1212
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. However, if the communication is via sockets
----------------
Test if this is a socket first so we don't open dev null is we don't need to:
```
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);
}
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71633/new/
https://reviews.llvm.org/D71633
More information about the lldb-commits
mailing list