[Lldb-commits] [lldb] [lldb][breakpoint] Grey out disabled breakpoints (PR #91404)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu May 9 11:46:57 PDT 2024


================
@@ -848,6 +850,13 @@ void Breakpoint::GetDescription(Stream *s, lldb::DescriptionLevel level,
   const size_t num_locations = GetNumLocations();
   const size_t num_resolved_locations = GetNumResolvedLocations();
 
+  // Grey out any disabled breakpoints in the list of breakpoints.
+  if (GetTarget().GetDebugger().GetUseColor())
+    s->Printf("%s",
+              IsEnabled()
+                  ? ansi::FormatAnsiTerminalCodes("${ansi.normal}").c_str()
+                  : ansi::FormatAnsiTerminalCodes("${ansi.faint}").c_str());
----------------
JDevlieghere wrote:

You need to reset the color after printing, otherwise everything in the terminal printed after will be faint.  Also seems like you can simplify this by moving the check for `IsEnabled()` into the first `if`:

```
const bool print_faint = !IsEnabled() && GetTarget().GetDebugger().GetUseColor();
if (print_faint)
     s->Print(ansi::FormatAnsiTerminalCodes("${ansi.faint}"));

[...]

if (print_faint)
     s->Print(ansi::FormatAnsiTerminalCodes("${ansi.reset}"));
```


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


More information about the lldb-commits mailing list