[Lldb-commits] [lldb] Colorize output when searching for symbols in lldb (PR #69422)

via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 31 02:18:50 PDT 2023


taalhaataahir0102 wrote:

Hi David! 

> That file does essentially what you're doing using it. You'd use the strings found [here](https://github.com/llvm/llvm-project/blob/cbbb545c4618969850d88bb008ab7f1c2918d5c3/lldb/include/lldb/Utility/AnsiTerminal.h#L83) instead of the ASNI_...
>
> Which brings me onto the fact that this feature will have to respect the `use-color` setting. The function mentioned above allows you to pass a bool to it to do that, you can look at other callers of it to see how they get that bool. To set this setting in lldb itself

I searched for the function `FormatAnsiTerminalCodes` to see how the bool option is passed in other parts of LLDB. In most of the places, `GetUseColor()` function of Debugger class was used to check the use-color settings. So I decided to use this approach `interpreter->GetDebugger().GetUseColor()` inside printRed function.
Few instances:
https://lldb.llvm.org/cpp_reference/Debugger_8cpp_source.html#:~:text=std%3A%3Astring%20str%20%3D,226%20%20%20%20%20%20%20%20%20%20new_prompt%2C%20GetUseColor())%3B
https://lldb.llvm.org/cpp_reference/Debugger_8cpp_source.html#:~:text=const%20bool%20use_color,%2C%20message.c_str())%3B
I guess I could not fully understand your comment :( If possible can you please explain it a little bit more.

https://github.com/llvm/llvm-project/pull/69422


More information about the lldb-commits mailing list