[Lldb-commits] [lldb] [lldb][sbdebugger] Match progress category enum bit in Debugger.h (PR #87409)

Chelsea Cassanova via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 10 14:37:09 PDT 2024


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

>From 7561d03d775822f789a61a5b827dfa04b29b57b2 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova <chelsea_cassanova at apple.com>
Date: Tue, 2 Apr 2024 13:22:15 -0700
Subject: [PATCH 1/3] [lldb][sbdebugger] Match progress category enum bit in
 Debugger.h

When the `eBroadcastBitProgressCategory` bit was originally added to
Debugger.h and SBDebugger.h, each corresponding bit was added in order
of the other bits that were previously there. Since `Debugger.h` has an
enum bit that `SBDebugger.h` does not, this meant that their offsets did
not match. This commit changes it so that the bit offsets match each other.
---
 lldb/include/lldb/API/SBDebugger.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h
index 62b2f91f5076d5..a994874dde6d4a 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -42,11 +42,13 @@ class LLDB_API SBInputReader {
 
 class LLDB_API SBDebugger {
 public:
+  // The enum values here need to match their corresponding values in
+  // Debugger.h.
   FLAGS_ANONYMOUS_ENUM(){
       eBroadcastBitProgress = (1 << 0),
       eBroadcastBitWarning = (1 << 1),
       eBroadcastBitError = (1 << 2),
-      eBroadcastBitProgressCategory = (1 << 3),
+      eBroadcastBitProgressCategory = (1 << 4),
   };
 
   SBDebugger();

>From a37c65dea5794e474e554f4b1762f0f630965afe Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova <chelsea_cassanova at apple.com>
Date: Mon, 8 Apr 2024 16:39:41 -0700
Subject: [PATCH 2/3] Add SBDebugger broadcast bits to lldb-enumerations

Per Alex's suggestions, adds the broadcast bits from SBDebugger
into lldb-enumerations.
---
 lldb/include/lldb/lldb-enumerations.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h
index 646f7bfda98475..17f4125c50cced 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -1339,6 +1339,14 @@ enum AddressMaskRange {
   eAddressMaskRangeAll = eAddressMaskRangeAny,
 };
 
+/// Used by the debugger to indicate which events are being broadcasted.
+enum DebuggerBroadcast {
+  eBroadcastBitProgress = (1 << 0),
+  eBroadcastBitWarning = (1 << 1),
+  eBroadcastBitError = (1 << 2),
+  eBroadcastBitProgressCategory = (1 << 4),
+};
+
 } // namespace lldb
 
 #endif // LLDB_LLDB_ENUMERATIONS_H

>From 39b05ffc015476e854b301a84f1bdd3c46257448 Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova <chelsea_cassanova at apple.com>
Date: Wed, 10 Apr 2024 10:22:55 -0700
Subject: [PATCH 3/3] Remove broadcast enum from SBDebugger

Removes the enum for broadcast bits from SBDebugger as they're now in
lldb-enumerations.h. This also requires uses of these bits to be updated
in some API tests.
---
 lldb/include/lldb/API/SBDebugger.h                       | 9 ---------
 lldb/include/lldb/lldb-enumerations.h                    | 4 ++--
 .../diagnostic_reporting/TestDiagnosticReporting.py      | 2 +-
 .../progress_reporting/TestProgressReporting.py          | 2 +-
 .../clang_modules/TestClangModuleBuildProgress.py        | 2 +-
 lldb/test/API/macosx/rosetta/TestRosetta.py              | 2 +-
 6 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h
index a994874dde6d4a..cf5409a12a056a 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -42,15 +42,6 @@ class LLDB_API SBInputReader {
 
 class LLDB_API SBDebugger {
 public:
-  // The enum values here need to match their corresponding values in
-  // Debugger.h.
-  FLAGS_ANONYMOUS_ENUM(){
-      eBroadcastBitProgress = (1 << 0),
-      eBroadcastBitWarning = (1 << 1),
-      eBroadcastBitError = (1 << 2),
-      eBroadcastBitProgressCategory = (1 << 4),
-  };
-
   SBDebugger();
 
   SBDebugger(const lldb::SBDebugger &rhs);
diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h
index 17f4125c50cced..f3b07ea6d20395 100644
--- a/lldb/include/lldb/lldb-enumerations.h
+++ b/lldb/include/lldb/lldb-enumerations.h
@@ -1340,11 +1340,11 @@ enum AddressMaskRange {
 };
 
 /// Used by the debugger to indicate which events are being broadcasted.
-enum DebuggerBroadcast {
+enum DebuggerBroadcastBit {
   eBroadcastBitProgress = (1 << 0),
   eBroadcastBitWarning = (1 << 1),
   eBroadcastBitError = (1 << 2),
-  eBroadcastBitProgressCategory = (1 << 4),
+  eBroadcastBitProgressCategory = (1 << 3),
 };
 
 } // namespace lldb
diff --git a/lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py b/lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py
index 36a3be695628f5..6353e3e8cbedbd 100644
--- a/lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py
+++ b/lldb/test/API/functionalities/diagnostic_reporting/TestDiagnosticReporting.py
@@ -15,7 +15,7 @@ def setUp(self):
         self.broadcaster = self.dbg.GetBroadcaster()
         self.listener = lldbutil.start_listening_from(
             self.broadcaster,
-            lldb.SBDebugger.eBroadcastBitWarning | lldb.SBDebugger.eBroadcastBitError,
+            lldb.eBroadcastBitWarning | lldb.eBroadcastBitError,
         )
 
     def test_dwarf_symbol_loading_diagnostic_report(self):
diff --git a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
index 9af53845ca1b77..98988d7624da3c 100644
--- a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
+++ b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py
@@ -13,7 +13,7 @@ def setUp(self):
         TestBase.setUp(self)
         self.broadcaster = self.dbg.GetBroadcaster()
         self.listener = lldbutil.start_listening_from(
-            self.broadcaster, lldb.SBDebugger.eBroadcastBitProgress
+            self.broadcaster, lldb.eBroadcastBitProgress
         )
 
     def test_dwarf_symbol_loading_progress_report(self):
diff --git a/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py b/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py
index 228f676aedf6ac..33c7c269c081e4 100644
--- a/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py
+++ b/lldb/test/API/functionalities/progress_reporting/clang_modules/TestClangModuleBuildProgress.py
@@ -34,7 +34,7 @@ def test_clang_module_build_progress_report(self):
         # other unrelated progress events.
         broadcaster = self.dbg.GetBroadcaster()
         listener = lldbutil.start_listening_from(
-            broadcaster, lldb.SBDebugger.eBroadcastBitProgress
+            broadcaster, lldb.eBroadcastBitProgress
         )
 
         # Trigger module builds.
diff --git a/lldb/test/API/macosx/rosetta/TestRosetta.py b/lldb/test/API/macosx/rosetta/TestRosetta.py
index ce40de475ef16c..669db95a1624c6 100644
--- a/lldb/test/API/macosx/rosetta/TestRosetta.py
+++ b/lldb/test/API/macosx/rosetta/TestRosetta.py
@@ -49,7 +49,7 @@ def test_rosetta(self):
         if rosetta_debugserver_installed():
             broadcaster = self.dbg.GetBroadcaster()
             listener = lldbutil.start_listening_from(
-                broadcaster, lldb.SBDebugger.eBroadcastBitWarning
+                broadcaster, lldb.eBroadcastBitWarning
             )
 
             target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(



More information about the lldb-commits mailing list