コード例 #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))