[Lldb-commits] [lldb] [lldb][breakpointoptions] Make disabled keyword red (PR #91404)

Chelsea Cassanova via lldb-commits lldb-commits at lists.llvm.org
Thu May 9 11:18:54 PDT 2024


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

>From c334f7357aebefa3e0b7af645396e699cf3a4c8d Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova <chelsea_cassanova at 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 | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp
index ae845e92762b9..3f42e9fc7df90 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"
@@ -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());
+
   // They just made the breakpoint, they don't need to be told HOW they made
   // it... Also, we'll print the breakpoint number differently depending on
   // whether there is 1 or more locations.



More information about the lldb-commits mailing list