File: kcore_list.py

package info (click to toggle)
drgn 0.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,852 kB
  • sloc: python: 74,992; ansic: 54,589; awk: 423; makefile: 351; sh: 99
file content (16 lines) | stat: -rwxr-xr-x 527 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env drgn
# Copyright (c) Meta Platforms, Inc. and affiliates.
# SPDX-License-Identifier: LGPL-2.1-or-later

"""Dump the list of memory regions exposed by /proc/kcore."""

from drgn import cast
from drgn.helpers.linux.list import list_for_each_entry

kcore_type = prog.type("enum kcore_type")
for entry in list_for_each_entry(
    "struct kcore_list", prog["kclist_head"].address_of_(), "list"
):
    print(
        f"{cast(kcore_type, entry.type).format_(type_name=False)} {hex(entry.addr)} {hex(entry.size)}"
    )