mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-23 09:43:06 +00:00
4e770fb18a
Signed-off-by: Omar Sandoval <osandov@osandov.com>
13 lines
350 B
Python
Executable File
13 lines
350 B
Python
Executable File
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
# SPDX-License-Identifier: GPL-3.0+
|
|
|
|
"""A simplified implementation of ps(1) using drgn"""
|
|
|
|
from drgn.helpers.linux.pid import for_each_task
|
|
|
|
print("PID COMM")
|
|
for task in for_each_task(prog):
|
|
pid = task.pid.value_()
|
|
comm = task.comm.string_().decode()
|
|
print(f"{pid:<10} {comm}")
|