xbolva00 added a comment.

In https://reviews.llvm.org/D51615#1222730, @teemperor wrote:

> Thanks! Didn't know we can activate this setting for the user.
>
> Some questions though: Should we restore this setting to the original value 
> after LLDB shuts down?


Good question. I tried run lldb, quit it and then I ran echo some ansi code in 
the same terminal. Ansi code wasn't resolved (same behaviour as before LLDB 
launch), so LLDB didn't modify something globally in the terminal.
I think we don't need to restore original value, but... suggestions welcome! :)

> And what happens if this code runs on a Windows version before 
> ENABLE_VIRTUAL_TERMINAL_PROCESSING was introduced? I see there some fallback 
> code, but it's not clear to me what it does and what will happen on older 
> platforms.

On older systems there is no ENABLE_VIRTUAL_TERMINAL_PROCESSING so we have
SetConsoleMode(0x004). On older systems Windows does not recognize 0x004 and 
function will return false.



================
Comment at: source/Core/Debugger.cpp:56
+#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
+#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
+#endif
----------------
teemperor wrote:
> Can you document why this has to be 0x0004? I assume older Windows versions 
> won't have ENABLE_VIRTUAL_TERMINAL_PROCESSING, so that should also be 
> documented that this code is covering this case.
https://docs.microsoft.com/en-us/windows/console/setconsolemode

Should I add a comment with this link?


================
Comment at: source/Core/Debugger.cpp:815
+#if defined(_WIN32)
+  HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
+  DWORD consoleMode;
----------------
teemperor wrote:
> A comment here would be nice. E.g. `// Enabling use of ANSI color codes 
> because LLDB is using them to highlight text.
Alright, will do.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D51615



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to