2 from .utils import pid_argument, llist_foreach
3 from .pp import MyPrettyPrinter
4 from .structs.pcb import ProcInfo
5 from .structs.scheduler import Scheduler
6 from .commands import LunadbgCommand
8 class ProcessDump(LunadbgCommand):
9 """Dump the state of Lunaix PCB"""
10 def __init__(self) -> None:
11 super().__init__("proc")
13 def execute(self, parsed, gdb_args, from_tty):
14 pp = MyPrettyPrinter()
15 ProcInfo.process_at(gdb_args).print_detailed(pp)
18 class SchedulerDump(LunadbgCommand):
19 """Dump the state of Lunaix process table"""
20 def __init__(self) -> None:
21 super().__init__("sched")
22 self._parser.add_argument("print_type")
23 self._parser.add_argument("-l", "--long-list",
24 required=False, default=False, action='store_true')
26 def on_execute(self, args, gdb_args, from_tty):
27 sched_context = gdb.parse_and_eval("&sched_ctx")
28 sched = Scheduler(sched_context)
30 sched.print_detailed(MyPrettyPrinter(), args.print_type, args.long_list)