================ @@ -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") + self.assertEqual(len(collected_info), info_list.GetSize(), "Should have collected all items") + + for i in range(len(collected_info)): + region = lldb.SBMemoryRegionInfo() + info_list.GetMemoryRegionAtIndex(i, region) + + self.assertEqual(collected_info[i].GetRegionBase(), region.GetRegionBase(), ---------------- Jlalond wrote:
Nit: We should just add an equality method to SBMemoryRegionInfo and call that. https://github.com/llvm/llvm-project/pull/144815 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits