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 invoke(self, argument: str, from_tty: bool) -> None:
14 pp = MyPrettyPrinter()
15 ProcInfo.process_at(argument).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 invoke(self, argument: str, from_tty: bool) -> None:
27 args = self._parse_args(argument)
31 sched_context = gdb.parse_and_eval("&sched_ctx")
32 sched = Scheduler(sched_context)
34 sched.print_detailed(MyPrettyPrinter(), args.print_type, args.long_list)