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

>From 0e45adeac968aa435f58dfef026ef308e56b40a5 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova <chelsea_cassan...@apple.com>
Date: Thu, 9 May 2024 11:08:29 -0700
Subject: [PATCH] [lldb][breakpoint] Grey out disabled breakpoints

This commit adds colour settings to the list of breakpoints in order to
grey out breakpoints that have been disabled.
---
 lldb/source/Breakpoint/Breakpoint.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lldb/source/Breakpoint/Breakpoint.cpp 
b/lldb/source/Breakpoint/Breakpoint.cpp
index ae845e92762b9..8d28c5f1873e1 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -15,6 +15,7 @@
 #include "lldb/Breakpoint/BreakpointResolver.h"
 #include "lldb/Breakpoint/BreakpointResolverFileLine.h"
 #include "lldb/Core/Address.h"
+#include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Core/SearchFilter.h"
@@ -26,6 +27,7 @@
 #include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/ThreadSpec.h"
+#include "lldb/Utility/AnsiTerminal.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/Stream.h"
@@ -837,6 +839,12 @@ void Breakpoint::GetDescription(Stream *s, 
lldb::DescriptionLevel level,
                                 bool show_locations) {
   assert(s != nullptr);
 
+  // Grey out any disabled breakpoints in the list of breakpoints.
+  const bool print_faint =
+      (!IsEnabled() && GetTarget().GetDebugger().GetUseColor());
+  if (print_faint)
+    s->Printf("%s", ansi::FormatAnsiTerminalCodes("${ansi.faint}").c_str());
+
   if (!m_kind_description.empty()) {
     if (level == eDescriptionLevelBrief) {
       s->PutCString(GetBreakpointKind());
@@ -933,6 +941,10 @@ void Breakpoint::GetDescription(Stream *s, 
lldb::DescriptionLevel level,
     }
     s->IndentLess();
   }
+
+  // Reset the colors back to normal if they were previously greyed out.
+  if (print_faint)
+    s->Printf("%s", ansi::FormatAnsiTerminalCodes("${ansi.normal}").c_str());
 }
 
 void Breakpoint::GetResolverDescription(Stream *s) {

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to