[libcxxabi] [lldb] [llvm] [lldb] Add frame-format option to highlight function names in backtraces (PR #131836)

Michael Buch via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 8 08:04:43 PDT 2025


================
@@ -2074,6 +2076,64 @@ static const Definition *FindEntry(const llvm::StringRef &format_str,
   return parent;
 }
 
+/// Parses a single highlighting format specifier.
+///
+/// Example syntax for such specifier:
+/// \code
+/// ${function.name-with-args:%highlight_basename(ansi.fg.green)}
----------------
Michael137 wrote:

@felipepiovezan pointed out that maybe we could have something like the following:
```
${function.return}${function.scope}${function.basename}${function.arguments}
```
instead of a format specifier. That way the user could highlight/omit the bits of the frame name they want, without having a dedicated implementation for each.

That would also make `${function.name-without-args}` redundant. If people prefer that, I'm happy to give that a shot. I implemented something similar in early prototypes, but felt that having dedicated variables for each part of the function name feels redundant for most use-cases. But thinking about again, it does synergize nicely with the existing color support of `frame-format`.

We'll have to handle these variables inside the language plugins however. So there needs to be some sensible fallback for when a plugin doesn't know what a `basename` is yet.

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


More information about the llvm-commits mailing list