[Lldb-commits] [lldb] [lldb] colorize symbols in image lookup with a regex pattern (PR #69422)
José Lira Junior via lldb-commits
lldb-commits at lists.llvm.org
Wed Dec 6 08:26:52 PST 2023
================
@@ -70,6 +72,31 @@ size_t Stream::PutCString(llvm::StringRef str) {
return bytes_written;
}
+void Stream::PutCStringColorHighlighted(llvm::StringRef text,
+ const char *pattern) {
+ if (!pattern) {
+ PutCString(text);
+ return;
+ }
+
+ // If pattern is not nullptr, we should use color
+ llvm::Regex reg_pattern(pattern);
+ llvm::SmallVector<llvm::StringRef, 1> matches;
+ llvm::StringRef remaining = text;
+ std::string format_str = lldb_private::ansi::FormatAnsiTerminalCodes(
+ "${ansi.fg.red}%.*s${ansi.normal}");
----------------
junior-jl wrote:
![image](https://github.com/llvm/llvm-project/assets/69206952/a9c34f6f-b671-4fc2-bc6c-abf8d9d489d2)
This is how it is working now. Basically no color for SymbolContext. IMO, it is a little weird, but the alternative option of forcing red color when no target is available could be weirder when the color was changed by the user.
https://github.com/llvm/llvm-project/pull/69422
More information about the lldb-commits
mailing list