示例#1
0
文件: test_mm.py 项目: pzakha/drgn
 def test_pfn_to_from_page(self):
     with self._pages() as (map, _, pfns):
         for i, pfn in enumerate(pfns):
             page = pfn_to_page(self.prog, pfn)
             # Test that we got the correct page by looking at the index: it
             # should be page i in the file.
             self.assertEqual(page.index, i)
             # Test the opposite direction.
             self.assertEqual(page_to_pfn(page), pfn)
示例#2
0
def lookup_cache_by_address(obj: drgn.Object) -> Optional[drgn.Object]:
    pfn = virt_to_pfn(sdb.get_prog(), obj)
    page = pfn_to_page(pfn)
    cache = page.slab_cache
    try:
        # read the name to force FaultError if any
        _ = cache.name.string_().decode('utf-8')
    except drgn.FaultError:
        return None
    return cache
示例#3
0
文件: test_mm.py 项目: osandov/drgn
 def test_decode_page_flags(self):
     with self._pages() as (map, _, pfns):
         page = pfn_to_page(self.prog, pfns[0])
         self.assertIn("PG_swapbacked", decode_page_flags(page))