xbolva00 updated this revision to Diff 163882.
xbolva00 added a comment.

- Updated


https://reviews.llvm.org/D51615

Files:
  source/Core/Debugger.cpp


Index: source/Core/Debugger.cpp
===================================================================
--- source/Core/Debugger.cpp
+++ source/Core/Debugger.cpp
@@ -50,6 +50,7 @@
 
 #if defined(_WIN32)
 #include "lldb/Host/windows/PosixApi.h" // for PATH_MAX
+#include "windows.h"
 #endif
 
 #include "llvm/ADT/None.h"      // for None
@@ -804,6 +805,17 @@
   // Turn off use-color if we don't write to a terminal with color support.
   if (!m_output_file_sp->GetFile().GetIsTerminalWithColors())
     SetUseColor(false);
+
+#if defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+  // Enabling use of ANSI color codes because LLDB is using them to highlight
+  // text.
+  HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
+  DWORD mode;
+  GetConsoleMode(console, &mode);
+  mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
+  bool supported = SetConsoleMode(console, mode);
+  SetUseColor(supported);
+#endif
 }
 
 Debugger::~Debugger() { Clear(); }


Index: source/Core/Debugger.cpp
===================================================================
--- source/Core/Debugger.cpp
+++ source/Core/Debugger.cpp
@@ -50,6 +50,7 @@
 
 #if defined(_WIN32)
 #include "lldb/Host/windows/PosixApi.h" // for PATH_MAX
+#include "windows.h"
 #endif
 
 #include "llvm/ADT/None.h"      // for None
@@ -804,6 +805,17 @@
   // Turn off use-color if we don't write to a terminal with color support.
   if (!m_output_file_sp->GetFile().GetIsTerminalWithColors())
     SetUseColor(false);
+
+#if defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+  // Enabling use of ANSI color codes because LLDB is using them to highlight
+  // text.
+  HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
+  DWORD mode;
+  GetConsoleMode(console, &mode);
+  mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
+  bool supported = SetConsoleMode(console, mode);
+  SetUseColor(supported);
+#endif
 }
 
 Debugger::~Debugger() { Clear(); }
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to