[Lldb-commits] [lldb] [LLDB][SBProgress] Fix bad optional access in sbprogress (PR #128971)

David Peixotto via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 26 16:07:02 PST 2025


================
@@ -33,3 +33,15 @@ def test_without_external_bit_set(self):
         expected_string = "Test progress first increment"
         progress.Increment(1, expected_string)
         self.assertFalse(listener.PeekAtNextEvent(event))
+
+    def test_with_external_bit_set(self):
+        """Test SBProgress can handle null events."""
+
+        progress = lldb.SBProgress("Test SBProgress", "Test progress", self.dbg)
+        listener = lldb.SBListener("Test listener")
+        broadcaster = self.dbg.GetBroadcaster()
+        broadcaster.AddListener(listener, lldb.eBroadcastBitExternalProgress)
+        event = lldb.SBEvent()
+
+        progress.Increment(1, None)
----------------
dmpots wrote:

Would `progress.Increment(1, "")` map to the case where `description[0] == '\0'`? If so seems like a cheap test to add.

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


More information about the lldb-commits mailing list