================ @@ -154,14 +154,33 @@ 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 + collected_info.append(info) except Exception: self.fail("SBMemoryRegionInfoList is not iterable") + + for i in range(len(collected_info)): + region = lldb.SBMemoryRegionInfo() + info_list.GetMemoryRegionAtIndex(i, region) + + self.assertEqual( + collected_info[i], + region, + f"items {i}: iterator data should match index access data", + ) + + if len(collected_info) >= 2: ---------------- Jlalond wrote:
I'd assert the if personally. If we need to we can make an example that specifically calls `mmap` 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