Index: tools/lldb-vscode/VSCode.cpp =================================================================== --- tools/lldb-vscode/VSCode.cpp +++ tools/lldb-vscode/VSCode.cpp @@ -14,6 +14,11 @@ #include "VSCode.h" #include "LLDBUtils.h" +#if defined(_WIN32) +#include +#include +#endif + using namespace lldb_vscode; namespace { @@ -39,6 +44,13 @@ focus_tid(LLDB_INVALID_THREAD_ID), sent_terminated_event(false), stop_at_entry(false) { const char *log_file_path = getenv("LLDBVSCODE_LOG"); +#if defined(_WIN32) +// Windows opens stdout and stdin in text mode which converts \n to 13,10 +// while the value is just 10 on Darwin/Linux. Setting the file mode to binary +// fixes this. + assert(_setmode(fileno(stdout), _O_BINARY)); + assert(_setmode(fileno(stdin), _O_BINARY)); +#endif if (log_file_path) log.reset(new std::ofstream(log_file_path)); }