[Lldb-commits] [lldb] [lldb] Fix SBMemoryRegionInfoListExtensions iter to yield unique refe… (PR #144815)

Jacob Lalonde via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 18 17:51:59 PDT 2025


================
@@ -154,14 +154,32 @@ def test_find_in_memory_unaligned(self):
         self.assertEqual(addr, lldb.LLDB_INVALID_ADDRESS)
 
     def test_memory_info_list_iterable(self):
-        """Make sure the SBMemoryRegionInfoList is iterable"""
+        """Make sure the SBMemoryRegionInfoList is iterable and each yielded object is unique"""
         self.assertTrue(self.process, PROCESS_IS_VALID)
         self.assertState(self.process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
 
         info_list = self.process.GetMemoryRegions()
         self.assertTrue(info_list.GetSize() > 0)
+
+        collected_info = []
         try:
-            for info in info_list:
-                pass
+            for region in info_list:
+                collected_info.append(region)
         except Exception:
             self.fail("SBMemoryRegionInfoList is not iterable")
+        
+        self.assertTrue(len(collected_info) >= 2, "Need at least 2 items")
----------------
Jlalond wrote:

Why 2? We know the number of emmeory regions from `info_list`, compare to the underlying collection

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


More information about the lldb-commits mailing list