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

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 26 02:34:00 PDT 2023


================
@@ -0,0 +1,23 @@
+UNSUPPORTED: system-windows
+
+# RUN: %clang_host -g %S/Inputs/main.c -o %t
+# RUN: %lldb %t -b -o 'image lookup -r -s ma' | FileCheck %s
----------------
DavidSpickett wrote:

I should have brought this up earlier but the way you're coloring the output doesn't actually do a regex match, it looks for substrings. This works fine if the input is itself basically a substring like here, but would not for `m[abc]`.

(keep these test lines they're good, but add more to cover this)

So you'll need some way to either do the matching again while formatting, or pass instead of `name`, a list of matched locations from the initial search.

I suggest you start by doing the first idea, redo the regex match in the formatting function. That'll give you an idea of what data you'd require, if we were to instead pass the result of the first matching to the formatter.

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


More information about the lldb-commits mailing list